示例#1
0
        private static void oneTurn(ref Board i_GameBoard, ref Player i_Player, ref bool v_Win, ref List <CharLocation> i_Memory)
        {
            int scoreBefore = i_Player.score;

            char[] firstChoice  = new char[2];
            char[] secondChoice = new char[2];
            int[]  tempLocation = new int[2];
            bool   foundCouple  = !true;

            DrawBoard.DrawTheBoard(i_GameBoard);
            GameMeseges.BeReady(i_Player.name);
            GameMeseges.QtoExitMessege();
            if (i_Player.isHuman)
            {
                firstChoice = inputCell(ref i_GameBoard);
                round(ref i_GameBoard, ref firstChoice);
                GameMeseges.QtoExitMessege();
                secondChoice = inputCell(ref i_GameBoard);
                round(ref i_GameBoard, ref secondChoice);
            }
            else
            {
                tempLocation   = pcRandomMove(ref i_GameBoard, ref i_Player);
                firstChoice[0] = (char)tempLocation[0];
                firstChoice[1] = (char)tempLocation[1];
                CharLocation firstPc = new CharLocation(firstChoice, i_GameBoard.GameBoard[firstChoice[1], firstChoice[0]]);
                i_Memory.Add(firstPc);
                GameMeseges.QtoExitMessege();
                System.Threading.Thread.Sleep(2000);
                smartmove(ref i_GameBoard, ref i_Memory, ref firstPc, ref foundCouple, ref secondChoice);
                if (!foundCouple)
                {
                    tempLocation    = pcRandomMove(ref i_GameBoard, ref i_Player);
                    secondChoice[0] = (char)tempLocation[0];
                    secondChoice[1] = (char)tempLocation[1];
                }
                System.Threading.Thread.Sleep(2000);
            }
            Logic.compare(ref firstChoice, ref secondChoice, ref i_GameBoard, ref i_Player);

            if (i_Player.score > scoreBefore)
            {
                v_Win = true;
            }
            else
            {
                v_Win = false;
            }
        }
示例#2
0
 public static void smartmove(ref Board i_GameBoard, ref List <CharLocation> i_Memory, ref CharLocation i_FirstPc, ref bool i_FoundCouple, ref char[] i_SecondChoice)
 {
     foreach (CharLocation listArgu in i_Memory)
     {
         if (listArgu.Value == i_FirstPc.Value && listArgu.Location != i_FirstPc.Location)
         {
             if (i_GameBoard.GameBoardFlag[listArgu.Location[1], listArgu.Location[0]] == 0)
             {
                 i_SecondChoice = listArgu.Location;
                 i_FoundCouple  = true;
                 i_Memory.Remove(listArgu);
                 break;
             }
         }
     }
 }