An open API service indexing awesome lists of open source software.

https://github.com/abranhe/hola-challenge

Hola JS Challenge Summer 2018: Haggling
https://github.com/abranhe/hola-challenge

hola-challenge javascript js nodejs

Last synced: 2 months ago
JSON representation

Hola JS Challenge Summer 2018: Haggling

Awesome Lists containing this project

README

          

# ![Hola!](https://hola.org/img/logo.png) Challenge 2018

> Author: Carlos Abraham Hernandez

[![abranhe](https://abranhe.com/badge.svg)](https://github.com/abranhe)
[![Build Status](https://img.shields.io/travis/abranhe/hola-challenge.svg?logo=travis)](https://travis-ci.org/abranhe/hola-challenge)

# Overview

This is my solution for the [2018 Hola Challenge](https://github.com/hola/challenge_haggling)

Let's say there are a book, two hats, and three balls. You and a partner have to decide how to split these objects between the two of you. To you, the book is worth $4, a ball $2, and the hats are worthless. The partner might value the same objects differently; you don't know their valuation, but you know that the total worth of all objects is the same as for you, in this case, $10.

You and the partner take turns making offers to each other about how to split the goods. On each turn, one can either accept the partner's offer (except on the very first turn), or make a counter-offer. The negotiations are limited to 5 rounds (that is, there can be up to 10 offers in total). If an agreement is reached, each of you receives the amount that their part of the goods is worth to them. If there is still no agreement after the last turn (that is, the last word is a counter-offer rather than acceptance), neither partner receives anything at all. The same happens if one of the partners walks away from the negotiations.

Here is how the negotiations might go:

1. **You:** I want the book and two balls; you get a ball and both hats.
2. **Other:** I don't accept. I want all the balls and a hat; you get the book and a hat.
3. **You:** I don't accept. I want the book and a ball; you get two balls and both hats.

# License

[BSD 2-Clause](https://github.com/abranhe/hola-challenge/blob/master/LICENSE) License © [Carlos Abraham](https://github.com/abranhe/)