So, I'm programming the advance to the nearest transportation. It really isn't that big of a deal - it's quite small. But, I used the individual index like square[5].owned rather than square[player[0].col].owned - which makes it a heck lot complicated. So I changed everything to square[player[0].col].owned instead of using individual indexes because that can easily cause mistakes.
So this is the part for Room of Requirement - I'm posting it for future reference:
int x = (int) ((Math.random()*8)+1);
if (x == 0)
{
player[0].col = 0;
JOptionPane.showMessageDialog(pane, "Advance to go and collect 200 galleons", "Congratulations!", JOptionPane.INFORMATION_MESSAGE);
} //end of if statement
else if (x == 1)
{
//player[0].gringottsAccount+=200;
JOptionPane.showMessageDialog(pane, "There is a gringrotts error, and it is in your favour! \n Collect 200 galleons courtesy of us. ", "Good news!", JOptionPane.INFORMATION_MESSAGE);
player[0].gringottsAccount+=200;
} //end of if statement
else if (x==2)
{
JOptionPane.showMessageDialog(pane, "You must go to Odin's Land to purchase/interact grain because Camelot is out of food. \n Pay 100 galleons", "Uh oh...", JOptionPane.INFORMATION_MESSAGE);
player[0].gringottsAccount-=100;
} //end of if statement
else if (x ==3)
{
int y = JOptionPane.showConfirmDialog(pane, "Your father falls ill, and you must visit the Court Physician, Gaius. \n Under normal circumstances, he wouldn't charge you, but this time, he asks for gold. \n You must provide him with 50 galleons otherwise he'll tell the King that you are a sorceress/sorcerer. \n Do you give him 50 galleons or risk him exposing your secret?", "Uh oh!", JOptionPane.YES_NO_OPTION);
if (y ==0)//if the user pressed yes
{
player[0].gringottsAccount-=50;
pot+=50;
JOptionPane.showMessageDialog(pane, "We have taken 50 galleons out of your account.", "Sorry...", JOptionPane.INFORMATION_MESSAGE);
} //end of if statement
else if (y==1)//if the user pressed no.
{
double p = 0.0;
int a = (int)(Math.random()*100);
if (a%2 == 0) //if divisible by 2
{
//Gaius rats you out.
p = (int)((player[0].gringottsAccount)/2);
player[0].gringottsAccount = p;
pot += p;
JOptionPane.showMessageDialog(pane, "Gaius has been possessed by a goblin. He rats you out. You lose half of your total amount of money.", "Bad news...", JOptionPane.INFORMATION_MESSAGE);
} //end of if statement
else //if it is an odd number
{
player[0].gringottsAccount+=50;
pot -=50;
JOptionPane.showMessageDialog(pane, "Fortunately, Gaius hasn't said anything to the King! \n In fact, he was possessed by a Goblin, and he apologizes by giving you 50 galleons refund,", "Great news!", JOptionPane.INFORMATION_MESSAGE);
} //end of if statement
} //end of if statement
} //end of if statement
else if (x==4)
{
player[0].col=9;
JOptionPane.showMessageDialog(pane, "Your friends are annoying you, and with a very random thought, \n you try to erase their memory. Your wand backfires and you have no recollection of who you are, what you're doing, or how you got to where you were. Go to St. Mungos, now.", "Bloody Briliat Job..or not", JOptionPane.INFORMATION_MESSAGE);
square[9].turn=3;
} //end of if statement
else if (x==5)
{
JOptionPane.showMessageDialog(pane, "Happy happy birthday! \n Collect 20 galleons from each player and enjoy!", "HAPPY BIRTHDAY!", JOptionPane.INFORMATION_MESSAGE);
player[1].gringottsAccount-=20;
player[0].gringottsAccount+=20;
pot += 40;
} //end of if statement
else if (x==6)
{
JOptionPane.showMessageDialog(pane, "You and all your friends decide to spend money on the Chinese Theatre. \n Yes, that same one that John and his date (plus Sherlock). \n However, Sherlock only has 3 free tickets, no more, no less. \n All other players must pay 50 galleons. \n You, the person who picked up this card must chip in 10 galleons.", "Chinese Theatre", JOptionPane.INFORMATION_MESSAGE);
player[1].gringottsAccount-=50;
player[0].gringottsAccount-=10;
pot += 60;
} //end of if statement
else if (x==7)
{
int j = 0;
int index = 0, a = 0 ;
int pay = 0;
int b = JOptionPane.showConfirmDialog(pane, "Morgana has declared war on Camelot. \n She is using you to get through to King Arthur. \n You, can use magic and stop her (but then everyone else will know that you have magic); or you can let her do her worst.\n Do you use magic?", "Decisions, decisions", JOptionPane.YES_NO_OPTION);
if (b==0) //you use magic.
{
JOptionPane.showMessageDialog(pane, "Good decision! The rent for the Com Pewter landing on your most expensive property will double." , "Good choice!", JOptionPane.INFORMATION_MESSAGE);
//For Loop to determine most expensive property
for (; index<square.length; index++)
{
//j is originally declared as 0. and so, if the square[i].buy is greater than the j value, j is equal to that starting value. Therefore, J will always be equal to the most expensive properties of the ones that it goes through.
if (j<square[index].buy)
{
j = square[index].buy;
if (tracing)
System.out.println("Most Expensive Property: " +j+ " vs. this: square" +index+ ".rent: " +square[index].rent);
if (tracing) System.out.println("The most expensive property is: " +square[index].name+ " owned by the user. The rent is now: " +square[index].rent);
//i represents the index. j is used to find the most expensive property - and is equal to the most expensive property.
square[index].rent *=2;
if (tracing) System.out.println("The most expensive property is: " +square[index].name+ " owned by the user. The rent is now: " +square[index].rent );
} //end of if statement
} //end of for loop
JOptionPane.showMessageDialog(pane, "We made changes to the following property: " +square[index].name+ " . \n The rent for this property is now: " +square[index].rent+ " ." , "Property and Rent Changes", JOptionPane.INFORMATION_MESSAGE);
} //end if statement
else if (b==1) //you don't use magic.
{
JOptionPane.showMessageDialog(pane, "Sorry...bad decision. \n The rent of your most expensive property will be cut in half.", "Bad choice...", JOptionPane.INFORMATION_MESSAGE);
//For Loop to determine most expensive property
for (; index<square.length; index++)
{
//j is originally declared as 0. and so, if the square[i].buy is greater than the j value, j is equal to that starting value. Therefore, J will always be equal to the most expensive properties of the ones that it goes through.
if (j<square[index].buy)
{
j = square[index].buy;
if (tracing)
System.out.println("Most Expensive Property: " +j+ " vs. this: square" +index+ ".rent: " +square[index].rent);
if (tracing) System.out.println("The most expensive property is: " +square[index].name+ " owned by the user. The rent is now: " +square[index].rent);
//i represents the index. j is used to find the most expensive property - and is equal to the most expensive property.
square[index].rent/=2;
if (tracing) System.out.println("The most expensive property is: " +square[index].name+ " owned by the user. The rent is now: " +square[index].rent );
} //end of if statement
} //end of for loop
JOptionPane.showMessageDialog(pane, "We made changes to the following property: " +square[index].name+ " . \n The rent for this property is now: " +square[index].rent+ " ." , "Property and Rent Changes", JOptionPane.INFORMATION_MESSAGE);
} //end of if statement (b)
} //end of if statement
//************************************************Transportation*
else if (x == 8)
{
JOptionPane.showMessageDialog(pane, "Advance to the nearest transportation spot (Taxi, Tardis, Wardrobe or Hogwarts Express).\n If it is unowned, you can buy this from the bank. \n If it is owned, roll the dice a second time and pay the owner 10 times the sum of the die. ", "Advance", JOptionPane.INFORMATION_MESSAGE);
//If they are in the ranges of after the Hogwarts Express but before the Tardis (or on the tardis).
if (player[0].col>= 32 &&player[0].col<=5)
{
JOptionPane.showMessageDialog(pane, "You will advance to the Tardis.", "Advance to", JOptionPane.INFORMATION_MESSAGE);
if (player[0].col == 5)
{
JOptionPane.showMessageDialog(pane, "You are already on this square. Please press 'Go, Com Pewter' when you want the Com Pewter to go", "You're already there.", JOptionPane.INFORMATION_MESSAGE);
} //end of if statement
if (player[0].col>=32)
{
JOptionPane.showMessageDialog(pane, "You have passed the Start Square - we will provide you with 200 galleons now.", "Passed Start Square", JOptionPane.INFORMATION_MESSAGE);
} //end of if statement
player[0].col = 5;
if (square[player[0].col].owned == false)
{
int answer = JOptionPane.showConfirmDialog(pane, "You have landed on: " +square[player[0].col].name + ". \n Would you like to purchase it? ", "You've landed!", JOptionPane.YES_NO_OPTION);
if (answer == 0)
{
square[player[0].col].owner = "User";
square[player[0].col].owned=true;
square[player[0].col].rent *=square[player[0].col].number;
player[0].gringottsAccount-=(square[player[0].col].buy);
JOptionPane.showMessageDialog(pane, "We have taken out: " +square[player[0].col].buy+ " from your Gringotts Account. \n You now have: " + player[0].gringottsAccount+ " galleons.", "Gringotts Account", JOptionPane.INFORMATION_MESSAGE);
} //end of if statement
else
{
JOptionPane.showMessageDialog(pane, "We hope you will consider purchasing the property in the future! \n You now have: " +player[0].gringottsAccount+ " galleons", "Property", JOptionPane.INFORMATION_MESSAGE);
} //end of else statement
} //end of if statement
else if (square[player[0].col].owned == true && square[player[0].col].owner.equals("Com Pewter"))
{
JOptionPane.showMessageDialog(pane, "You landed on the Com Pewter's Property. \n Please press okay to roll the die.", "Transportation", JOptionPane.INFORMATION_MESSAGE);
if (square[player[0].col].number<=3)
{
square[player[0].col].number++;
square[player[0].col].rent *= square[player[0].col].number;
} //end of if statement
//JOptionPane.showMessageDialog(pane, "", "", "");
int totalDie = (int)((Math.random()*12)+1);
JOptionPane.showMessageDialog(pane, "The result of your die is: " +totalDie+ " . \n You must pay the Com Pewter: " +(int)(totalDie*10)+ " . \n ", "Com Pewter: Thank you!", JOptionPane.INFORMATION_MESSAGE);
totalDie*=10;
player[0].gringottsAccount-=totalDie;
player[1].gringottsAccount+=totalDie;
} //end of if statement
else if (square[player[0].col].owned && square[player[0].col].owner.equals("User"))
{
JOptionPane.showMessageDialog(pane, "You have landed on your own property. Please press the button 'Go, Com Pewter' when you want the computer to go.", "Your own property!", JOptionPane.INFORMATION_MESSAGE);
} //end of else if statement
} //end of if statement
/////////////////////////////////////////////////////////////TAAAXI////////////////////////////////////////////////////////////////////////////////////////////////////////////
//If they are after the tardis; and on or before the taxi.
else if (player[0].col>=6 && player[0].col<=14)
{
if (player[0].col == 14)
{
JOptionPane.showMessageDialog(pane, "You are already on this square. Please press 'Go, Com Pewter' when you want the Com Pewter to go", "You're already there.", JOptionPane.INFORMATION_MESSAGE);
} //end of if statement
JOptionPane.showMessageDialog(pane, "You will advance to the Taxi.", "Advance to", JOptionPane.INFORMATION_MESSAGE);
player[0].col = 14;
if (square[player[0].col].owned == false)
{
int answer = JOptionPane.showConfirmDialog(pane, "You have landed on: " +square[player[0].col].name + ". \n Would you like to purchase it? ", "You've landed!", JOptionPane.YES_NO_OPTION);
if (answer == 0)
{
square[player[0].col].owner = "User";
square[player[0].col].owned=true;
//square[player[0].col].number++;
player[0].gringottsAccount-=(square[player[0].col].buy);
JOptionPane.showMessageDialog(pane, "We have taken out: " +square[player[0].col].buy+ " from your Gringotts Account. \n You now have: " + player[0].gringottsAccount+ " galleons.", "Gringotts Account", JOptionPane.INFORMATION_MESSAGE);
} //end of if statement
else
{
JOptionPane.showMessageDialog(pane, "We hope you will consider purchasing the property in the future! \n You now have: " +player[0].gringottsAccount+ " galleons", "Property", JOptionPane.INFORMATION_MESSAGE);
} //end of else statement
} //end of if statement
//if the computer owns the property.
else if (square[player[0].col].owned == true && square[player[0].col].owner.equals("Com Pewter"))
{
JOptionPane.showMessageDialog(pane, "You landed on the Com Pewter's Property. \n Please press okay to roll the die.", "Transportation", JOptionPane.INFORMATION_MESSAGE);
int totalDie = (int)((Math.random()*12)+1);
JOptionPane.showMessageDialog(pane, "The result of your die is: " +totalDie+ " . \n You must pay the Com Pewter: " +(int)(totalDie*10)+ " . \n ", "Com Pewter: Thank you!", JOptionPane.INFORMATION_MESSAGE);
totalDie*=10;
player[0].gringottsAccount-=totalDie;
player[0].gringottsAccount+= totalDie;
if (square[player[0].col].number<=3)
square[player[0].col].number ++;
} //end of if statement
//if they own the property.
else if (square[player[0].col].owned && square[player[0].col].owner.equals("User"))
{
JOptionPane.showMessageDialog(pane, "You have landed on your own property. Please press the button 'Go, Com Pewter' when you want the computer to go.", "Your own property!", JOptionPane.INFORMATION_MESSAGE);
} //end of else if statement
} //end of else if statement
//////////////////////////////////////////////////////////WARDROBE////////////////////////////////////////
//If they land after the tardis and or before/on the wardrobe.
else if (player[0].col>=14 && player[0].col<=22)
{
if (player[0].col == 22)
{
JOptionPane.showMessageDialog(pane, "You are already on this square. Please press 'Go, Com Pewter' when you want the Com Pewter to go", "You're already there.", JOptionPane.INFORMATION_MESSAGE);
} //end of if statement
JOptionPane.showMessageDialog(pane, "You will advance to the Taxi.", "Advance to", JOptionPane.INFORMATION_MESSAGE);
player[0].col = 22;
if (square[player[0].col].owned == false)
{
int answer = JOptionPane.showConfirmDialog(pane, "You have landed on: " +square[player[0].col].name + ". \n Would you like to purchase it? ", "You've landed!", JOptionPane.YES_NO_OPTION);
if (answer == 0)
{
square[player[0].col].owner = "User";
square[player[0].col].owned=true;
//square[player[0].col].number++;
player[0].gringottsAccount-=(square[player[0].col].buy);
JOptionPane.showMessageDialog(pane, "We have taken out: " +square[player[0].col].buy+ " from your Gringotts Account. \n You now have: " + player[0].gringottsAccount+ " galleons.", "Gringotts Account", JOptionPane.INFORMATION_MESSAGE);
} //end of if statement
else
{
JOptionPane.showMessageDialog(pane, "We hope you will consider purchasing the property in the future! \n You now have: " +player[0].gringottsAccount+ " galleons", "Property", JOptionPane.INFORMATION_MESSAGE);
} //end of else statement
} //end of if statement
//if the computer owns the property.
else if (square[player[0].col].owned == true && square[player[0].col].owner.equals("Com Pewter"))
{
JOptionPane.showMessageDialog(pane, "You landed on the Com Pewter's Property. \n Please press okay to roll the die.", "Transportation", JOptionPane.INFORMATION_MESSAGE);
int totalDie = (int)((Math.random()*12)+1);
JOptionPane.showMessageDialog(pane, "The result of your die is: " +totalDie+ " . \n You must pay the Com Pewter: " +(int)(totalDie*10)+ " . \n ", "Com Pewter: Thank you!", JOptionPane.INFORMATION_MESSAGE);
totalDie*=10;
player[0].gringottsAccount-=totalDie;
player[1].gringottsAccount+=totalDie;
if (square[player[0].col].number<=3)
square[player[0].col].number++;
} //end of if statement
//if they own the property.
else if (square[player[0].col].owned && square[player[0].col].owner.equals("User"))
{
JOptionPane.showMessageDialog(pane, "You have landed on your own property. Please press the button 'Go, Com Pewter' when you want the computer to go.", "Your own property!", JOptionPane.INFORMATION_MESSAGE);
} //end of else if statement
} //end of else if statement
//////////////////////////////////////////////////////////Hogwarts Express////////////////////////////////////////
//If they land after the tardis and or before/on the wardrobe.
else if (player[0].col>=22 && player[0].col<=31)
{
if (player[0].col == 31)
{
JOptionPane.showMessageDialog(pane, "You are already on this square. Please press 'Go, Com Pewter' when you want the Com Pewter to go", "You're already there.", JOptionPane.INFORMATION_MESSAGE);
} //end of if statement
JOptionPane.showMessageDialog(pane, "You will advance to the Taxi.", "Advance to", JOptionPane.INFORMATION_MESSAGE);
player[0].col = 31;
if (square[player[0].col].owned == false)
{
int answer = JOptionPane.showConfirmDialog(pane, "You have landed on: " +square[player[0].col].name + ". \n Would you like to purchase it? ", "You've landed!", JOptionPane.YES_NO_OPTION);
if (answer == 0)
{
square[player[0].col].owner = "User";
square[player[0].col].owned=true;
//square[player[0].col].number++;
player[0].gringottsAccount-=(square[player[0].col].buy);
JOptionPane.showMessageDialog(pane, "We have taken out: " +square[player[0].col].buy+ " from your Gringotts Account. \n You now have: " + player[0].gringottsAccount+ " galleons.", "Gringotts Account", JOptionPane.INFORMATION_MESSAGE);
} //end of if statement
else
{
JOptionPane.showMessageDialog(pane, "We hope you will consider purchasing the property in the future! \n You now have: " +player[0].gringottsAccount+ " galleons", "Property", JOptionPane.INFORMATION_MESSAGE);
} //end of else statement
} //end of if statement
//if the computer owns the property.
else if (square[player[0].col].owned == true && square[player[0].col].owner.equals("Com Pewter"))
{
JOptionPane.showMessageDialog(pane, "You landed on the Com Pewter's Property. \n Please press okay to roll the die.", "Transportation", JOptionPane.INFORMATION_MESSAGE);
int totalDie = (int)((Math.random()*12)+1);
JOptionPane.showMessageDialog(pane, "The result of your die is: " +totalDie+ " . \n You must pay the Com Pewter: " +(int)(totalDie*10)+ " . \n ", "Com Pewter: Thank you!", JOptionPane.INFORMATION_MESSAGE);
totalDie*=10;
player[0].gringottsAccount-=totalDie;
player[1].gringottsAccount+=totalDie;
if (square[player[0].col].number<=3)
square[player[0].col].number++;
} //end of if statement
//if they own the property.
else if (square[player[0].col].owned && square[player[0].col].owner.equals("User"))
{
JOptionPane.showMessageDialog(pane, "You have landed on your own property. Please press the button 'Go, Com Pewter' when you want the computer to go.", "Your own property!", JOptionPane.INFORMATION_MESSAGE);
} //end of else if statement
} //end of else if statement
} //end of if statement
JOptionPane.showMessageDialog(pane, "Your gringotts account now has: " +player[0].gringottsAccount+ ". Your opponent, the computer, has: " +player[1].gringottsAccount+" .", "Gringotts Accounts", JOptionPane.INFORMATION_MESSAGE);
} //end of if statement
else
{
JOptionPane.showMessageDialog(pane, "Sorry. You are not located on this property. You are unable to purchase/interact with it.", "Invalid", JOptionPane.INFORMATION_MESSAGE);
} //end of if statement
I've also thought about the JFrames that I was planning to add: the ones that tell the user where they are, how many times the ComPewter has landed on their property, I am thinking of entirely getting rid of those and just make it so that it shows the number of times the opponent has landed on that
Welcome! Fandoms in the monopoly include Doctor Who, Sherlock, Merlin, Harry Potter, Lord of the Rings and Narnia. You'll see milestones while coding, errors that I have encountered, an "environmental message" , "computer science and careers" that might relate to this program, and how emerging areas of computer science might benefit from this program. Other things include errors that were encountered, the brainstorming before coding. Ryk, happy reading!
Sunday, 2 June 2013
Saturday, 1 June 2013
Plan, plan, strict plan!
Okay, so here goes.
I'm going to finish all the excess stuff that I need to finish for the user tomorrow - and start on the Computer part.
This will be done - after the user has finished their turn, they can click a button on the east pane saying, "Com Pewter, go!"
This button, of course, will be added to the mouseListener and:
if (whatClicked.getSource()==thatButton)
{
Roll the dice.
Move the player[1].col += die1+die2;
//All the if statement so that if player[1].col>37, move __ that many squares (start at the beginning).
JOptionPane this to the user telling the computer has landed on ___ property.
if (square[player[1].co].owner.equals("User"))
{
JOptionPane to the user telling them that the Com Pewter has landed on their property, and the computer will pay __ much.
JOptionPane telling user amount of money in Gringotts Account
square[player[1].col].turn++;
}
else if (square[player[0].col].owned == false)
{
int y = random number for 10000 numbers.
if ((y%2)==0) Purchase the property - display JOptionPane telling the user Com Pewter has purchased it.
else Don't purchase and display JOptionPane telling user that the Com Pewter didn't purchase it, and that it is the user's turn.
}
else if (they are coordinates for room of requirement)
{
Paste the room of requirement text here - and the computer will randomly decide each yes/no answer.
Print out JOptionPane to tell the user this later.
}
}
Okay, well, this turned into pseudocode, by accident! this can be a planning, thing, but oh well. It was helpful. Anyways, uh, after that, I still have to do the following things:
I'm going to finish all the excess stuff that I need to finish for the user tomorrow - and start on the Computer part.
This will be done - after the user has finished their turn, they can click a button on the east pane saying, "Com Pewter, go!"
This button, of course, will be added to the mouseListener and:
if (whatClicked.getSource()==thatButton)
{
Roll the dice.
Move the player[1].col += die1+die2;
//All the if statement so that if player[1].col>37, move __ that many squares (start at the beginning).
JOptionPane this to the user telling the computer has landed on ___ property.
if (square[player[1].co].owner.equals("User"))
{
JOptionPane to the user telling them that the Com Pewter has landed on their property, and the computer will pay __ much.
JOptionPane telling user amount of money in Gringotts Account
square[player[1].col].turn++;
}
else if (square[player[0].col].owned == false)
{
int y = random number for 10000 numbers.
if ((y%2)==0) Purchase the property - display JOptionPane telling the user Com Pewter has purchased it.
else Don't purchase and display JOptionPane telling user that the Com Pewter didn't purchase it, and that it is the user's turn.
}
else if (they are coordinates for room of requirement)
{
Paste the room of requirement text here - and the computer will randomly decide each yes/no answer.
Print out JOptionPane to tell the user this later.
}
}
Okay, well, this turned into pseudocode, by accident! this can be a planning, thing, but oh well. It was helpful. Anyways, uh, after that, I still have to do the following things:
- User's Manual
- Create JMenu to include about screen (containing who wrote the program, what "version" it is; include instructions (can be the same thing as the manual)
- Ask for User's name and print it out to the frame as "Hello ________" for a try catch statement
- If time permits, print out high scores using file input and file output!
Friday, 31 May 2013
Programming User!
Programming the User Bit is almost done! Just have 3 things left - to keep track of the number of get out of St. Mungo's free cards they have; to control the "houses and hotels" and instead of that - count number of turns; and not let them get out of jail unless they choose to pay 50 galleons or use their free get our of jail card.
Well, I still have the computer part to program, 'course, but littler steps :D
Bug :P
I created a JOptionPane that tells the user that they have landed.
One OptionPane is shown if it is a buyable property - another for Room of Requirement or St. Mungos (the ones that you can't purchase).
But I was testing my program for input, and haha. It asked whether I wanted to PURCHASE room of requirement. Well, something's wrong. LOOL.
I should probably be discouraged that my program is doing that, but imagine if one could purchase Community Chest or Chance! RUBBER DUCK! That can be a twist I make on my own version of monopoly! Imagine that - one person owning all community chests and chances (in this case, Room of Requirement). If something says like, "Gringotts pays 200 galleons to you," instead of coming from Gringotts, it can be from the person who owns Community Chest! But when it's like, "Pay the Gringotts ___" then instead of paying Gringotts, pay the owner!
Thaaat seems a bit challenging for the user though. So maybe not, hee hee.
One OptionPane is shown if it is a buyable property - another for Room of Requirement or St. Mungos (the ones that you can't purchase).
But I was testing my program for input, and haha. It asked whether I wanted to PURCHASE room of requirement. Well, something's wrong. LOOL.
I should probably be discouraged that my program is doing that, but imagine if one could purchase Community Chest or Chance! RUBBER DUCK! That can be a twist I make on my own version of monopoly! Imagine that - one person owning all community chests and chances (in this case, Room of Requirement). If something says like, "Gringotts pays 200 galleons to you," instead of coming from Gringotts, it can be from the person who owns Community Chest! But when it's like, "Pay the Gringotts ___" then instead of paying Gringotts, pay the owner!
Thaaat seems a bit challenging for the user though. So maybe not, hee hee.
Hurray!
Okay, so I haven't told the user exactly where they are in the program yet. But I'm pretty close to doing that, then I can program the computer part. So the cool thing is that now, you can't just buy any property - I've limited them to only being able to purchase the ones that they are located on (and that is with a coordinate on the player's object).
My program is crashing when the column (object variable for user determining where they are in the monopoly) exceeds 37 (understandably).
So I can do a few things - use if statements up until the number 12 and say that if they are located here __, change the value of column to ___. That would require 12 if/else statements.
I tried using a try catch - it didn't really wok that well.
Another thing that I have to add along the bottom is a button saying, "No thank you" or something like that. Or have a JOptionPane pop up asking if the user would like to buy it. Because right now, you can't see where you are - you have to figure out yourself. This is another reason I put buttons along the bottom saying, "Get User Info" , "Roll Die," and "Get Com Pewter Info."
Anyways, going to take a break from Computer Science - be back during the period, LOL. I suppose I could write the user manual on the way to school, on my phone. That works too. And the environmental message!
My program is crashing when the column (object variable for user determining where they are in the monopoly) exceeds 37 (understandably).
So I can do a few things - use if statements up until the number 12 and say that if they are located here __, change the value of column to ___. That would require 12 if/else statements.
I tried using a try catch - it didn't really wok that well.
Another thing that I have to add along the bottom is a button saying, "No thank you" or something like that. Or have a JOptionPane pop up asking if the user would like to buy it. Because right now, you can't see where you are - you have to figure out yourself. This is another reason I put buttons along the bottom saying, "Get User Info" , "Roll Die," and "Get Com Pewter Info."
Anyways, going to take a break from Computer Science - be back during the period, LOL. I suppose I could write the user manual on the way to school, on my phone. That works too. And the environmental message!
Clearing things up
Okay, the thing that's going to kill my program is not remembering that South and West have to be added backwards. In that case...
North:
0 - Start Adventure
1 - Borgin & Burkes
2 - Room of Requirement
3 - Roland Kerr College
4 - Tax
5 - Tardis
6 - Redhaven
7 - Room of Requirement
8 - Piccadilly Circus
9 - St. Mungos
East:
10 - Platform and 9.75
11 - Speedy's Cafe
12 - Avalon
13 - Isengard
14 - Taxi
15 - Grimmauld Place
16 - Room of Requirement
17 - Quidditch
South:
27 - Go to
26 - Ministry of Magic
25 - Beaversdam
24 - Northumberland Street
23 - 221 B Baker Street
22 - Wardrobe
21 - Aslan's Country
20 - Room of Requirement
19 - Hagrid's Hut
18 - Tavern
West:
35 - Hogwarts
34 - Citadel
33 - Room of Requirement
32 - The Ealdor
31 - Hogwarts Express
30 - Room of Requirement
29 - Bagshot Row
28 - Mordor
North:
0 - Start Adventure
1 - Borgin & Burkes
2 - Room of Requirement
3 - Roland Kerr College
4 - Tax
5 - Tardis
6 - Redhaven
7 - Room of Requirement
8 - Piccadilly Circus
9 - St. Mungos
East:
10 - Platform and 9.75
11 - Speedy's Cafe
12 - Avalon
13 - Isengard
14 - Taxi
15 - Grimmauld Place
16 - Room of Requirement
17 - Quidditch
South:
27 - Go to
26 - Ministry of Magic
25 - Beaversdam
24 - Northumberland Street
23 - 221 B Baker Street
22 - Wardrobe
21 - Aslan's Country
20 - Room of Requirement
19 - Hagrid's Hut
18 - Tavern
West:
35 - Hogwarts
34 - Citadel
33 - Room of Requirement
32 - The Ealdor
31 - Hogwarts Express
30 - Room of Requirement
29 - Bagshot Row
28 - Mordor
Redeclaration of Square Objects
HELLO!
So I had to make changes on the one at home because I didn't need the information on houses anymore. I also had to include all the names of the properties to display that to the screen.
//*******************************************************FIRST SIDE******************************
//Start Square:
square[0].owned = true;
square[0].mortgaged = false;
square[0].buy = 0;
square[0].houseHotel = 0;
square[0].turn = 0;
square[0].payOut = 200;
square[0].rent = 0;
square[0].number = 0;
square[0].name = "Start Adventure";
//Borgin and Burkes:
square [1].owned = false;
square [1].mortgaged = false;
square [1].buy = 60;
square [1].houseHotel = 0;
square [1].turn = 0;
square [1].payOut = 0;
square [1].rent = 20;
//square [1].houseRent = houses*(square[1].houseHotel);
square [1].number = 0;
square[1].name = "Borgin and Burkes";
//Room of Requirement/Pick up a RoR Card:
square [2].owned = true;
square [2].mortgaged = false;
square [2].buy = 0;
square [2].houseHotel = 0;
square [2].turn = 0;
square [2].payOut = 0;
square [2].rent = 0;
//square [2].houseRent = houses*(square[2].houseHotel);
square [2].number = 0;
square[2].name = "Room of Requirement";
//Roland Kerr College:
square [3].owned = false;
square [3].mortgaged = false;
square [3].buy = 60;
square [3].houseHotel = 0;
square [3].turn = 0;
square [3].payOut = 0;
square [3].rent = 20;
//square [3].houseRent = houses*(square[3].houseHotel);
square [3].number = 0;
square[3].name = "Roland Kerr College";
//Camelot Annual Tax:
square [4].owned = true;
square [4].mortgaged = false;
square [4].buy = 0;
square [4].houseHotel = 0;
square [4].turn = 0;
square [4].payOut = 0;
square [4].rent = 200;
//square [4].houseRent = houses*(square[4].houseHotel);
square [4].number = 0;
square[4].name = "Camelot's Annual Tax";
//Tardis
square [5].owned = false;
square [5].mortgaged = false;
square [5].buy = 200;
square [5].houseHotel = 0;
square [5].turn = 0;
square [5].payOut = 0;
square [5].rent = 25;
//square [5].houseRent = houses*(square[5].houseHotel);
square [5].number = 0;
square[5].name = "Tardis";
//Redhaven Property
square [6].owned = false;
square [6].mortgaged = false;
square [6].buy = 100;
square [6].houseHotel = 0;
square [6].turn = 0;
square [6].payOut = 0;
square [6].rent = 80;
// square [6].houseRent = houses*(square[6].houseHotel);
square [6].number = 0;
square [6].name = "Redhaven";
//Room of Requirement/Pick up a RoR Card:
square [7].owned = true;
square [7].mortgaged = false;
square [7].buy = 0;
square [7].houseHotel = 0;
square [7].turn = 0;
square [7].payOut = 0;
square [7].rent = 0;
// square [7].houseRent = houses*(square[7].houseHotel);
square [7].number = 0;
square[7].name = "Room of Requirement";
//Piccadilly Circus
square [8].owned = false;
square [8].mortgaged = false;
square [8].buy = 100;
square [8].houseHotel = 0;
square [8].turn = 0;
square [8].payOut = 0;
square [8].rent = 60;
//square [8].houseRent = houses*(square[8].houseHotel);
square [8].number = 0;
square[8].name = "Piccadilly Circus";
//**********************************************************************Start of New Side*******************************************
//St Mungo
square [9].owned = true;
square [9].mortgaged = false;
square [9].buy = 0;
square [9].houseHotel = 0;
square [9].turn = 0;
square [9].payOut = 0;
square [9].rent = 0;
//square [9].houseRent = houses*(square[9].houseHotel);
square [9].number = 0;
square [9].name = "St. Mungo's";
//Platform 9 and 3/4 Quarters.
square [10].owned = false;
square [10].mortgaged = false;
square [10].buy = 120;
square [10].houseHotel = 0;
square [10].turn = 0;
square [10].payOut = 0;
square [10].rent = 60;
//square [10].houseRent = houses*(square[10].houseHotel);
square [10].number = 0;
square[10].name = "Platform 9 and 3 Quarters";
//Speedy's Cafe in Sherlock
square [11].owned = false;
square [11].mortgaged = false;
square [11].buy = 140;
square [11].houseHotel = 0;
square [11].turn = 0;
square [11].payOut = 0;
square [11].rent = 65;
//square [11].houseRent = houses*(square[11].houseHotel);
square [11].number = 0;
square [11].name = "Speedy's Cafe";
//Lake of Avalon
square [12].owned = false;
square [12].mortgaged = false;
square [12].buy = 150;
square [12].houseHotel = 0;
square [12].turn = 0;
square [12].payOut = 0;
square [12].rent = (2*(die1+die2));
//square [12].houseRent = houses*(square[12].houseHotel);
square [12].number = 0;
square[12].name = "Lake of Avalon";
//Isengard
square [13].owned = false;
square [13].mortgaged = false;
square [13].buy = 140;
square [13].houseHotel = 0;
square [13].turn = 0;
square [13].payOut = 0;
square [13].rent = 70;
// square [13].houseRent = houses*(square[13].houseHotel);
square [13].number = 0;
square [13].name = "Isengard";
//Taxi:
square [14].owned = false;
square [14].mortgaged = false;
square [14].buy = 200;
square [14].houseHotel = 0;
square [14].turn = 0;
square [14].payOut = 0;
square [14].rent = 25;
//square [14].houseRent = houses*(square[14].houseHotel);
square [14].number = 0;
square [14].name = "Take a Taxi";
//Grimmauld Place:
square [15].owned = false;
square [15].mortgaged = false;
square [15].buy = 160;
square [15].houseHotel = 0;
square [15].turn = 0;
square [15].payOut = 0;
square [15].rent = 50;
//square [15].houseRent = houses*(square[15].houseHotel);
square [15].number = 0;
square [15].name = "Grimmauld Place";
//Room of Requirement/Pick up a RoR Card:
square [16].owned = true;
square [16].mortgaged = false;
square [16].buy = 0;
square [16].houseHotel = 0;
square [16].turn = 0;
square [16].payOut = 0;
square [16].rent = 0;
//square [16].houseRent = houses*(square[16].houseHotel);
square [16].number = 0;
square [16].name = "Room of Requirement";
//Quidditch Pitch
square [17].owned = false;
square [17].mortgaged = false;
square [17].buy = 180;
square [17].houseHotel = 0;
square [17].turn = 0;
square [17].payOut = 0;
square [17].rent = 70;
//square [17].houseRent = houses*(square[17].houseHotel);
square [17].number = 0;
square [17].name = "Quidditch Pitch";
//**********************************************START OF NEW SIDE****************************************************
//The Tavern (Free Parking)
square [18].owned = true;
square [18].mortgaged = false;
square [18].buy = 0;
square [18].houseHotel = 0;
square [18].turn = 0;
square [18].payOut = pot;
square [18].rent = 0;
//square [18].houseRent = houses*(square[18].houseHotel);
square [18].number = 0;
square [18].name = "Rising Sun: The Tavern";
//Hagrid's Hut
square [19].owned = false;
square [19].mortgaged = false;
square [19].buy = 220;
square [19].houseHotel = 0;
square [19].turn = 0;
square [19].payOut = 0;
square [19].rent = 75;
//square [19].houseRent = houses*(square[19].houseHotel);
square [19].number = 0;
square [19].name = "Hagrid's Hut";
//Room of Requirement/Pick up a RoR Card:
square [20].owned = true;
square [20].mortgaged = false;
square [20].buy = 0;
square [20].houseHotel = 0;
square [20].turn = 0;
square [20].payOut = 0;
square [20].rent = 0;
//square [20].houseRent = houses*(square[20].houseHotel);
square [20].number = 0;
square[20].name = "Room of Requirement";
//Aslan's Country
square [21].owned = false;
square [21].mortgaged = false;
square [21].buy = 220;
square [21].houseHotel = 0;
square [21].turn = 0;
square [21].payOut = 0;
square [21].rent = 75;
//square [21].houseRent = houses*(square[21].houseHotel);
square [21].number = 0;
square [21].name = "Aslan's Country";
//Enter Wardrobe
square [22].owned = false;
square [22].mortgaged = false;
square [22].buy = 200;
square [22].houseHotel = 0;
square [22].turn = 0;
square [22].payOut = 0;
square [22].rent = 25;
//square [22].houseRent = houses*(square[22].houseHotel);
square [22].number = 0;
square [22].name = "Enter the Wardrobe";
//221 Baker Street
square [23].owned = false;
square [23].mortgaged = false;
square [23].buy = 240;
square [23].houseHotel = 0;
square [23].turn = 0;
square [23].payOut = 0;
square [23].rent = 75;
//square [23].houseRent = houses*(square[23].houseHotel);
square [23].number = 0;
square [23].name = "221 B Baker Street";
//Northumberland Street
square [24].owned = false;
square [24].mortgaged = false;
square [24].buy = 260;
square [24].houseHotel = 0;
square [24].turn = 0;
square [24].payOut = 0;
square [24].rent = 70;
//square [24].houseRent = houses*(square[24].houseHotel);
square [24].number = 0;
square [24].name = "Northumberland Street";
//Beaversdam
square [25].owned = false;
square [25].mortgaged = false;
square [25].buy = 250;
square [25].houseHotel = 0;
square [25].turn = 0;
square [25].payOut = 0;
square [25].rent = 2*(die1+die2);
//square [25].houseRent = houses*(square[25].houseHotel);
square [25].number = 0;
square [25].name = "Beaversdam";
//Ministry of Magic
square [26].owned = false;
square [26].mortgaged = false;
square [26].buy = 280;
square [26].houseHotel = 0;
square [26].turn = 0;
square [26].payOut = 0;
square [26].rent = 75;
//square [26].houseRent = houses*(square[26].houseHotel);
square [26].number = 0;
square [26].name = "Ministry of Magic";
//********************************************************LAST LINE***************************************************
//Go to Jail.
square [27].owned = true;
square [27].mortgaged = false;
square [27].buy = 0;
square [27].houseHotel = 0;
square [27].turn = 0;
square [27].payOut = 0;
square [27].rent = 0;
//square [27].houseRent = 0;
square [27].number = 0;
square [27].name = "Go to St. Mungos";
//Mordor
square [28].owned = false;
square [28].mortgaged = false;
square [28].buy = 300;
square [28].houseHotel = 0;
square [28].turn = 0;
square [28].payOut = 0;
square [28].rent = 80;
//square [28].houseRent = houses*(square[28].houseHotel);
square [28].number = 0;
square [28].name = "Mordor";
//Bagshot Row
square [29].owned = false;
square [29].mortgaged = false;
square [29].buy = 300;
square [29].houseHotel = 0;
square [29].turn = 0;
square [29].payOut = 0;
square [29].rent = 80;
//square [29].houseRent = houses*(square[29].houseHotel);
square [29].number = 0;
square [29].name = "Bagshot Row";
//Room of Requirement
square [30].owned = true;
square [30].mortgaged = false;
square [30].buy = 0;
square [30].houseHotel = 0;
square [30].turn = 0;
square [30].payOut = 0;
square [30].rent = 0;
//square [30].houseRent = houses*(square[30].houseHotel);
square [30].number = 0;
square [30].name = "Room of Requirement";
//Hogwarts Express
square [31].owned = false;
square [31].mortgaged = false;
square [31].buy = 200;
square [31].houseHotel = 0;
square [31].turn = 0;
square [31].payOut = 0;
square [31].rent = 25;
//square [31].houseRent = houses*(square[31].houseHotel);
square [31].number = 0;
square [31].name = "Hogwarts Express";
//Ealdor
square [32].owned = false;
square [32].mortgaged = false;
square [32].buy = 320;
square [32].houseHotel = 0;
square [32].turn = 0;
square [32].payOut = 0;
square [32].rent = 85;
//square [32].houseRent = houses*(square[32].houseHotel);
square [32].number = 0;
square [32].name = "The Ealdor";
//Room of Requirement
square [33].owned = true;
square [33].mortgaged = false;
square [33].buy = 0;
square [33].houseHotel = 0;
square [33].turn = 0;
square [33].payOut = 0;
square [33].rent = 0;
//square [33].houseRent = houses*(square[33].houseHotel);
square [33].number = 0;
square [33].name = "Room of Requirement";
//Camelot's Citadel
square [34].owned = false;
square [34].mortgaged = false;
square [34].buy = 350;
square [34].houseHotel = 0;
square [34].turn = 0;
square [34].payOut = 0;
square [34].rent = 100;
// square [34].houseRent = houses*(square[34].houseHotel);
square [34].number = 0;
square [34].name = "Camelot's Citadel";
//Hogwarts
square [35].owned = false;
square [35].mortgaged = false;
square [35].buy = 400;
square [35].houseHotel = 0;
square [35].turn = 0;
square [35].payOut = 0;
square [35].rent = 100;
//square [35].houseRent = houses*(square[35].houseHotel);
square [35].number = 0;
square [35].name = "Hogwarts";
Subscribe to:
Posts (Atom)