Implementation

The implementation is available on https://extgit.iaik.tugraz.at/scos/scos.projects/2psnake.

README

Build

Build the Docker file, located in /2psnake with:

          
            docker build -f ./Dockerfile -t IMAGE_NAME:TAG .
          
        

Run

To run the previously built Docker file, execute the following command:

          
            docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY --name snake IMAGE_NAME:TAG
          
        

Playing

Generally 2-Player Snake is meant to be played against another human, but it is also possible to play against a Reinforcement Learning Agent. Players can choose between 6 different snakes and 3 maps. The SHIELD aids players by restricting movement to directions that are save to travel. By default, SHIELD is turned ON for both players but can be disabled by pressing "1" for player 1 and "2" for player 2. To play against the Agent, press "Play against AI" in the Snake selection screen. Players can win by either collecting 5 apples or if the other snake crashes.

Experiment

The bash file run_experiments.sh contains commands to run experiments on 2-Player Snake. It measures the time the SHIELD takes to calculate the crash probabilities in all possible directions with different snake lengths and amount of steps the SHIELD looks into the future. When cloned, it goes through 3 snake lengths (10, 15, 20) and through 10 to 30 steps. This takes several hours but it can be changed by altering the for-loop ranges.