public static void Main(string[] args) { Console.WriteLine("Welcome to Tic Tac Toe!"); Console.WriteLine("Chose a game option:"); Console.WriteLine("1)Human vs Human"); Console.WriteLine("2)Human vs Computer"); var gameMode = int.Parse(Console.ReadLine()); Console.WriteLine("Enter the piece you want to play. \"x\" or \"o\""); var pieceC = Console.ReadLine(); Player = pieceC.ToLower().Equals("x") ? PieceType.X : PieceType.O; Oponnent = (Player == PieceType.O) ? PieceType.X : PieceType.O; var lib = new TicTacToeLib(); if (gameMode == 1) { lib.HumanvsHuman(Player); return; } lib.HumanVsComputer(Player, AIDepth); Console.ReadLine(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); lib = new TicTacToeLib(); currentBoard = lib.CreateEmptyBoard(); SetContentView(Resource.Layout.activity_main); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); tile1 = FindViewById <AppCompatTextView>(Resource.Id.textView1); tile2 = FindViewById <AppCompatTextView>(Resource.Id.textView2); tile3 = FindViewById <AppCompatTextView>(Resource.Id.textView3); tile4 = FindViewById <AppCompatTextView>(Resource.Id.textView4); tile5 = FindViewById <AppCompatTextView>(Resource.Id.textView5); tile6 = FindViewById <AppCompatTextView>(Resource.Id.textView6); tile7 = FindViewById <AppCompatTextView>(Resource.Id.textView7); tile8 = FindViewById <AppCompatTextView>(Resource.Id.textView8); tile9 = FindViewById <AppCompatTextView>(Resource.Id.textView9); tile1.SetOnTouchListener(this); tile2.SetOnTouchListener(this); tile3.SetOnTouchListener(this); tile4.SetOnTouchListener(this); tile5.SetOnTouchListener(this); tile6.SetOnTouchListener(this); tile7.SetOnTouchListener(this); tile8.SetOnTouchListener(this); tile9.SetOnTouchListener(this); FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += FabOnClick; reset_puzzle(); }