📄 itictactoe.cs
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -