Skip to content

An engine/API for programming (and battling) Snake bots in Java!

Notifications You must be signed in to change notification settings

machalvan/AAAH-SNAYKUU

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

    <SNAYKUU>
    <An engine/API for programming Snake bots and pitting them against each other>
    Copyright (C) <2011>  <Arian Jafari, Sixten Hilborn, Erik Thuning>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    To view a copy of the GNU General Public License, see 
    <http://www.gnu.org/licenses/>.
    
---------------------------------------------------------------------------

## SNAYKUU THE MANUAL: THIS TIME IT'S PERSONAL
# Version 0.2

# TABLE OF CONTENTS 

[1.0] GETTING STARTED
    [1.1] Compiling the source
    [1.2] Compiling your bots
    [1.3] Programming your bot
[2.0] USING THE APPLICATION
    [2.1] Starting SNAYKUU
    [2.2] The main menu
    [2.3] The 'Game settings' tab
    [2.4] Replays
    [2.5] Developer mode
[3.0] IN- AND POST-GAME
    [3.1] The game board
    [3.2] The score board
    [3.3] The post-game window
[4.0] CREDITS


---------------------------------------------------------------------------


[1.0] GETTING STARTED:

    [1.1] Compiling the source
    (NOTE - This step is only for those who are interested in modifying 
    the source code. The program can be run by simply double-clicking
    the 'snaykuu.jar' file)

    If you have ant installed:
        Using your terminal, navigate to the 'snaykuu' folder
        and run the command 'ant jar'. This compiles the code
        be executed either by double-clicking it or running
        and creates an executable jar file, which can then
        'ant run'.

    [1.2] Compiling your bots
    If you don't have ant installed:
        Navigate to the directory where your snaykuu.jar is located, 
        and then run this command:
        > javac bot/*.java -cp snaykuu.jar

    If you have ant installed:
        Using your terminal, navigate to the 'snaykuu' folder
        and type 'ant bot'. Your bots are now compiled.
        
    [1.3] Programming your bot
    The essence of writing a SNAYKUU bot is simple. Your bot is a java class 
    implementing the interface Brain, requiring a single method called 
    getNextMove. This method will be called once each tick of the game, and is 
    basically where you calculate in which direction you want your snake to 
    move next. Each tick you are given a GameState object, which is a detailed 
    representation of the current state of the game, also containing several 
    useful methods to assist you in the coding process. 
    
        Much more detailed information can be found in the API 
        in the doc/ subfolder.


[2.0] USING THE APPLICATION:

    [2.1] Starting SNAYKUU
    Start the program by either double-clicking 'snaykuu.jar', navigating to the 
    snaykuu directory and running 'java -jar snaykuu.jar' in a terminal, or by 
    running the 'ant run' command if you have ant installed.

    [2.2] The main menu
    When you first start SNAYKUU, you will see two lists in the middle of the 
    screen; 'Snakes in game' and 'Available snakes'. 'Available snakes' contains 
    a list of all the compiled classes implementing the 'Brain' interface. By 
    double clicking the name of a bot in the 'Available snakes' list, you can 
    add/remove it to the game. When you want to start the game, press the 
    'Start' button.

    [2.3] The 'Game settings' tab
    In the 'Game settings' tab you can manually select which settings you want
    to play with. These are your options:
        Board width     The width of the game board, in squares.
        Board height     The height of the game board, in squares.
        Pixels per square 
                The size of each square, in pixels.
        Fruit to win
                The number of fruits each snake has to eat in order to win 
                the game.
        Ticks between fruits
                The frequency with which new fruits appear on the game board. 
                '5' means that a new fruit spawns every five ticks.
        Ticks per unit of snayk growth
                The frequency with which snakes grow. '5' means that snakes grow 
                every five ticks.
        Thinking time (ms/frame)
                The amount of time (in ms) each brain has to decide on its 
                next move.
        Game speed (ms/frame)
                The amount of time (in ms) that will elapse between each 'tick'. 
                Decrease to make the game appear to move faster, and vice versa.
                NOTE: It is recommended that this is set to at least thrice the 
                value of 'Thinking time'.
    
    [2.4] Replays
    After a game has been played, you are given the option to save a replay
    of the game at hand to be able to view later. If you want to view a saved
    replay, simply click Replay tab, click the "Load an old replay and play it!"
    button, and use the built in file browser to find your .srp replay file.
    Note that replays saved in older versions may not be compatible wth your
    current version.

    [2.5] Developer mode
    In the developer mode, you can run any number of 'simulated' games much 
    faster than running them individually with graphics. To use dev mode, begin 
    by selecting the participating snakes in the snake selection screen. Then,
    navigate to the 'developer' tab, select the number of games you want to be
    simulated, and then click 'Run test games'. The program will freeze for a 
    while while the simulations are running. When it is done, a menu will pop up 
    containing statistics and data from the simulations.


[3.0] IN- AND POST-GAME:

    [3.1] The game board
    This screen is fairly straight-forward. The snakes show up on the screen, 
    ready to rumble! Fruit objects will occasionally show up on the board, and it 
    is up to the snakes to reach them and devour them.

    [3.2] The score board
    On the right hand side of the game board is a live-updated score board of 
    the current round. Snakes are shown, identified by name and color, together 
    with the number of fruits they have eaten and the number of turns they 
    have survived.

    [3.3] The post-game window
    After a game has finished, a new window displaying the results of the game 
    will pop up, together with some options. The score board will be nearly 
    identical to the one that is shown during the game, showing the scores of all 
    the snakes as well as their placement in the round. Together with this, four 
    buttons will appear; 'New game', 'Rematch', 'Save replay' and 'Exit'. This is 
    what they do:
        New game      Brings you to the original snake selection menu.
        Rematch       Immediately starts a new round using the same snakes 
                        and game settings.
        Save replay   Allows you to save a replay of this game. See [2.4].
        Exit          Exits the application.

[4.0] CREDITS:
    
    Sixten Hilborn    Project co-manager, Lead coder, Whiteboard wizard.
    Arian Jafari      Project co-manager, Lead coder, Documentation dork,
                        Executive credits producer.
    Erik Thuning      Coder, Tester, Graphics guru, Affine transformer.
    Fredrik Norberg   Tester, Master fruit devourer.
    Esbjörn Olsson    Tester, Internet aficionado, Security ninja.

About

An engine/API for programming (and battling) Snake bots in Java!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%