5 Commits
4.0 ... 4.1

Author SHA1 Message Date
Vikramb987
49a62c4a4d Update TaipanShopLogic.java
little fix
2019-04-12 09:06:08 -06:00
Vikramb987
f0416db9c2 Update README.md
fixed formatting
2019-04-12 08:59:41 -06:00
Vikramb987
2d4a1add07 Update README.md
fixed some things + added windows instructions as well
2019-04-12 08:56:21 -06:00
Vikramb987
984beaabf9 Update TaipanShopGUI.java
minor formatting
2019-04-12 08:42:15 -06:00
Vikramb987
b697978614 Update TaipanShopGUI.java
removed the comment "//quitButton.setDefaultButton(true);", not sure who commented that in but doesn't seem necessary
2019-04-12 08:41:35 -06:00
3 changed files with 20 additions and 10 deletions

View File

@@ -10,27 +10,39 @@ Then, run MainGUI.java.
# To play the game # To play the game
If you are using the command line, extract "TaipanClone-master.zip", and open the "TaipanClone-master" folder. Open your terminal and change its directory to the "src" folder within "TaipanClone-master" folder. If you are using the command line, extract "TaipanClone-master.zip", and open the "TaipanClone-master" folder. Open your terminal and change its directory to the "src" folder within "TaipanClone-master" folder.
Then, type in Then, if you are using Linux, type in
``` ```
"javac -cp .:junit-4.12.jar:hamcrest-core-1.3.jar:jfxrt.jar gui/*.java text/*.java logic/*.java tests/*.java" "javac -cp .:junit-4.12.jar:hamcrest-core-1.3.jar:jfxrt.jar gui/*.java text/*.java logic/*.java tests/*.java"
``` ```
Otherwise, if you are using Windows, type in
```
"javac -cp .;junit-4.12.jar;hamcrest-core-1.3.jar;jfxrt.jar gui/*.java text/*.java logic/*.java tests/*.java"
```
This compiles all the necessary files. Now, to play the GUI version run MainGUI.java using This compiles all the necessary files. Now, to play the GUI version run MainGUI.java using
``` ```
java gui.MainGUI java gui.MainGUI
``` ```
To play the command-line version run To play the text-based version run MainText.java using
``` ```
java gui.MainText java text.MainText
``` ```
# To run the test file PlayerTest.java, type in # To run the test file PlayerTest.java for Linux type in:
``` ```
javac -cp .:junit-4.12.jar:hamcrest-core-1.3.jar:jfxrt.jar gui/*.java text/*.java logic/*.java tests/*.java javac -cp .:junit-4.12.jar:hamcrest-core-1.3.jar:jfxrt.jar gui/*.java text/*.java logic/*.java tests/*.java
``` ```
This compiles all the necessary files. Now, run PlayerTest.java using This compiles all the necessary files. Now, run PlayerTest.java by typing in
``` ```
java -cp .:junit-4.12.jar:hamcrest-core-1.3.jar org.junit.runner.JUnitCore tests.PlayerTest java -cp .:junit-4.12.jar:hamcrest-core-1.3.jar org.junit.runner.JUnitCore tests.PlayerTest
``` ```
# To run the test file PlayerTest.java for Windows, type in:
```
javac -cp .;junit-4.12.jar;hamcrest-core-1.3.jar;jfxrt.jar gui/*.java text/*.java logic/*.java tests/*.java
```
This compiles all the necessary files. Now, run PlayerTest.java by typing in
```
java -cp .;junit-4.12.jar;hamcrest-core-1.3.jar org.junit.runner.JUnitCore tests.PlayerTest
```
Additional information: Additional information:
You lose if your HP reaches 0. You can win if you "retire" in Hong Kong while having a net worth of over $1 million. You lose if your HP reaches 0. You can win if you "retire" in Hong Kong while having a net worth of over $1 million.

View File

@@ -1,8 +1,9 @@
package gui; /** /**
* TaipanShopGUI deals with setting the stage for shop. * TaipanShopGUI deals with setting the stage for shop.
* *
* Author: Vikram Bawa * Author: Vikram Bawa
*/ */
package gui;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.event.EventHandler; import javafx.event.EventHandler;
import javafx.geometry.Insets; import javafx.geometry.Insets;
@@ -115,7 +116,6 @@ public class TaipanShopGUI extends Player {
loanButton.setVisible(false); loanButton.setVisible(false);
armsButton.setVisible(false); armsButton.setVisible(false);
quitButton.setVisible(true); quitButton.setVisible(true);
//quitButton.setDefaultButton(true);
opiumButton.setVisible(false); opiumButton.setVisible(false);
silkButton.setVisible(false); silkButton.setVisible(false);
numberInput.setVisible(false); numberInput.setVisible(false);
@@ -129,7 +129,6 @@ public class TaipanShopGUI extends Player {
cargoButton.setVisible(true); cargoButton.setVisible(true);
loanButton.setVisible(true); loanButton.setVisible(true);
quitButton.setVisible(true); quitButton.setVisible(true);
//quitButton.setDefaultButton(true);
opiumButton.setVisible(false); opiumButton.setVisible(false);
silkButton.setVisible(false); silkButton.setVisible(false);
numberInput.setVisible(false); numberInput.setVisible(false);
@@ -144,7 +143,6 @@ public class TaipanShopGUI extends Player {
loanButton.setVisible(true); loanButton.setVisible(true);
numberInput.setVisible(false); numberInput.setVisible(false);
quitButton.setVisible(true); quitButton.setVisible(true);
//quitButton.setDefaultButton(true);
opiumButton.setVisible(false); opiumButton.setVisible(false);
silkButton.setVisible(false); silkButton.setVisible(false);
generalButton.setVisible(false); generalButton.setVisible(false);

View File

@@ -24,7 +24,7 @@ public class TaipanShopLogic extends Player {
public String updatePrices() { public String updatePrices() {
String s = "\t" + getName() + ", the price of "; String s = "\t" + getName() + ", the price of ";
String a = ""; String a = "";
double value = 0 * Math.random(); double value = 80 * Math.random();
Random rand = new Random(); Random rand = new Random();
setOpiumPrice((rand.nextInt(201) + 60) * 100); setOpiumPrice((rand.nextInt(201) + 60) * 100);
setSilkPrice((rand.nextInt(201) + 60) * 10); setSilkPrice((rand.nextInt(201) + 60) * 10);