Cover Page by Eric Lippert, Mark Michaelis

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

B. Tic-Tac-Toe Source Code Listing

Listing B.1. Tic-Tac-Toe

#define CSHARP2using System;#pragma warning disable 1030 // Disable user-defined warnings// The TicTacToe class enables two players to// play tic-tac-toe.class TicTacToeGame      // Declares the TicTacToeGame class{  static void Main()  // Declares the entry point to the program  {      // Stores locations each player has moved.     int[] playerPositions = { 0, 0 };      // Initially set the currentPlayer to Player 1;     int currentPlayer = 1;      // Winning player     int winner = 0;     string input = null;      // Display the board and prompt the current player      // for his next move.     for (int turn = 1; turn <= 10; ++turn)     {         DisplayBoard(playerPositions);           ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required