Hello, english is not my first language so if you don't understand something, please ask.
Well, I'm not sure how to start this question... the thing is I have to make a Monopoly game, saving players' data using SQLite and property/card info in plain text files.
I started making the classes, like Players, Properties, Cards, Dice, etc. But I found that everytime I want to call a function, it has to be in the main class, cause there is where I created the array of Players (the class Players).
This kind of annoys me, I don't know if that is the way to program this kind of things or if there is a better "model" where methods can be in their respective classes...
How would you model this game? also, I need to 'connect' the game functions with a Swing interface and I'm a complete noob on that, I'm using NetBeans swing editor u_u
Please help. Everything will be appreciated... examples, links, videos, ideas on the model, etc.
Thanks in advance.
I think (never done it so far) I would model it just like you describe. A Player class,
with fields like capital, ArrayList<MonopolySquare> possessions. ...
a MonopolySquare interface with methods like "void doAction(Player player)" and
"String getInfo()", a Street class, a Station class, a Jail class, et cetera, all implementing
MonopolySquare, et cetera.
And my main class would be something like:
So, pretty traditional, and indeed, many rules of the game are in the main class.
Well, these rules have to be in some class, and certainly not all the rules are in there.
For instance, a Street class would have methods that determine the rent, how many houses,
whether there's a mortgage, what player owns it, et cetera, so plenty of methods there as well.
And of course, it has an icon (scanned from the original board of course), that will be used for the
As I said, never done this monopoly, but from an OOP point of view, it looks very interesting.