Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Basic Java Game & "MVC"

 
Gaz Johnson
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been assigned a task for a university course. I would ask the tutor such questions normally but in the UK we are suffering a bit of bad weather and I can't get in. It's also a new course so i'm unsure who to email. However, my problem.....

We have been asked to code a game, which I have done. I don't know what it's called but you have a grid of symbols (in this case coins four tall, four wide). When you click one coin, it is flipped along with those to the top, bottom, left and right. If anyone of familiar with the electronic toy "Lights out" from a few years back, its like that. The game ends when all the coins have been reversed

I am now required to code an undo function, detection of completion, the ability to chose "challenges" via a web service and keep record of all the previous moves. I can figure all this out. However it says to follow "MVC" closely? I searched for this and the only thing which fits in this case is "Model-View-Controller" which I have no experience with

Has anyone got any hints how to follow such guidelines with such a small project?

Many thanks in advance.
 
salvin francis
Bartender
Posts: 1274
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In brief,

This is an architecture to follow while programming,

In an MVC app, the following 3 sections of app are kept seperate:

1. Model : Mainly data, how data is saved in the application. (eg: how you are saving the state of the coins true/false, etc.)
2. View: GUI/CUI how are you displaying it to the user. (eg: the drawing of your board, the coins, etc.)
3. Controller: Interaction with the user. (eg: Handling the user click over a coin, etc. )

you should ideally seperate these logics and not couple them together.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic