using System;

 

namespace TicTacToe1 {

    class App {

        const int blank = 0;

        const int XValue = 1;

        const int OValue = 2;

 

        static private int[,] WinningCombos = new int[,] {

             {0,1,2},

             {3,4,5},

             {6,7,8},

             {0,3,6},

             {1,4,7},

             {2,5,8},

             {0,4,8},

             {2,4,6}

        };

 

        static bool DidXWin(int[] board) {

            bool itsOver = true;

 

            for(int combo = 0; combo <= WinningCombos.GetUpperBound(0); combo++) {

                itsOver = true;

                for(int comboIndex = 0; comboIndex < 3; comboIndex++) {

                    int comboValue = WinningCombos[combo, comboIndex];

                    if(board[comboValue] != XValue) {

                        itsOver = false;

                        break;

                    }

                }

                if(itsOver)

                    break;

            }

            return itsOver;

        }

 

        [STAThread]

        static void Main(string[] args) {

            int[] board = new int[9];

 

            //set winning value

            board[0] = XValue;

            board[4] = XValue;

            board[7] = XValue;

                 

            bool xWon = DidXWin(board);

            Console.WriteLine("X Won? = {0}", xWon);

        }

    }

}