public void StartTournament() { var NextGroup = new List <Player>(); while (Player.Count % 2 == 0) { Player firstPlayer; Player secondPlayer; for (int i = 0; i < Player.Count; i += 2) { firstPlayer = Player[i]; secondPlayer = Player[(i + 1)]; HandSign.ValidateRound(firstPlayer, secondPlayer); var winner = HandSign.GetWinner(firstPlayer, secondPlayer); NextGroup.Add(winner); } Player.Clear(); Player.AddRange(NextGroup); NextGroup.Clear(); } Console.WriteLine("**************************************************************************************************"); Console.WriteLine($"Congratulations {Player.First().Name}, you were the winner of the paper rock scissors tournament!!!!!"); }
void loadRotations(HandSign h) { //m_rotations[0].rotation = m_rotations[0].localRotation = Quaternion.RotateTowards(m_rotations[0].localRotation, h.wristRotation, speedTorque / 2f); //THUMB m_rotations[1].localRotation = Quaternion.RotateTowards(m_rotations[1].localRotation, h.thumbRotation.phalange1, speedTorque); m_rotations[2].localRotation = Quaternion.RotateTowards(m_rotations[2].localRotation, h.thumbRotation.phalange2, speedTorque); m_rotations[3].localRotation = Quaternion.RotateTowards(m_rotations[3].localRotation, h.thumbRotation.phalange3, speedTorque); //INDEX m_rotations[4].localRotation = Quaternion.RotateTowards(m_rotations[4].localRotation, h.indexRotation.phalange1, speedTorque); m_rotations[5].localRotation = Quaternion.RotateTowards(m_rotations[5].localRotation, h.indexRotation.phalange2, speedTorque); m_rotations[6].localRotation = Quaternion.RotateTowards(m_rotations[6].localRotation, h.indexRotation.phalange3, speedTorque); //MIDDLE m_rotations[7].localRotation = Quaternion.RotateTowards(m_rotations[7].localRotation, h.middleRotation.phalange1, speedTorque); m_rotations[8].localRotation = Quaternion.RotateTowards(m_rotations[8].localRotation, h.middleRotation.phalange2, speedTorque); m_rotations[9].localRotation = Quaternion.RotateTowards(m_rotations[9].localRotation, h.middleRotation.phalange3, speedTorque); //RING m_rotations[10].localRotation = Quaternion.RotateTowards(m_rotations[10].localRotation, h.ringRotation.phalange1, speedTorque); m_rotations[11].localRotation = Quaternion.RotateTowards(m_rotations[11].localRotation, h.ringRotation.phalange2, speedTorque); m_rotations[12].localRotation = Quaternion.RotateTowards(m_rotations[12].localRotation, h.ringRotation.phalange3, speedTorque); //PINKY m_rotations[13].localRotation = Quaternion.RotateTowards(m_rotations[13].localRotation, h.pinkyRotation.phalange1, speedTorque); m_rotations[14].localRotation = Quaternion.RotateTowards(m_rotations[14].localRotation, h.pinkyRotation.phalange2, speedTorque); m_rotations[15].localRotation = Quaternion.RotateTowards(m_rotations[15].localRotation, h.pinkyRotation.phalange3, speedTorque); }
public void MapStringToMove_Wrong_Choice() { //Act var result = HandSign.MapStringToMove("k"); //Assert Assert.IsNull(result); }
public void MapStringToMove_Scissor_Choice() { //Assign var expectedResult = new HandSign(HandSign.Move.Scissors); //Act var result = HandSign.MapStringToMove("S"); //Assert Assert.AreEqual(expectedResult.ToString(), result.ToString()); }
public void GetWinnerTest_Draw_Pass() { //Assign Player player1 = new Player("Player1") { HandSign = new HandSign(HandSign.Move.Rock) }; Player player2 = new Player("Player2") { HandSign = new HandSign(HandSign.Move.Rock) }; var expectedResult = "Draw"; //Act var result = HandSign.GetWinner(player1, player2); //Assert Assert.AreSame(expectedResult, result); }
public void GetWinnerTest_Player1_Pass() { //Assign Player player1 = new Player("Player1") { HandSign = new HandSign(HandSign.Move.Scissors) }; Player player2 = new Player("Player2") { HandSign = new HandSign(HandSign.Move.Paper) }; var expectedResult = "Player1"; //Act var result = HandSign.GetWinner(player1, player2); //Assert Assert.AreSame(expectedResult, result); }
void saveRotationsIn(HandSign h) { h.wristRotation = m_rotations[0].localRotation; //THUMB h.thumbRotation.phalange1 = m_rotations[1].localRotation; h.thumbRotation.phalange2 = m_rotations[2].localRotation; h.thumbRotation.phalange3 = m_rotations[3].localRotation; //INDEX h.indexRotation.phalange1 = m_rotations[4].localRotation; h.indexRotation.phalange2 = m_rotations[5].localRotation; h.indexRotation.phalange3 = m_rotations[6].localRotation; //MIDDLE h.middleRotation.phalange1 = m_rotations[7].localRotation; h.middleRotation.phalange2 = m_rotations[8].localRotation; h.middleRotation.phalange3 = m_rotations[9].localRotation; //RING h.ringRotation.phalange1 = m_rotations[10].localRotation; h.ringRotation.phalange2 = m_rotations[11].localRotation; h.ringRotation.phalange3 = m_rotations[12].localRotation; //PINKY h.pinkyRotation.phalange1 = m_rotations[13].localRotation; h.pinkyRotation.phalange2 = m_rotations[14].localRotation; h.pinkyRotation.phalange3 = m_rotations[15].localRotation; }
/// <summary> /// Set player hand sign /// </summary> /// <param name="name">Name of the player</param> /// <param name="hs">Internal representation of hand sign</param> public void SetPlayerHandTo(string name, HandSign hs) { GetPlayerByName(name).ShakeHandToHandSign(hs); }
public Player(string name, HandSign sign) { Name = name; HandSign = sign; }
public void Should_return_scissors_when_selected_paper() { var result = HandSign.GetWinningMove(HandSignEnum.Paper); Assert.Equal(HandSignEnum.Scissors, result); }
public void Should_return_stone_when_selected_scissors() { var result = HandSign.GetWinningMove(HandSignEnum.Scissors); Assert.Equal(HandSignEnum.Rock, result); }
public void Should_return_paper_when_selected_stone() { var result = HandSign.GetWinningMove(HandSignEnum.Rock); Assert.Equal(HandSignEnum.Paper, result); }
/// <summary> /// Set the hand sign by generating randomly /// </summary> public void ShakeHandRandom() { CurrentHand = (HandSign) new Random().Next(1, 4); }
/// <summary> /// Set the hand sign /// </summary> /// <param name="hs">Internal representation of hand sign</param> public void ShakeHandToHandSign(HandSign hs) { CurrentHand = hs; }
public void MapRandomToMove_Pass() { //Assert Assert.IsNotNull(HandSign.MapRandomToMove()); }