itictactoe.cs

来自「这是一个关于MFC的题目」· CS 代码 · 共 96 行

CS
96
字号
using System;

namespace TicTacToe
{

  public enum CellState
  {
    Empty,
    Cross,
    Circle
  }

  public enum Level
  {
    Easy,
    Hard
  }

  interface ITicTacToe
  {
    /// <summary>
    /// Start a new game
    /// </summary>
    void NewGame();

    /// <summary>
    /// Set difficulty level of computer opponent games
    /// </summary>
    /// <param name="level">Difficulty level</param>
    void SetLevel(Level level);

    /// <summary>
    /// Is game over?
    /// </summary>
    /// <returns>True if game is over</returns>
    bool IsGameOver();

    CellState GetWinner();

    /// <summary>
    /// Is it cross' turn?
    /// </summary>
    /// <returns>True if it is cross' turn</returns>
    bool IsCrossesTurn();

    /// <summary>
    /// Is cell empty?
    /// </summary>
    /// <param name="index">Zero-based cell index</param>
    /// <returns>True if cell is empty</returns>
    bool IsCellEmpty(int index);

    /// <summary>
    /// Get cell state
    /// </summary>
    /// <param name="index">Zero-based cell index</param>
    /// <returns></returns>
    CellState GetCellState(int index);

    /// <summary>
    /// Occupy cell by placing a symbol in the cell
    /// </summary>
    /// <param name="index">Zero-based cell index</param>
    void OccupyCell(int index);

    /// <summary>
    /// Make a computer generated move
    /// </summary>
    void MakeComputerMove();

    /// <summary>
    /// Columns property
    /// </summary>
    int Columns
    {
      get;
    }

    /// <summary>
    /// Rows property
    /// </summary>
    int Rows
    {
      get;
    }

    /// <summary>
    /// Cells property
    /// </summary>
    int Cells
    {
      get;
    }
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?