Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Java Game (Monopoly)

94 views
Skip to first unread message

AJazk

unread,
Mar 14, 2003, 3:18:02 AM3/14/03
to

I am trying to learn Java and Swing. I intend to write a simplified version of
monopoly. I have a few questions.

Do I need images (jpegs) or could a reasonable looking board be made using
things like icons and text fields?

Any suggestions on how to start? i.e. Should I have a class called Square that
has fields like rent, price, houses etc. etc?


dave

unread,
Mar 14, 2003, 6:55:53 AM3/14/03
to
I recently did a monopoly game. Great way to learn java. All of my images
were gifs because they are simple to place on the GUI. I used an interface
of type Square which was generalized into Classes RealEstate, Chance,
CommunityChest, Utility, etc. This worked well.

Dave


"AJazk" <AJ...@News.com> wrote in message
news:260ce2b832ec802f...@news.teranews.com...

Joseph BECHARA

unread,
Mar 14, 2003, 7:04:02 AM3/14/03
to
Great thing to start Java programming.... try using Gif images... soo
easy to manipulate. Second try to make a certain Hierarchy with your
Classes, i.e, do not write one single class.. use polymorphisme. For
example; I would creat a class called Dice to roll the Dices, and
another class called Cards to represents the cards, and class Players,
Then you can extend you classes within your needs...etc etc.. just keep
a certain repsect for your hierarchy..
In this way you will understand the true benefit of OOP.

Joe

Chris Smith

unread,
Mar 14, 2003, 9:06:53 AM3/14/03
to
Joseph BECHARA wrote ...

> Great thing to start Java programming.... try using Gif images... soo
> easy to manipulate. Second try to make a certain Hierarchy with your
> Classes, i.e, do not write one single class.. use polymorphisme. For
> example; I would creat a class called Dice to roll the Dices, and
> another class called Cards to represents the cards, and class Players,
> Then you can extend you classes within your needs...etc etc.. just keep
> a certain repsect for your hierarchy..
> In this way you will understand the true benefit of OOP.

Well, I don't know about the OP... but I think I already understand, and
you've confused the heck out of me. How were you thinking of going
about defining inheritance relationships between Dice, Player, and Card?
I don't see anything that really makes sense here.

Abuse of inheritance is the single most common problem among new
practitioners of OO design. Probably best not to encourage it.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

BarryNL

unread,
Mar 14, 2003, 10:56:15 AM3/14/03
to
"Chris Smith" <cds...@twu.net> schreef in bericht
news:MPG.18db8fec2...@news.altopia.com...

> Joseph BECHARA wrote ...
> > Great thing to start Java programming.... try using Gif images... soo
> > easy to manipulate. Second try to make a certain Hierarchy with your
> > Classes, i.e, do not write one single class.. use polymorphisme. For
> > example; I would creat a class called Dice to roll the Dices, and
> > another class called Cards to represents the cards, and class Players,
> > Then you can extend you classes within your needs...etc etc.. just keep
> > a certain repsect for your hierarchy..
> > In this way you will understand the true benefit of OOP.
>
> Well, I don't know about the OP... but I think I already understand, and
> you've confused the heck out of me. How were you thinking of going
> about defining inheritance relationships between Dice, Player, and Card?
> I don't see anything that really makes sense here.
>
> Abuse of inheritance is the single most common problem among new
> practitioners of OO design. Probably best not to encourage it.

Agreed, I don't see much inheritence applicable to the above. The most
obvious candidate for inheritence is the square, eg:

monopoly.Square (abstract)
monopoly.PurchaseableSquare extends Square (abstract)
monopoly.StreetSquare extends PurchaseableSquare
monopoly.StationSquare extends PurchaseableSquare
monopoly.UtilitySquare extends PurchaseableSquare

Raghar

unread,
Mar 14, 2003, 5:46:24 PM3/14/03
to
AJazk <AJ...@News.com> wrote in
news:260ce2b832ec802f...@news.teranews.com:

> Any suggestions on how to start? i.e. Should I have a class called
> Square that has fields like rent, price, houses etc. etc?
>
>

Well you'd have problem with AI. ;) You need AI that will do some trading
and don't jump on player. At the same time it should not be abused from
player.

Dennis Rynskiy

unread,
Mar 14, 2003, 10:17:00 PM3/14/03
to

"AJazk" <AJ...@News.com> wrote in message
news:260ce2b832ec802f...@news.teranews.com...
>
> I am trying to learn Java and Swing. I intend to write a simplified
version of
> monopoly. I have a few questions.
>
> Do I need images (jpegs) or could a reasonable looking board be made using
> things like icons and text fields?

You can start with text version but keep images in mind.


>
> Any suggestions on how to start? i.e. Should I have a class called Square
that
> has fields like rent, price, houses etc. etc?

It looks reasonable.


0 new messages