Giter Site home page Giter Site logo

halitechallenge / halite-iii Goto Github PK

View Code? Open in Web Editor NEW
177.0 10.0 111.0 201.29 MB

Season 3 of @twosigma's artificial intelligence programming challenge

License: MIT License

Batchfile 0.09% Shell 0.22% Python 10.58% Mako 0.01% PLpgSQL 0.22% CMake 0.13% C++ 6.16% HTML 0.62% JavaScript 73.06% Go 0.43% Java 0.50% Kotlin 0.39% Rust 0.53% Scala 0.33% Vue 4.43% CSS 0.10% Ruby 1.75% Emacs Lisp 0.01% PHP 0.44% Makefile 0.01%
ai machine-learning competitive-programming competition coding-challenge halite

halite-iii's People

Contributors

benjaminfspector avatar bovard avatar charlesyuan314 avatar daowen avatar dependabot[bot] avatar erdman avatar fohristiwhirl avatar franksun001 avatar gogokefakefa avatar harikmenon avatar harim86 avatar hvtuananh avatar ingayu avatar j-clap avatar janzert avatar jerold avatar julskast avatar katieamazing avatar kerollmops avatar lanyudhy avatar lidavidm avatar mykolagolubyev avatar salynch avatar samamiller avatar snaar avatar stoianchoo avatar toannguyen132 avatar truell20 avatar whatelsie avatar xinnosuke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

halite-iii's Issues

Checklist for new kits

Thoughts for now:

  • can take own rng seed as first cmd line arg
  • normalization handles negative coordinates
  • instances of ship class are reused between turns as needed

Process termination in game engine

Currently processes are forcefully terminated at the end of the game.

UnixConnection::~UnixConnection() noexcept {
kill(-process, SIGKILL);
}

WinConnection::~WinConnection() noexcept {
if (read_pipe != INVALID_HANDLE_VALUE) {
CloseHandle(read_pipe);
}
if (write_pipe != INVALID_HANDLE_VALUE) {
CloseHandle(write_pipe);
}
if (process != INVALID_HANDLE_VALUE) {
TerminateProcess(process, 0);
CloseHandle(process);
}
}

The use of SIGKILL inside UnixConnetion.cpp forcibly shuts down the process without giving it a chance to clean up. Thus, atexit handlers, such as the ShutdownHooks inside Log.java of the Java kit, do not have a chance to run. While I am not as familiar with process signalling on Windows, this article form Dr. Dobbs suggests that TerminateProcess in WinConnection.cpp is equally dangerous.

My suggestion would be using a gentler process of sending SIGTERM (and its Windows equivalent) to give the process a chance to clean up, and then using forcible termination after a short delay if the process hasn't exited by then. This allows higher level languages to perform internal cleanup operations and would also allow users to write their own cleanup functions, e.g. to flush log files.

"Efficiency" has conflicting definitions

In the visualiser there's this statistic next to the score, and when you mouseover it it defines efficiency as "current halite / halite collected" (i.e. where collected means 5000 + all deposits ever made).

But this is very different from the concept of efficiency in a player profile, which I believe is something like deposits / non-inspired mining?

My bot can't move...

Examples:

  1. https://halite.io/play/?game_id=776803&replay_class=1&replay_name=replay-20181021-065751%2B0000-1540104221-56-56-776803
  2. https://halite.io/play/?game_id=773475&replay_class=1&replay_name=replay-20181021-035417%2B0000-1540093306-40-40-773475

And some other 4 player games from v15 of my bot.

I found this odd, because my code is moving the ships from the start...

I downloaded the replay from the example 1 (unzip):
776803.hlt.zip. I'm watching it in https://github.com/fohristiwhirl/fluorine. However I don't see the log of my bot. I found it was run with --width 56 --height 56 -s 1540104221 so I tried to reproduce it locally with run_game.sh:

./halite --replay-directory replays/ -vvv -n 4 --width 56 --height 56 -s 1540104221 "./MyBot" "./MyBot" "./MyBot" "./MyBot"

But this runs game with 4 bots of mine and then everything works.

Java Starter Kit isn't correctly working on Windows

Error:

Turn 1

error: failed to decode bot message: "C" (at position 1)
Last input received was:
Caused by: java.lang.ClassNotFoundException: MyBot

Appears to happen in Windows 10 with the following Java versions installed:
Java 8 (171)
Java 10.0.2

Julia Starter Kit

I am working on a julia starter-kit. Will have a PR ready soon. Shout out to me if anybody wants to join.

Problems with halite executable

From https://github.com/HaliteChallenge/Halite-III/blob/master/starter_kits/C%2B%2B/README.md:

Linux users: if you're having problems running the bundled halite executable, you will probably want to build your own from source.

Where is the bundled halite executable?

I also tried to build game_engine (this will produce halite, right?) with:

cmake .
make

with gcc 7.3 and 8.1 on Ubuntu 16.04 compatible OS, but make fails with:

ld: unrecognized option '--push-state--no-as-needed'.

stderr is treated as stdout on Windows

To reproduce, run the engine with the following Python bot:

assert False

On Windows, I get the following results:

.\halite.exe "python3 my_bot.py" "python3 my_bot.py"

[info] Map seed is 1539953260
[info] [P0] Launching with command py my_bot.py
[info] [P1] Launching with command py my_bot.py
[info] [P0] Initializing player
[info] [P1] Initializing player
[info] [P0] Initialized player Traceback (most recent call la
[info] [P1] Initialized player Traceback (most recent call la
[info] Player initialization complete
[error] [1] [P1] Communication failed
[error] [1] [P0] Communication failed
[error] [1] [P0] Last input received was:
[error] [1] [P0]   File "my_bot.py", line 1, in <module>
[error] [1] [P0]     assert False
[error] [1] [P0] AssertionError
[error] [1] [P1] Last input received was:
[error] [1] [P1]   File "my_bot.py", line 1, in <module>
[error] [1] [P1]     assert False
[error] [1] [P1] AssertionError
...

This is incorrect. The bot's name clearly isn't "Traceback (most recent call la". And the ending of the diagnostic message is lost!

For comparison, I get much more reasonable results on Linux:

./halite "python3 my_bot.py" "python3 my_bot.py"

[info] Map seed is 1539953470
[info] [P0] Launching with command python3 MyBot.py
[info] [P1] Launching with command python3 MyBot.py
[info] [P0] Initializing player
[info] [P1] Initializing player
[error] [P0] Failed to initialize
[error] [P1] Failed to initialize
[error] [P0] Player's error output was:
[error] [P0] Traceback (most recent call last):
[error] [P0]   File "MyBot.py", line 4, in <module>
[error] [P0]     assert False
[error] [P0] AssertionError
[error] [P1] Player's error output was:
[error] [P1] Traceback (most recent call last):
[error] [P1]   File "MyBot.py", line 4, in <module>
[error] [P1]     assert False
[error] [P1] AssertionError
...

naive_navigate shouldn't mark the cell as unsafe

I can't comment for the other starter kits, but I don't think naive_navigate function should mark the cell unsafe (here)[https://github.com/HaliteChallenge/Halite-III/blob/ab9b43add935518734bd16f71e257048b2240ff6/starter_kits/Python3/hlt/game_map.py#L235]. For me, this is an unwanted side effect and I think the direction getting function could be split out.

Can I confirm that the bot compiles with the hlt module included in our projects? If this is the case I'll just change it there.

ML bot fails because of lacking libs

Error:
error: communication error with bot: read failed, errno was: 0 (Success)
Bot error output was:
/usr/local/lib/python3.6/dist-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module’s documentation for alternative uses
import imp
Traceback (most recent call last):
File “MyBot.py”, line 7, in
import model
File “/home/worker/Halite/apiserver/worker/tmpy76dau6m/496_0_jwjohns/model.py”, line 7, in
from tqdm import tqdm
ModuleNotFoundError: No module named ‘tqdm’

Need to bake these libs into base image

Improve information density

Challenges: give rank, tier, and %/# of games won. Link to games played.

Visualizer: give tier; move unit selection card to floating window.

Overall: maybe a long press/hover popup widget for quick user info?

[python starter kit] Move class Player out of game_map.py into player.py

If the Python starter kit is intended as the most accessible for aspiring AI developers, it's eventually worth moving the Player class out of game_map.py and into its own file.

At this stage of the competition it may temporarily create some backwards compatibility issues if anyone is importing the Player class from game_map, but that's unlikely to be a significant issue because:

  1. There was no need to import Player anywhere in my first 20+ hours on my Python submission. The instance is accessible easily enough via game.Me and there's little reason for developers to actually import it.
  2. Considering the above, anyone who 1) has found the Player class hiding in game_map.py, and 2) imports it into one of their files for whatever reason ==> is likely savvy enough with Python to immediately understand and fix the import error in under ~5-10 seconds if they need to shift it in their own code.

ref: https://github.com/HaliteChallenge/Halite-III/blob/master/starter_kits/Python3/hlt/game_map.py#L9

Local and online games play out differently

Two of my ships always collide immediately (upon spawning) when playing games online, leaving me with only 3 ships to start with every game.

However, there was no such problem when I was running games locally. I always successfully resolve their movements without collision and start with 5 ships every time.

Please help look into this, thanks!

Segfault when issuing commands to nonexistent ships

Found by ChatTor on Discord:

Anyway, I found a seg fault in the halite executable for Linux and am not sure what causes it. I can reproduce it with the following:
Round 1: Send g\n\n 
Round 2: Send g\nm 0 s\n\n 
It seems to seg fault immediately after that

Upgrade Lua to 5.3 and enable compilation

Please upgrade the Lua interpreter to Lua 5.3 if possible and enable it in the compiler.py script by differentiating between LuaJIT and Lua 5.3 via an additional file extension, e.g. .lua53 or .luajit.

LuaJIT implements most of Lua 5.2 already, Lua 5.3 is the current standard and has been released over three years ago.

Segmentation fault on Macos

This is hard for me to verify, but I was getting a string of these segfaults this morning. They seemed to happen immediately after statements like this:

[warn] [31] [P1] entity 0 was directed to use 1 halite to move west, but only 0 halite was available [warn] [31] [P0] entity 1 was directed to use 1 halite to move east, but only 0 halite was available [warn] [31] [P0] owned entities 5, 1 collided on cell (9, 16) as the result of moves on this turn [warn] [31] [P1] owned entities 4, 0 collided on cell (22, 16) as the result of moves on this turn run_game.sh: line 6: 18498 Segmentation fault: 11 ./halite --replay-directory replays/ -vvv --width 32 --height 32 "java -jar build/libs/halite3-6.jar" "java -jar build/libs/halite3-6.jar"

I added some more protection around fuel management, and the errors went away.

ERROR: You must upload a .zip file.

The drag and drop upload works fine, but when you use the file selection dialogue, it is validating for
file.type === "application/zip" and browsers sometimes report zips as application/x-zip-compressed.

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.