예제 #1
0
        private bool makeAStrike(Cell i_ToMark, Line.eDirection i_Direction)
        {
            bool makeAStrike = true;

            switch (i_Direction)
            {
            case Line.eDirection.Row:
                makeAStrike = haveAstrike(Line.eDirection.Col, i_ToMark.Col);
                break;

            case Line.eDirection.Col:
                makeAStrike = haveAstrike(Line.eDirection.Row, i_ToMark.Row);
                break;

            case Line.eDirection.SecondaryDiagonal:
                makeAStrike = strikeSearch(i_ToMark);
                break;

            case Line.eDirection.MainDiagonal:
                makeAStrike = strikeSearch(i_ToMark);
                break;
            }

            if (i_ToMark.Col == i_ToMark.Row && !makeAStrike)
            {
                makeAStrike = haveAstrike(Line.eDirection.MainDiagonal, 0);
            }

            if (i_ToMark.Col == m_BoardLength - i_ToMark.Row - 1 && !makeAStrike)
            {
                makeAStrike = haveAstrike(Line.eDirection.SecondaryDiagonal, m_BoardLength - 1);
            }

            return(makeAStrike);
        }
예제 #2
0
        private bool computerStrikeByDirection(Line.eDirection i_DirectionToLook, int i_index)
        {
            bool computerStrike = false;

            foreach (Line line in m_AllLines)
            {
                if (line.Direction == i_DirectionToLook && line.Index == i_index)
                {
                    if (line.OneCellFromAstrike() && this.myOwnership(line.Woner))
                    {
                        computerStrike = true;
                    }

                    break;
                }
            }

            return(computerStrike);
        }
예제 #3
0
        private bool haveAstrike(Line.eDirection i_DirectionToLook, int i_index)
        {
            bool strike = false;

            foreach (Line line in m_AllLines)
            {
                if (line.Direction == i_DirectionToLook && line.Index == i_index)
                {
                    if (line.OneCellFromAstrike())
                    {
                        strike = true;
                    }

                    break;
                }
            }

            return(strike);
        }