Giter Site home page Giter Site logo

Comments (8)

YoavRamon avatar YoavRamon commented on August 25, 2024

game_map instance (from game.game_map) has height and width values

from halite-iii.

snaar avatar snaar commented on August 25, 2024

Sure, but it's inconvenient. For example if you want to do any sort of normalization outside of game_map class, you have to pass height and width around. It's a lot nicer to have them as constants since they don't change during the game anyway.

from halite-iii.

anuzis avatar anuzis commented on August 25, 2024

height and width are not constants, though. They are configuration parameters which change depending on the size of the map. Indeed it would be inconvenient to pass them around everywhere. A good solution is passing them once and storing them as class attributes in whichever class handles your AI decisions.

e.g. My implementation has a HiveAI class which gets initialized with the GameMap and stores HiveAI.map_width and HiveAI.map_height so the values are easily accessible to any ShipAI (or anything else) relating to where decisions are made which may want to know width and height.

from halite-iii.

snaar avatar snaar commented on August 25, 2024

We already have max_turns in constants. That also depends on size of the map.

Storing height/width locally is fine, but then would you really double the size of position objects so that they can have height/width along with x/y so that positions can self-normalize? Seems a bit excessive.

from halite-iii.

anuzis avatar anuzis commented on August 25, 2024

Good point on precedent with max_turns, and having height and width in constants is likely higher utility to have easily accessible.

Agreed height/width shouldn't be duplicated in every Position instance (instantiation of which is already in my bot's top 5 time consuming activities via cProfile since Positions are used so often). Adding a normalization method to positions would also be convenient.

It might even be nice to normalize Position instances automatically at the time they're instantiated, since why would anyone ever prefer a non-normalized Position? Only downside is the extra processing, and Python devs are already at a relative disadvantage there.

from halite-iii.

coreylowman avatar coreylowman commented on August 25, 2024

i was just running into issues about this... since hash and eq for positions aren't released yet, i've been extracting the x and y into tuples and using those tuples in dicts and sets instead. but because positions aren't normalized automatically, that wasn't working as intended (and causing timeouts) because to the tuple hashing algorithm (0, 0) is different than (32, 32) (even though in a 32x32 map they are the same).

additionally the hash and eq methods won't even work as implemented currently because of the positions not being normalized, and they won't work unless normalization is automatically done.

from halite-iii.

coreylowman avatar coreylowman commented on August 25, 2024

Actually isn't equality broken for all starter kits since normalization isn't done automatically in any of them?

>>> Position(0, 0) == Position(32, 32)
False
>>> game_map.normalize(Position(0, 0)) == game_map.normalize(Position(32, 32))
True

Isn't that a huge issue? Path planning depends hugely on skipping already checked positions. if people aren't using normalized positions then their path planning is doing a huge amount of extra work.

from halite-iii.

snaar avatar snaar commented on August 25, 2024

Python has work-around pushed via #176

from halite-iii.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.