Lux-AI-Challenge / Lux-Design-S1

Home to the design and engine of the @Lux-AI-Challenge Season 1, hosted on @kaggle
https://lux-ai.org/
Apache License 2.0
897 stars 151 forks source link

Transferring resources is handled sequentially #30

Closed lpkirwin closed 3 years ago

lpkirwin commented 3 years ago

It looks like unit actions are handled sequentially in an arbitrary order. This might cause some confusing behaviour where actions that might seem valid/reasonable will silently fail.

Eg if I had:

worker_1: 80 wood, 20 coal
worker_2: 20 wood

and I wanted to do two transfers so that worker_1 can go build a city:

worker_1 --> worker_2: 20 coal
worker_2 --> worker_1: 20 wood

this may or may not work, depending on the order of execution. If worker_2 did its transfer first, it would silently fail because worker_1 is at capacity.

lpkirwin commented 3 years ago

(This is admittedly a pretty minor issue)

StoneT2000 commented 3 years ago

i suspect that we intend it so you can't do this actually as at the start of the turn any of the resource transfer actions would fail. would be good to add a test for this

StoneT2000 commented 3 years ago

After discussion we decided that the current implemented behavior is what it will be and this will not change.

pcoughlin commented 3 years ago

So is the current implementation to process the Actions "in the order they are pushed into the object"?

StoneT2000 commented 3 years ago

This is not correct. What happens is all actions are validated in the order they are given such that when actions execute, order does not matter.