aspose file tools*
The moose likes Beginning Java and the fly likes Passing control Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Passing control" Watch "Passing control" New topic
Author

Passing control

Peter Tellanaki
Greenhorn

Joined: Apr 27, 2009
Posts: 7
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

Joined: Jan 17, 2006
Posts: 1296
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:



Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
And welcome to JavaRanch
Peter Tellanaki
Greenhorn

Joined: Apr 27, 2009
Posts: 7
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing control