public FourInARow()
        {
            gameRules = new GameRules(this);

            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < 6; j++)
                {
                    twoDimensionalArray[i, j] = "|   |";
                }
            }

            //Intro();

            players.Add(new Player("| B |", "Daniel", this));
            players.Add(new Player("| R |", "Thomas", this));
            currentPlayer = players.First();
            drawBoard();

            while (!gameOver)
            {
                Console.WriteLine("Hvor vil " + currentPlayer.navn + " sætte sin brik");
                position = Convert.ToInt32(Console.ReadLine());

                for (int i = 5; i >= 0; i--)
                {
                    if (twoDimensionalArray[i, position - 1] != players[0].brik && twoDimensionalArray[i, position - 1] != players[1].brik)
                    {
                        twoDimensionalArray[i, position - 1] = currentPlayer.brik;
                        break;
                    }
                }
                Console.Clear();
                gameRules.CheckRow();
                drawBoard();

                nextPlayer();
            }
        }
示例#2
0
 public FourInARow()
 {
     checkers  = new Checkers(this);
     players   = new Player(this);
     gamerules = new GameRules(this);
     checkers.Start();
     while (gameover != true)
     {
         Console.WriteLine(" 1  2  3  4  5  6 ");
         Console.WriteLine("+----------------+");
         Console.Write(checkers);
         Console.WriteLine("+----------------+");
         players.Play1();
         gamerules.VictoryCheck();
         Console.Clear();
         Console.WriteLine(" 1  2  3  4  5  6 ");
         Console.WriteLine("+----------------+");
         Console.Write(checkers);
         Console.WriteLine("+----------------+");
         players.Play2();
         gamerules.VictoryCheck();
         Console.Clear();
     }
 }