C# Class ReversiEight.ViewModel.GameBoardViewModel

A view model that encapsulates the logic of the game of Reversi
Inheritance: ViewModelBase
Exibir arquivo Open project: ColinEberhardt/ReversiEight Class Usage Examples

Public Methods

Method Description
GameBoardViewModel ( GameBoardViewModel copy ) : System
IsValidMove ( int row, int col ) : bool

Determines whether the given move is valid for the next turn

IsValidMove ( int row, int col, BoardSquareState state ) : bool

Determines whether the given move is valid

MakeMove ( int row, int col ) : void

Makes the given move for the current player. Score are updated and play then moves to the next player.

Private Methods

Method Description
CanPlayerMakeAMove ( BoardSquareState state ) : bool

Determines whether there are any valid moves that the given player can make.

FlipOpponentsCounters ( int row, int column, BoardSquareState state ) : void

Flips all the opponents pieces that are surrounded by the given move.

GameBoardViewModel ( ) : System
GetSquare ( int row, int col ) : GameBoardSquareViewModel
HasGameFinished ( ) : bool
InitialiseGame ( ) : void

Sets up the view model to the initial game state.

InvertState ( BoardSquareState state ) : BoardSquareState
MoveSurroundsCounters ( int row, int column, NavigationFunction navigationFunction, BoardSquareState state ) : bool

Determines whether the given move 'surrounds' any of the opponents pieces.

NavigateBoard ( NavigationFunction navigationFunction, int row, int column ) : IEnumerable

A list of board squares that are yielded via the given navigation function.

Method Details

GameBoardViewModel() public method

public GameBoardViewModel ( GameBoardViewModel copy ) : System
copy GameBoardViewModel
return System

IsValidMove() public method

Determines whether the given move is valid for the next turn
public IsValidMove ( int row, int col ) : bool
row int
col int
return bool

IsValidMove() public method

Determines whether the given move is valid
public IsValidMove ( int row, int col, BoardSquareState state ) : bool
row int
col int
state BoardSquareState
return bool

MakeMove() public method

Makes the given move for the current player. Score are updated and play then moves to the next player.
public MakeMove ( int row, int col ) : void
row int
col int
return void