I am writing a connect four game for an artificial intelligence course. The first phase of the project is to write a user interface. Since I'm sometimes a little bit of an over-achiever, I decided to create a GUI and do some fancy animations and such. I've written the program and it's good enough to turn in. Since there is quite a bit of code, I decided not to post it; instead, anyone that offers to help can download
the source as a jar file from my school webspace.
I still have some problems that may come back to bite me when I go and develop the AI portion so the user can play against the computer. At the moment, it's just made to allower to human players to play against each other. The problem is that if the user clicks on the game board quickly several times in a row, the animation for the falling pieces is all screwed up.
I'm trying to use the Model-View-Controller
pattern for my connect four board. In particular, I have three classes ConnectFourBoard (the model), ConnectFourPanel (the view), and ConnectFourController (the controller). Another difficulty is that I'm creating a separate
Thread for the animation so that the GUI still responds to some user input that should still be allowed (such as navigating the menu). While this isn't crucial, I thought it would be a good idea.
I'm having a difficult time finding an elegant way to ignore mouse clicks on the ConnectFourPanel while the animation is going. This will be especially crucial because when I start implementing the AI routines, I don't want the user to be able to make a move while the computer is "thinking" about which move to make. Does anyone have any suggestions of how I can implement this in my current design framework?
Any suggestions will be greatly appreciated.
Thanks,
Layne
p.s. Also, if this question would be more appropriate in a different forum, please let me know. There are several choices in my mind, but this GUI forum makes the most sense to me.