Пример #1
0
        private bool checkIfRowWin()
        {
            short counter         = 0;
            bool  isWin           = false;
            eChip currentChipType = m_CurrentPlayer.TypeOfChip;

            for (int j = 0; j < m_GameState.Cols; j++)
            {
                if (currentChipType == m_Board[m_RowCurrentLocation, j])
                {
                    counter++;
                    if (counter == 4)
                    {
                        isWin = true;
                        break;
                    }
                }
                else
                {
                    counter = 0;
                }
            }

            return(isWin);
        }
Пример #2
0
        private bool checkDiagonal(int i_RowStartDiagonal, int i_ColStartDiagonal, int i_addedValue)
        {
            eChip currentChipType = m_CurrentPlayer.TypeOfChip;
            short counter         = 0;
            bool  isWin           = false;

            while ((i_RowStartDiagonal < m_GameState.Rows) && (i_ColStartDiagonal < m_GameState.Cols) && (i_RowStartDiagonal >= 0) && (i_ColStartDiagonal >= 0))
            {
                if (m_Board[i_RowStartDiagonal, i_ColStartDiagonal] == currentChipType)
                {
                    counter++;
                    if (counter == 4)
                    {
                        isWin = true;
                        break;
                    }
                }
                else
                {
                    counter = 0;
                }

                i_RowStartDiagonal += i_addedValue;
                i_ColStartDiagonal++;
            }

            return(isWin);
        }
Пример #3
0
        private bool checkIfColumnWin(short i_ChosenCol)
        {
            short counter         = 0;
            bool  isWin           = false;
            eChip currentChipType = m_CurrentPlayer.TypeOfChip;

            for (int i = 0; i < m_GameState.Rows; i++)
            {
                if (currentChipType == m_Board[i, i_ChosenCol])
                {
                    counter++;
                    if (counter == 4)
                    {
                        isWin = true;
                        break;
                    }
                }
                else
                {
                    counter = 0;
                }
            }

            return(isWin);
        }
Пример #4
0
 public ChipUI(Bitmap i_ChipPic)
 {
     this.BackColor             = Color.Transparent;
     this.BackgroundImage       = i_ChipPic;
     this.BackgroundImageLayout = ImageLayout.Stretch;
     this.Size  = new Size(30, 30);
     m_ChipType = eChip.empty;
 }
Пример #5
0
 public Player(string i_PlayerName, eChip i_TypeOfChip)
 {
     m_PlayerName = i_PlayerName;
     m_Points     = 0;
     m_TypeOfChip = i_TypeOfChip;
 }