OpenGLでレンダリングされたチェスゲームを作っています。
すべての答えを教えてくれる人を探しているわけではありません。自分でコードを理解したいのですが、正しい概念を教えてくれることが本当に必要です。この時点で、どこから始めればよいかわかりません。これが私が理解したものです:
TurnState次の値を持つ列挙型:
playerOneTurnplayerTwoTurnStopped
GameState次の値を持つ列挙型:
playerOneCheckplayerTwoCheckplayerOnecCheckMatePlayerTwoCheckMateInitializingGameTieNormalPlay
抽象クラスPlayerとサブクラスComputer.
ChessGame次のフィールドを持つクラス:
Player p1, p2
TurnState turnState
GameState gameState
Move次のフィールドを持つクラス:
*Piece
Location origin
Location destination
Location次のフィールドを持つクラス:
row
col
*ChessBoard
を受け取り、移動が有効かどうかをチェックChessBoardする 1 つのメソッドを持つクラス。isValidMove
ChessPieces次のメソッドを持つ抽象クラス:
GetValue() // returns an int value of the piece (for scoring)
GetPosition() // returns the current position of a piece
getIsSelected() // returns a boolean, true if selected, false if unselected
move() // moves the piece in a way dependent upon what piece
そして、以下のサブクラス:
PawnRookQueenKingKnight