• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing control

 
Peter Tellanaki
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello !
Not sure right spot for my qeustion since it is about game devel, but i am beginner so i guess i should post in beginner since simple question.

I have made a checkers game and gui. Can play with my self using gui. Also i have made an ai which returns best move in a position. But!

I have trouble finding out how to pass control between human player and ai player. Can this be done not using threads ? I want to have human player make move on gui and then
ai player makes move. Am kind of lost here. thought that this would be easy part when CheckersBoard and GUI classes are easy
 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm pretty sure I'm missing something in your question, but passing control should be easy. At a high level your code might look something like this:

 
Campbell Ritchie
Sheriff
Pie
Posts: 50171
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to JavaRanch
 
Peter Tellanaki
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello again.

Thank you for comments and welcome. Sorry my poor english..
My problem is i dont know how to design so i can get move from human-click on gui. My first program i just play for both. But now AI needs to be told about
human move.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic