コード例 #1
0
 public void PlacePiece(int space, Player.Piece piece)
 {
     if (IsSpaceFree(space))
     {
         _playingGrid[space] = piece;
     }
 }
コード例 #2
0
 private static bool HasPieceWon(Player.Piece[] boardState, Player.Piece piecetoCheck)
 {
     if (boardState[0] == piecetoCheck && boardState[1] == piecetoCheck && boardState[2] == piecetoCheck)
     {
         return(true);
     }
     if (boardState[3] == piecetoCheck && boardState[4] == piecetoCheck && boardState[5] == piecetoCheck)
     {
         return(true);
     }
     if (boardState[6] == piecetoCheck && boardState[7] == piecetoCheck && boardState[8] == piecetoCheck)
     {
         return(true);
     }
     if (boardState[0] == piecetoCheck && boardState[3] == piecetoCheck && boardState[6] == piecetoCheck)
     {
         return(true);
     }
     if (boardState[0] == piecetoCheck && boardState[3] == piecetoCheck && boardState[6] == piecetoCheck)
     {
         return(true);
     }
     if (boardState[1] == piecetoCheck && boardState[4] == piecetoCheck && boardState[7] == piecetoCheck)
     {
         return(true);
     }
     if (boardState[2] == piecetoCheck && boardState[5] == piecetoCheck && boardState[8] == piecetoCheck)
     {
         return(true);
     }
     if (boardState[2] == piecetoCheck && boardState[4] == piecetoCheck && boardState[6] == piecetoCheck)
     {
         return(true);
     }
     return(false);
 }
コード例 #3
0
 public Square(Player.Piece ruta)
 {
     VärdeRuta = ruta;
 }
コード例 #4
0
 public void PlaceChange(Player.Piece field, int index)
 {
     spel[index].ChangeStatus(field);
 }
コード例 #5
0
 public void MakeMove(int space, Player.Piece piece, Board board)
 {
     board.PlacePiece(space, piece);
     _moveCounter++;
 }
コード例 #6
0
 public Player(Player.Piece piece)
 {
     PlayerPiece = piece;
 }
コード例 #7
0
ファイル: Player.cs プロジェクト: AMMesic/-Tic-Tac-Toe
 public Player(Player.Piece pla)
 {
     PlayerPiece = pla;
 }
コード例 #8
0
ファイル: Square.cs プロジェクト: NotTedy/cSharp-Tic-Tac-Toe
 public Square(Player.Piece empty)
 {
     CurrentPiece = empty;
 }
コード例 #9
0
 public void ChangeStatus(Player.Piece square)
 {
     PieceStatus = square;
 }
コード例 #10
0
 public Square(Player.Piece play)
 {
     PieceStatus = play;
 }