• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Java Monopoly game design..

 
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anyone know how to go about designing a monopoly game for Java?

Thanks.
 
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes

Do you have specific questions?
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Barry:
Does anyone know how to go about designing a monopoly game for Java?



Even if I know, do you want me to put my entire code here?

ShowSomeEffort while asking questions.
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Even if I know, do you want me to put my entire code here?


Take it easy, guys. The question was about design, not code. And now let's wait for Barry to clarify what he's stuck with.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:

Take it easy, guys. The question was about design, not code. And now let's wait for Barry to clarify what he's stuck with.



yeah true.
 
Barry Brashear
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, my question was about class design not code.

thanks.
 
Ulf Dittmer
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What ideas have you had so far? Are you wondering about a particular design idea?
 
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Barry Brashear:
Does anyone know how to go about designing a monopoly game for Java?

Thanks.



Try writing out the game and it's rules on a piece of paper (or just get the official manual). Then underline all the nouns and verbs on your piece of paper. The nouns are candidates for classes while the verbs are candidates for methods of those classes (of course, not all of them are relevant!).
 
Barry Brashear
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. I guess that would include board, player, property, hotel, house, etc.
 
Piet Verdriet
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Barry Brashear:
Thanks. I guess that would include board, player, property, hotel, house, etc.



Among others, yes. And these are all classes.
A "verb example": a player should have a method called move(...) to move from one section of the board to another.

Also, there could be a main class called Game, which holds the references to a Board instance, Player instances, a couple of Die (Dice) instances, etc. In that Game instance, you create a loop that keeps on looping giving each player on the board a turn to play. This loop is terminated whenever one of the players has won.

Good luck.
 
Ulf Dittmer
Rancher
Posts: 43028
76
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While the verb/noun approach provides a first approximation at an object model, I'd say that it'd be a mistake to take its results too literally. A good object model isn't necessarily the one that mimics the real world perfectly - it needs to make sense for the application code.

E.g., I don't see what methods house or hotel objects would have. They differ in the amount of rent due, but that's an attribute of the property. So I might make the number of houses/hotels fields of a property object they belong to.

And there might be other objects that have no corresponding physical object.

You might find this discussion about modeling a tennis match interesting.
[ July 11, 2008: Message edited by: Ulf Dittmer ]
 
I wasn't selected to go to mars. This tiny ad got in ahead of me:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic