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

Rust's `can_build` function for the worker unit seems to be wrong #160

Closed samwho closed 2 years ago

samwho commented 2 years ago
    pub fn can_build(&self, game_map: &GameMap) -> bool {
        let ref cell = game_map[self.pos];
        self.unit_type == UnitType::Worker &&
            !cell.has_resource() &&
            self.can_act() &&
            self.cargo_space_used() > City::city_build_cost()
    }

That last check, self.cargo_space_used() > City::city_build_cost(), will never be true. Workers can only carry 100, and the city build cost is 100. If I change this to be >= it works.

tye-singwa commented 2 years ago

Hi, @samwho! Yeah, you right, this actually should be >=, created PR that fixeds it.

StoneT2000 commented 2 years ago

thanks! closed by #161

samwho commented 2 years ago

Thank you for the quick turnaround on this!