public void NextTurn(GameCell cell) { if (cell == null) throw new ArgumentNullException("cell"); if (cell.Owner == Player.NonPlayer) { GameManager.NextTurn(cell.Location.X, cell.Location.Y); UpdateGameStatus(GameManager); } CheckIsGameOver(); }
private static Int32 CalculatePoint(GameCell cell, Player[] players) { if (cell.Owner == players[0]) { return(1); } if (cell.Owner == players[1]) { return(-1); } return(0); }
public GameCellViewModel(GameTableViewModel gameTableViewModel, IGameManager gameManager, GameCell gameCell) { if (gameManager == null) throw new ArgumentNullException("gameManager"); if (gameCell == null) throw new ArgumentNullException("gameCell"); if (gameTableViewModel == null) throw new ArgumentNullException("gameTableViewModel"); GameTableViewModel = gameTableViewModel; GameManager = gameManager; GameCell = gameCell; Symbol = GetSymbol(GameManager, GameCell); InitializeCommands(); }
private String GetSymbol(IGameManager gameManager, GameCell gameCell) { if (gameCell.Owner == Player.NonPlayer) { return ""; } if (gameCell.Owner == gameManager.Players.First()) { return "X"; } return "O"; }
private static Int32 CalculatePoint(GameCell cell, Player[] players) { if (cell.Owner == players[0]) return 1; if (cell.Owner == players[1]) return -1; return 0; }