[Solved] Adding difficulty levels into Java Chess Game


First of all: please only show relevant code.

Other than that the answer is pretty simple. I suppose you want to implement several AI strategies and have the player choose which one to use. Have a class ComputerPlayer and give it a constructor public ComputerPlayer(Strategy s). This will determine which strategy to use, so store that as an instance variable. This should then call s.determineMove() or whatever you decide to name the method to do just that: determine the move.

Then create an Interface Strategy and have several strategies (in this case: easy, medium, hard) implement this.

If you have no idea what I’m talking about, you’re probably not ready to implement an AI anyway.

Also I’d like to suggest looking at the very least at the MVC-pattern

1

solved Adding difficulty levels into Java Chess Game