The goal of the assignment I'm currently working on for my Data Structures class is to create a quantum Tic Tac Toe with AI that plays to win.
I'm currently having trouble finding the most efficient way to represent states.
Overview of the current structure:
Abstract game
- Owned and managed by AbstractPlayers (game.nextPlayer () returns the next player by identifier int)
- Has and enforces AbstractBoard at the start of the game.
- Has a GameTree (completed if called in initialization, incomplete otherwise)
Abstractboard
- Has a state, size and parental game.
- Mediates between Player and State (Converts states from row sets to Point view
- Is StateConsumer
AbstractPlayer
- ConcreteEvaluationStrategy
StateTransveralPool
- " ".
- HashMap, Set nextStates "3-"
- 3 - X-, O-
- . Integer StateTransversalPool
SO,
000-111, 0 , 1 - .
, TTT:
From the Set<Integer> board perspective:
X_X R1 might be: 101
OO_ R2 might be: 110
X_X R3 might be: 101, where 1 is an open space, and 0 is a closed space
From the Set<Integer> xMoves perspective:
X_X R1 might be: 101
OO_ R2 might be: 000
X_X R3 might be: 101, where 1 is an X and 0 is not
From the Set<Integer> oMoves perspective:
X_X R1 might be: 000
OO_ R2 might be: 110
X_X R3 might be: 000, where 1 is an O and 0 is not
, x {R1, R2, R3} o {R1, R2, R3} = > {R1, R2, R3}
GameTree. Max (x) {R1, R2, R3}, R1, R2 R3 ..
Set<Integer> R1nextStates = StateTransversalPool.get(R1);
, R1 R2.
, Set, ? ? , Point ↔ . , ?
!
ConcretePlayer. , , StateProducer (, , StateFactory StateBuilder).
public class ConcretePlayerGeneric extends AbstractPlayer {
@Override
public BinaryState makeMove() {
Point playerMove = super.strategy.evaluate(this);
BinaryState currentState = super.getInGame().getBoard().getState();
return StateProducer.getState(this, playerMove, currentState);
}
}
EDIT: TTT Quantum TTT. , , Concrete .