Skip to main content

Crate parking_game

Crate parking_game 

Source
Expand description

parking-game: a library recreating the rules of Thinkfun’s “Rush Hour”.

This library implements the core movement rules of “Rush Hour”, with a focus on memory and performance. The premise of the game is simple: you have one to many “cars” with fixed orientations (up/down or left/right) that can only move forwards and backwards in that orientation. You must move the designated car from its given start position to a desired end position by manipulating the other cars in the board. Cars may not intersect and they must stay within the bounds of the board. In this library, we only implement the movement rules (intersection and bounds checks included); the gameplay is left to the user.

Structs§

Board
A concretised representation of the board.
Car
A car, generic over the numeric type which backs it. The numeric type must be unsigned and integral.
DimensionError
An error associated with the creation of the dimensions.
Dimensions
The dimensions of a parking game board in terms of rows and columns.
InvalidMoveError
An error which describes an attempted invalid move.
InvalidStateError
An error which denotes that an invalid state was encountered.
Position
A position in the board (eff., a coordinate pair).
State
A state of the game. This is guaranteed to be a valid state as long as it is constructed with State::empty and manipulated with via Board operations.

Enums§

Direction
A direction for a move. A direction may be flipped with Neg (i.e. -).
InvalidMoveType
The type of invalid move that was observed in an InvalidMoveError.
InvalidStateType
A type of invalid state, associated with an InvalidStateError.
Orientation
An orientation for a car.

Traits§

BoardValue
Marker trait: specifies that a value may be used for board definitions.