-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add supernova mode to AI vs AI on demo #35
Conversation
category | ||
displacement | ||
movement-type | ||
movement-cost]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would've loved to understand why using long for the type hint is better from your commit message :p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad!
A long is a primitive, and with such, the jvm can do primitive very fast math. With the Integer reference type, it has to box/unbox it. If it has no type hint, clojure will use heavy reflection to find out the type.
More details about performance issues: https://www.youtube.com/watch?v=iQwQXVM6oiY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also updated the commit message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! :D
@donbonifacio just finished |
Replace Integer for primitive long and add more type hints to the unit. A long is a primitive, and with such, the jvm can do primitive very fast math. With the Integer reference type, it has to box/unbox it. If it has no type hint, clojure will use heavy reflection to find out the type. More details about performance issues: https://www.youtube.com/watch?v=iQwQXVM6oiY
Demo was still using the old game-mode/process. Changed to game-progress/next-stage. We now have a working demo.
Minor change: moved the intro panel with text to the top, and now the serialized game can be right next to the game. This looks more like a playground/test zone and will be useful to test the AI.
On the demo page AI vs AI, added a button that restarts the game and sets the mode to supernova.
Had to rewrite the image to the olf flag unit and have the current mode always on the state. Created an issue to solve this later: #36
I was storing on the webapp state the mode for the ai vs ai game. Whenever a game started, I'd use that mode to start a new game. Changed that logic to store an actual map with the full game options. By default it uses `game-progress/default-new-game-options`. For the supernova mode, it just associates the :supernova mode to the defaults.
@quimrstorres ready for a re-review. |
@donbonifacio everything looks great! Awesome job! 👍 |
#34