public bool IsValidMoves(int cube, Player.GameStatus status) { bool isValid; if (status == Player.GameStatus.Start) { isValid = IsValidMoveForStart(cube); } else if (status == Player.GameStatus.Out) { isValid = IsValidMoveForOut(cube); } else { isValid = IsValidMoveForFinish(cube); } return isValid; }
public string StartGame() { cubes.RollCube(); while(cubes.FirstCube == cubes.SecondCube) { cubes.RollCube(); } if(cubes.FirstCube > cubes.SecondCube) { currentPlayer = firstPlayer; } else { currentPlayer = secondPlayer; } return CurrentPlayer.Name; }
private void InitPlayers(GameMode gameMode, string firstPlayerName, string secondPlayerName) { if(gameMode == GameMode.Friend) { firstPlayer = new HumenPlayer(firstPlayerName, Color.Blue); secondPlayer = new HumenPlayer(secondPlayerName, Color.Red); } else if(gameMode == GameMode.Computer) { firstPlayer = new HumenPlayer(firstPlayerName, Color.Blue); secondPlayer = new ComputerPlayer("Computer", Color.Red); } else { firstPlayer = new ComputerPlayer("First Computer", Color.Blue); secondPlayer = new ComputerPlayer("Second Computer", Color.Red); } }
public void SwitchPlayer() { if(CurrentPlayer == firstPlayer) { currentPlayer = secondPlayer; } else { currentPlayer = firstPlayer; } }