public MakeMove(ulong playerID, byte[] move, byte[] newBoardState, MatchStates newMatchState) : base(Types.MakeMove) { PlayerID = playerID; Move = move; NewBoardState = newBoardState; NewMatchState = newMatchState; }
public override void Deserialize(BinaryReader reader) { base.Deserialize(reader); PlayerID = reader.ReadUInt64(); Move = ReadBytes(reader); NewBoardState = ReadBytes(reader); NewMatchState = (MatchStates)reader.ReadByte(); }
public GameState(byte[] boardState, byte[][] recentMoves, MatchStates matchState, ulong player1ID, ulong player2ID) : base(Types.GameState) { BoardState = boardState; RecentMoves = recentMoves; MatchState = matchState; Player1ID = player1ID; Player2ID = player2ID; }
public static bool IsGameOver(this MatchStates state) { switch (state) { case MatchStates.Player1Turn: case MatchStates.Player2Turn: return(false); case MatchStates.Player1Won: case MatchStates.Player2Won: case MatchStates.Tie: return(true); default: throw new NotImplementedException(state.ToString()); } }
public override void Deserialize(BinaryReader reader) { base.Deserialize(reader); BoardState = ReadBytes(reader); RecentMoves = new byte[reader.ReadInt32()][]; for (int i = 0; i < RecentMoves.Length; ++i) { RecentMoves[i] = ReadBytes(reader); } MatchState = (MatchStates)reader.ReadByte(); Player1ID = reader.ReadUInt64(); Player2ID = reader.ReadUInt64(); }
public override void Deserialize(BinaryReader reader) { base.Deserialize(reader); BoardState = ReadBytes(reader); MatchState = (MatchStates)reader.ReadByte(); }
public NewBoard(byte[] boardState, MatchStates matchState) : base(Types.NewBoard) { BoardState = boardState; MatchState = matchState; }