SnakeGame class
Constructors
- SnakeGame({required SnakeGameRenderer renderer, required int boardWidth, required int boardHeight, required int initialSnakeX, required int initialSnakeY, required SnakeDirection initialSnakeDirection, required int initialSnakeSize, required int maxTicksBeforeFood, int minTicksBeforeFood = 0, bool startWithFood = true})
Properties
- completed → bool
-
True if the game has completed.
no setter
- directionLastTick → SnakeDirection?
-
no setter
- directionNextTick ← SnakeDirection
-
no getter
-
gameFuture
→ Future<
void> -
A future that competes when the game ends.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxTicksBeforeFood → int
-
The maximum number of ticks since the last food was eaten that are
required for new food to appear.
final
- minTicksBeforeFood → int
-
The minimum number of ticks since the last food was eaten that are
required for new food to appear.
final
- renderer ↔ SnakeGameRenderer
-
Called when the board should be rendered.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- score → int
-
The game score (the size of the snake).
no setter
-
snake
→ Iterable<
Point< int> > -
Points that make up a snake.
no setter
Methods
-
getBoardWithoutSnake(
) → List< List< SnakeItem> > - A snapshot of the current board, without the snake.
-
getBoardWithSnake(
) → List< List< SnakeItem> > - A snapshot of the current board, with the snake.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
tick(
) → void -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited