Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

UNO Game in Java

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I was working on an UNO game as part of a project and had a few questions. I would also appreciate if you all could kind of provide a basic guiding framework as to how to organize the code. This game requires GUI and is acting as a "referee" between 4 players with no AI.

Q #1) What is a "game-state" and what purpose does it present in the overall game? We are required to have a game-state and i do not understand.
Q #2) Can I have one JPanel and put everything on it or have multiple and which one is better?

Thanks in advance
 
Marshal
Posts: 65467
249
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The game state is a combination of all the data in use by the game, including position and motion of all the players at a particular time.
Don't consider how many panels to use at this stage; that is a display problem which you can work out when you have the game's logic working properly.
 
John Whittlesey
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Going on your previous advice, I finished my game's logic completely, and my Uno Game right now is a fully-fledged text based game on the IDE Console. But right now, I have no idea how to start crafting a GUI for the game or where to even start at all. And I cannot figure out whether I let my game play out in the background as text game while the Graphics window overlays it or whether I must change code to modify those print statements?
 
Bartender
Posts: 6140
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A natural thing that happens as code evolves is to embed your user interface code in your business/game logic. (I'm making some assumptions about your code here.) So, if I'm correct, then the next step would be to pull out all your text based interactions with your game logic into its own class or classes. This would leave you pure game logic class(es) with an API that can be evoked from either a text based interface or a GUI. The game logic should not need to know which flavor of user interface is involved. Then the next step would be to design your GUI.
 
The human mind is a dangerous plaything. This tiny ad is pretty safe:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!