File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Checkers game. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Checkers game." Watch "Checkers game." New topic

Checkers game.

Timmy Ryan
Ranch Hand

Joined: Dec 09, 2007
Posts: 63


I am creating a checkers/draughts game in swing and am a bit unsure about whether to use MVC or not in the design.
This is a project for college and the main focus of it is the algorithms that decide on the next move for the computer, not the UI.

There will be a main JPanel onto which the board will be drawn. After a move is made by the human a MouseListener method will signal to the computer to compute the next move.
This will be done in a class that extends SwingWorker.

Model : In this case would be game state, number of pieces etc.
View : The UI for the game, would call the controller to calculate the next move.
Controller : The part of the game that decides on the next move.

Do I need to do much more on the design, I don't know where to start?
Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

I believe, Model will just be your Game State.

I believe, View (UI) needs to be enhanced to display the Checker Board, the different types (Shapes/colours) of Checkers and should handle user events.

You are right about the Controller, however, in addition, it should also prompt View to re-draw the Checker Board after every successful move.

Not many get the right opportunity !
I agree. Here's the link:
subject: Checkers game.
It's not a secret anymore!