public static (string, string) Run() { var firstDice = _firstDice.Throw(_random.Next(_firstDice.Faces)); var secondDice = _secondDice.Throw(_random.Next(_secondDice.Faces)); return(firstDice, secondDice); }
public static void Main() { Console.WriteLine("Terningen kastes indtil den viser 6 øjne"); var eye = 0; do { eye = Dice.Throw(); Console.WriteLine($"Terningens øjne viser: {eye}"); } while (eye != 6); }
internal void SetupPlayersPositions(IDice dice) { while (true) { var valuePlayer1 = dice.Throw(); var valuePlayer2 = dice.Throw(); if (valuePlayer1 > valuePlayer2) { FirstPlayer = _player1; SecondPlayer = _player2; AssignMarks(); break; } else if (valuePlayer1 < valuePlayer2) { FirstPlayer = _player2; SecondPlayer = _player1; AssignMarks(); break; } } }
public void GameLoop() { _turn++; foreach (IPlayer player in Players) { List <int> dices = _dice.Throw(); int amountOfDices = dices.Sum(); MessageBox.Show(amountOfDices.ToString()); player.AmountOfDice = amountOfDices; // TODO: Turn per player if (_turn == 1) { FirstTurnThrow(player, dices, amountOfDices); break; } if (player.TurnsToStayStill != 0) { player.TurnsToStayStill--; } else { if (player.Position + amountOfDices > 63 && !player.IsInReverse) { _squareToMoveTo = 63 - ((player.Position + amountOfDices) % 63); } else { _squareToMoveTo = player.Position + amountOfDices; } ISquare square = GetSquare(_squareToMoveTo); MovePlayer(player, amountOfDices, square); //int squareToMoveTo = player.Position + amountOfDices; //ISquare square = GetSquare(squareToMoveTo); //MovePlayer(player, amountOfDices, square); } if (player.PlayerWon) { _gameOver = true; MessageBox.Show("You have won!"); } //Update the screen here for next player } }