JeremyWildsmith / bazaarbot-java

Reimplementation of bazaarbot, translated from the dotnet translation https://github.com/Vibr8gKiwi/bazaarBot2 ; originally implementation was in haxe by @larsiusprime (https://github.com/Vibr8gKiwi/bazaarBot2)
MIT License
5 stars 2 forks source link

Incorporating Trade Mechanics #3

Open JeremyWildsmith opened 5 years ago

JeremyWildsmith commented 5 years ago

I want to find a way to incorporate trade mechanics.

Right now, when two agents make a trade, the goods are immediately transferred between the two of them.

I wonder what changes would be necessary to allow for a little more complex trade mechanics. Ie, introduce the cost of delivering the goods. Some ideas:

  1. We could have the two parties form a trade contract (agreement to exchange goods before a particular dead line)
  2. A bid is made to a transporation service market to fulfill the delivery
  3. If the delivery bid is not accepted or cannot be made before the agreed deadline, it is cancelled and has to be reformed.
  4. Different agents in the trade transportation market would need to hold price beliefs of the service (maybe with the cost of travel as a base cost?)
  5. Right now, agents hold price beliefs of their goods; in the above scenario it would need to be specific not just to goods, but to agents as well. Ie price belief of trading iron with agent x

A couple problems I see with this:

I am open to input.

Thanks!

Jeremy Wildsmith

JeremyWildsmith commented 5 years ago

I think we should wait until after refactoring until implementation, but I think the implementation will be pretty simple. I'm just not sure about the algorithm to follow for introducing these mechanics?

JeremyWildsmith commented 5 years ago

FYI this is where the classes under contract came from; and where the _expected field in the Inventory class came from. They currently aren't doing anything right now though.

DigitalSmile commented 5 years ago

Yep, I would agree, let's do some refactoring first. Will do some changes today.

JeremyWildsmith commented 5 years ago

Great, sounds good.

Btw feel free to open an issue if you want to discus any refactors I made or explore better alternatives.

Thanks!

JeremyWildsmith commented 5 years ago

I have refactored the code to allow injection of custom offer execution and resolution mechanics. This should allow for contract integration a little later.