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 152 forks source link

Question about resource collection mechanics of a CityTile #143

Closed sash2104 closed 2 years ago

sash2104 commented 2 years ago

https://www.lux-ai.org/specs-2021

Workers cannot mine while on CityTiles. Instead, if there is at least one Worker on a CityTile, that CityTile will automatically collect adjacent resources at the same rate as a worker each turn and directly convert it all to fuel. The collection mechanic for a CityTile is the same as a worker and you can treat a CityTile as an individual Worker collecting resources.

What is the expected behavior of the above specifications?

Candidates are:

In my understanding, (c) is the current behavior. But this comment says (a) is the expected behavior.

For example,

Case 1:

Case 2:

StoneT2000 commented 2 years ago

(a) is the expected behavior

you can treat a CityTile as an individual Worker collecting resources.

sash2104 commented 2 years ago

@StoneT2000 thank you for the explanation.

In Case 2, how many woods will be collected by the CityTile? 30? If (a) is the expected behavior, then CityTile is subject to the same constraints as other Workers, and I think it cannot collect more than 20 wood (wood collection rate per turn).

Am I misunderstanding something?

StoneT2000 commented 2 years ago

Note that ResourceRequests are made by tile. basically if a tile already has a request for resources, other units on the same tile cannot generate more requests. See https://github.com/Lux-AI-Challenge/Lux-Design-2021/blob/26ff64b1d119c7ac582acb2b4df17c0d70cd819d/src/Game/index.ts#L675-L685

Once resource requests are made, if a resource request's location is the same as a city tile, we don't use that 2nd amount argument anymore. See

https://github.com/Lux-AI-Challenge/Lux-Design-2021/blob/26ff64b1d119c7ac582acb2b4df17c0d70cd819d/src/Game/index.ts#L702-L709

So in the end, only r1 is created, and since on (5, 5) we have a CityTile, the CityTile collects 20 wood and converts that into 20 fuel. None of the workers u_1 or u_2 collect anything, and the worker u_2 drops all 90 wood into the CityTile for it to be converted into 90 fuel.

sash2104 commented 2 years ago

basically if a tile already has a request for resources, other units on the same tile cannot generate more requests ... So in the end, only r1 is created,

In current implementation, if 2nd amount argument is different, multiple requests will be generated for units on the same tile. https://github.com/Lux-AI-Challenge/Lux-Design-2021/blob/26ff64b1d119c7ac582acb2b4df17c0d70cd819d/src/Game/index.ts#L26-L39

In Case 2, 2nd amount argument between r1 and r2 is different, so both r1 and r2 are created.


I wrote a test to reproduce Case 2, and it looks like CityTile is collecting 30 wood instead of 20. Could you please check this? https://github.com/sash2104/Lux-Design-2021/pull/1

StoneT2000 commented 2 years ago

Hi, this is definitely a bug. However, our team has decided that it is too minor of a thing to ever get used as it's rare for this to occur.