Would someone help me with my silly project? I want to implement my ComputerPlayer and my HumanPlayer classes and my GameRoom classes correctly so it would all work, before implementing the TicTacToe class. http://ideone.com/x8o52
sorry OUT OF MY REACH.......
Out of your reach? What does that mean?
gary ahuja meant it is just too hard
(and also for me too)
What do you need help with?
I need help writing it.
Start by writing the HumanPlayer. Then you can test the game by using two HumanPlayers, which are easy to control. I'm not sure if the GameRoom is supposed to referee the game (hold the Game and Players, figure out whose turn it is, ask them for their move, and make the move) or what. But that logic needs to exist somewhere. That logic will need to call a method on Player, pass it the game state (just the Game), get some kind of Move object back (just the integer for which square they chose), and update the game state with that move (or reject it). So put that method in Player and override it in the specific Player subclasses. The ComputerPlayer is the tricky bit. If you're following along with the Stanford AI class you'll recognize its task as a tree search (actually a directed acyclic graph, but that could look like a tree to a search algorithm). Each of the 9 squares can be in 3 states: X, O, empty. So there are 3^9 = 20k states in the state space. As the game progresses only a tiny fraction of those states remain reachable. So the search task shouldn't be too difficult. The problem is that there's an adversary, and the AI class hasn't covered searching in adversarial environments, so that might take some research. Or, by the time you get to writing the CP they might have gotten to that in the class. Let me know if you want more, or more concrete, help.
Join our real-time social learning platform and learn together with your friends!