TTT v0.2.0 TTT.Core.GameMaker View Source

The module is responsible for setting up players and putting together the essential pieces for the game to run.

Link to this section Summary

Link to this section Functions

## Parametrs

- players: Tuple of player structs which contains players'names, tokens and types.
- paddings: Tuple consists of left padding and right padding(whitespaces).
- longer_token: String of the longer token.

Assembles and returns a tuple of game components.

##Parameters

- name: String of player's name

Returns tuple of the result of the validation and the original payload.
Link to this function check_player_symbol(token) View Source

##Parameters

- name: String of player's token

Returns tuple of the result of the validation and the original payload.
Link to this function polish_tokens_and_paddings(players) View Source

##Parameters

- players: Tuple of player structs which contains player's name, token and type.

Reset player 2’s token if it’s identical to player 1’s. Determined and apply paddings for the shorter token. Generate paddings for the initial board when game starts.

Returns tuple of players with updated, unique tokens, paddings for both sides and the longer token.

Link to this function setup_player(player_name, player_token, player_type) View Source

##Parameters

- player_name: String of player's name
- player_token: String of player's token
- player_type: function to be called to create the player struct

Returns a player struct of the type passed in.