Пример #1
0
        //menentukan apakah game sudah diselesaikan atau belum
        //berguna untuk mode player agar lebih mudah, lebih memudahkan daripada harus mengeset matrix pada board
        public void isFinish()
        {
            count = 0;

            for (int iPosX = 100; iPosX < 100 + (board.getCols() * 25); iPosX += 25)
            {
                for (int iPosY = 50; iPosY < 50 + (board.getRows() * 25); iPosY += 25)
                {
                    if (board.getMatrix()[(iPosX - 100) / 25, (iPosY - 50) / 25] == 0)
                    {
                        for (int i = 0; i < 12; i++)
                        {
                            if (pentomino[i].atPos(iPosX, iPosY))
                            {
                                count++;
                                break;
                            }
                        }
                    }
                }
            }

            if (count >= 60)
            {
                player = false;
                TimerElapsed.Enabled = false;
                sp.Play();
                MessageBox.Show("You have finished the game !!", "PentoMaster", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }