tic_tac_toe_game 1.0.0 copy "tic_tac_toe_game: ^1.0.0" to clipboard
tic_tac_toe_game: ^1.0.0 copied to clipboard

Game logic for the game Tic Tac Toe. Can be used to create a Tic Tac Toe game.

Game logic for the game Tic Tac Toe.

Usage #

Simply create a new instance of TicTacToeGameState and call the claimField function to play the game.

final gameState = TicTacToeGameState();

// Use .fields to get the state of the fields.
// You can use this to draw the UI for example.
final fields = gameState.fields;
// Use .status to get the current status of the game.
// You can use this to show the players who's turn it is or who has won the game.
final status = gameState.status;

// Use .claimField to let the current player claim a field. The result is a new instance.
final newState = gameState.claimField(4);

Additional information #

This package/repository is the result of an article about Test Driven Development.

3
likes
160
points
27
downloads

Publisher

verified publisherveenstra.dev

Weekly Downloads

Game logic for the game Tic Tac Toe. Can be used to create a Tic Tac Toe game.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

equatable, meta

More

Packages that depend on tic_tac_toe_game