Exemple #1
0
 public void Init()
 {
     board = new OthelloBoard();
     player1 = new Player("Emily", "black");
     player2 = new Player("Berry", "white");
     game = new Game(board, player1, player2);
 }
Exemple #2
0
 private void buttonRetry_Click(object sender, EventArgs e)
 {
     if (GameType == Type.Game)
     {
         game            = new Game();
         dataGridView1   = ClassLibrary.PlateAndDGV.ConvertPlateToDGV(dataGridView1, game);
         labelWrite.Text = Convert.ToString(game.Score);
     }
 }
Exemple #3
0
        public ActionResult StartGame(string playerOneName, string playerTwoName)
        {
            var gameBoard = new OthelloBoard();
            var playerOne = new Player(playerOneName, "black");
            var playerTwo = new Player(playerTwoName, "white");
            var newGame = new Game(gameBoard, playerOne, playerTwo);

            var gameModel = new GameModel
            {
                Board = gameBoard,
                Player1 = playerOne,
                Player2 = playerTwo,
                Game = newGame
            };
            Session["currentGame"] = gameModel;
            return View(gameModel);
        }
Exemple #4
0
            GameResults GetWinner(IEnumerable<Spell> spells)
            {
                var game = new Game(new Player(_playername, _playerhitpoints, _playermana), new Boss(_bossname, _bosshitpoints, _bossdamage), _hard);

                game.Simulate(spells);

                if (game.Winner.HasValue)
                    return (game.Winner.Value == Players.Player) ? GameResults.PlayerWins : GameResults.BossWins;
                else
                    return GameResults.Incomplete;
            }