Skip to content

dariobraun/BrainySnake

 
 

Repository files navigation

Buildstate master: CircleCI

BrainySnake

brainySnakePic

BrainySnake is a game based on the all time classic game "Snake". In BrainySnake you don't actively control your snake but instead program its behaviour so it follows certain patterns. During a game, multiple autonomous Snakes are loaded simultaneously and start battling for victory! After 1000 moves (number is adjustable in Config), whoever is still alive and has the most points, wins.

Open Project

Build Project for IntelliJ

  1. checkout project
  2. run gradlew idea or for reinit gradlew cleanidea idea in your favorite console (On Unix ./gradlew cleanidea idea)
  3. open the generated .ipr file or gradlew desktop:run (On Unix ./gradlew run)

Create Desktop Run-Configuration in IntelliJ

  1. create a new Application Configuration
  2. set de.adesso.brainysnake.desktop.DesktopLauncher as Main class
  3. set [projectPath]\BrainySnake\core\assets as Working directory
  4. set desktop as classpath of module
  5. run

Build Project for eclipse

  1. checkout project
  2. import the Project with File>Import>Gradle>Existing Gradle Project

Create Desktop Run-Configuration in eclipse

  1. create a Run Configuration and choose Java Application
  2. Set brainySnake-desktop as projecct
  3. Set de.adesso.brainysnake.desktop.DesktopLauncher as Main class
  4. Save the new configuration
  5. run

Rules of the gameController

explainSnakePic

  • Each round in game the Snake can decide to go either right, left, up, down.
  • A Snake consists of a body and a head.
  • If a Snake collides with a level element - an obstacle or a level border - it loses one "part" of its body. If a snake loses all its body parts (i.e. if only the head remains) it dies.
  • If a Snake collects a point a "new part" wie be added to its body (i.e. it gets one field longer). A point is collected by navigating the Snake's head over it.
  • A Snake can bite another snake. In this case the Snake gains a point and enters the "Ghostmode"
    • During Ghostmode a Snake is protected from other Snakes' bites.
    • During Ghostmode a Snake can not collect any points or bite other players.
    • The Ghostmode takes 15 remains (depends on Config)
  • A Snake has a specific field of view. The field of view is a two dimensional grid which can contain the following information:
    • Position of level elements (borders, obstacles)
    • Points
    • Other Snakes
  • If a Snake receives an invalid command (e.g. going directly upwards while moving downwards) it switches into the "ConfusedMode". When entering ConfusedMode the Snake loses one point and starts blinking and will not move.

How To

Implement your Snake behaviour in the "YourPlayer" class. You can see the "SamplePlayer" class to get an idea about how to start. Give your class a unique name - see the "getPlayerName" method to change your Snake's name. To get used to the movements of the Snakes you can use the arrow keys on your keyboard to control a special Snake which is generated when the Game is loaded.

Want to contribute?

See the contribution guide. Active Contributors can also join our BrainySnake Slack Channel.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 99.9%
  • Batchfile 0.1%