0

So I'm meant to create a tic tac toe game where the computerplayer must have a recursive algorithm. I already completed the other parts of the code like board,player, checking winner and moves. Now I'm stuck on how should I start the computerplayer as im not really good at recursion.

public class ComputerPlayer implements Player {

       public ComputerPlayer(char computerCharacter, String name) {
           // TODO Auto-generated constructor stub
       }

       @Override
       public Move getMoveFor(GameState state) {
           // TODO Auto-generated method stub
           return null;
       }

       @Override
       public String getName() {
           // TODO Auto-generated method stub
           return null;
       }

       @Override
       public char getCharacter() {
           // TODO Auto-generated method stub
           return 0;
       }
}

I must follow this rubric for it
enter image description here

this is all I have so far and I really need help with this project.

let me know if you need to see all my code

Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
  • 2
    Is it a requirement to use recursion? It's a little strange that you are wanting to apply recursion to a problem that is not recursive at all – Trash Can Dec 07 '19 at 01:22
  • @ Teedeez The problem is actually recursive if you define the problem as an minimax algorithm to run the AI. I mean, the strategy isn't that tough, so you could use a non-recursive algorithm, but OP's assignment specifies recursion. To OP: there is no shortage of articles on computer tic tac toe strategy out there... you should get in the habit of searching for answers before you ask. – MarsAtomic Dec 07 '19 at 01:28
  • 1
    Here's a related question: https://stackoverflow.com/questions/8880064/tic-tac-toe-recursive-algorithm. Always search first. – MarsAtomic Dec 07 '19 at 01:30
  • Im not required to use a minimax algorithm however @MarsAtomic – jjwithasi Dec 07 '19 at 01:34
  • Relevant [xkcd](https://xkcd.com/832/). – Elliott Frisch Dec 07 '19 at 01:37
  • I think what they want is a basic global recursion game. A container method, which recursively runs itself until the win conditions aren't met. Is that what they want @jjwithasi? – arcanium0611 Dec 07 '19 at 01:47
  • The fact that the assignment asks OP to "show the value of each move" is a bit of a giveaway. While minimax.is overkill for tic tac toe, it fits the bill moreso than any other application for recursion. – MarsAtomic Dec 07 '19 at 02:19
  • @MarsAtomic okay how would I go about starting if I may ask? – jjwithasi Dec 07 '19 at 02:25
  • Did you search for "minimax algorithm tic tac toe" in both Google and Stack Overflow as I already suggested? Did you look at the question I linked? That's how you would start. – MarsAtomic Dec 07 '19 at 02:27

0 Answers0