C# Класс ReversiEight.ViewModel.GameBoardViewModel

A view model that encapsulates the logic of the game of Reversi
Наследование: ViewModelBase
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

GameBoardViewModel() публичный Метод

public GameBoardViewModel ( GameBoardViewModel copy ) : System
copy GameBoardViewModel
Результат System

IsValidMove() публичный Метод

Determines whether the given move is valid for the next turn
public IsValidMove ( int row, int col ) : bool
row int
col int
Результат bool

IsValidMove() публичный Метод

Determines whether the given move is valid
public IsValidMove ( int row, int col, BoardSquareState state ) : bool
row int
col int
state BoardSquareState
Результат bool

MakeMove() публичный Метод

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
Результат void