Expand description
§Quick Start
Initialize with new
and use turn
to progress a game step. An example is in game.rs.
Game without display
use snake::{Snake, Direction};
let mut game = Snake::new(0, 10);
game.turn(Direction::Down);
You can use the display
feature flag to have a window displaying the game. This requires
csfml to be installed.
Game with display
ⓘ
use snake::{Direction, RenderWindow, Snake, Style};
let window = RenderWindow::new((1000, 1000), "Snake", Style::CLOSE, &Default::default());
let mut game = Snake::new_display(0, 15, Some(window));
§Installing CSFML
Arch:
sudo pacman -Syu csfml
Ubuntu:
sudo apt-get install libcsfml
Structs§
- Snake
- Instance of game Snake containing board state, rng, and display
Enums§
- Direction
- Choice for direction on board