• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Checkers game.

 
Ranch Hand
Posts: 63
IntelliJ IDE Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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?
 
Ranch Hand
Posts: 312
MS IE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
catch it before it slithers away! Oh wait, it's a tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic