public CheckMovesResult CheckRules(string diceRoll) { PlayerColors playerColor = PlayerColors.red; if (diceRoll.Contains("r")) { playerColor = PlayerColors.red; } if (diceRoll.Contains("y")) { playerColor = PlayerColors.yellow; } if (diceRoll.Contains("b")) { playerColor = PlayerColors.black; } if (diceRoll.Contains("g")) { playerColor = PlayerColors.green; } var diceValue = Convert.ToInt32(diceRoll.Substring(1, 1)); return(_gameboard.CheckPossiblePlayerMoves(playerColor, diceValue)); }
public void default_game_board_moves_player_to_start_on_dice_6() { // on a default game board with 4 players the red player rolls a 6 int diceValue = 6; var result = _gameboard.CheckPossiblePlayerMoves(PlayerColors.red, diceValue); Assert.AreEqual(true, result.CanMove); Assert.AreEqual(true, result.AdditionalThrowGranted); // do the move and test _gameboard.Move(result.PossibleMoves[0], diceValue); Assert.AreEqual(true, nvp_RuleHelper.IsFieldOccupiedByOwnFigure(PlayerColors.red, _gameboard.playerFigures, 0)); }
void OnPlayerDiceRoll(PlayerDiceRoll diceRoll) { _lastCalculatedMoveResult = _gameLogic.CheckPossiblePlayerMoves( diceRoll.playerColor, diceRoll.diceValue ); // invoke event OnPlayerMovesCalculated(_lastCalculatedMoveResult); }