Example #1
0
 public GameLogic(Board board, PlayerCollector playerCollector, FlashingPlayerCoins flashingPlayerCoins)
 {
     PlayerCollector     = playerCollector;
     AllPlayer           = PlayerCollector.AllPlayer;
     Board               = board;
     FlashingPlayerCoins = flashingPlayerCoins;
 }
Example #2
0
        public void WinnTextInitialization(Player player)
        {
            for (int i = 0; i < 5; i++)
            {
                Console.Clear();
                Console.BackgroundColor = ConsoleColor.Red;
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.WriteLine("Spieler " + player.Name + " Sie haben gewonnen!!! YEAHH!!!");
                Thread.Sleep(300);
                Console.Clear();
                Console.BackgroundColor = ConsoleColor.Blue;
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Spieler " + player.Name + " Sie haben gewonnen!!! YEAHH!!!");
                Thread.Sleep(300);
                Console.Clear();
                Console.ResetColor();
            }

            if (PlayerCollector.RePlay() == false)
            {
                Environment.Exit(0);
            }
            else
            {
                ConnectFourGame.Play();
            }
        }
        public static void Play()
        {
            int                 width  = GetBoardSizeInts.GetBoardWidth();
            int                 height = GetBoardSizeInts.GetBoardHeight();
            Board               b      = new Board(height, width);
            BoardPrinter        bp     = new BoardPrinter(b);
            FlashingPlayerCoins fpc    = new FlashingPlayerCoins(bp);
            PlayerCollector     pc     = new PlayerCollector(bp);
            GameLogic           gl     = new GameLogic(b, pc, fpc);

            pc.Collect();
            bp.Print();
            gl.DoTurnsUntilWinn();
        }
Example #4
0
 public void DoTurnsUntilWinn()
 {
     do
     {
         foreach (Player player in PlayerCollector.AllPlayer)
         {
             PlayerCollector.PlayersTurn(player);
             if (HasPlayerWinn(player))
             {
                 WinnTextInitialization(player);
             }
         }
     }while (true);
 }