Ejemplo n.º 1
0
        private void panel1_MouseClick(object sender, MouseEventArgs e)
        {
            if (!gameStarted)
            {
                MessageBox.Show("Choose colors first!");
                return;
            }
            if (flipManual)
            {
                int status = game.flipManual(e.Location);
                if (status == -1)
                {
                    return;
                }
                updateScoreboard(blackPlayer.getScore(), whitePlayer.getScore());
            }
            {
                int status = game.tryToPlace(e.Location, blackTurn);
                if (status == -1)
                {
                    return;
                }
                if (status == 0)
                {
                    MessageBox.Show("Illegal move!");
                    return;
                }

                updateScoreboard(blackPlayer.getScore(), whitePlayer.getScore());
                blackTurn = !blackTurn; //will have to move
                setTurn();
                if (hintOn)
                {
                    game.hint(blackTurn);
                }
                if (blackPlayer.getScore() + whitePlayer.getScore() >= 63)
                {
                    hintToolStripMenuItem_Click(sender, e);
                    hintToolStripMenuItem_Click(sender, e);
                }
            }
        }