Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jcj26 srt15 as577 #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
74 changes: 51 additions & 23 deletions DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,69 @@ CompSci 308 : RPS Design
Initial Design
=======

###Class 1

* Bullets are made with asterisks

1. You can also order things with numbers


###Class 2

###GameWorld
'''java
private void loadUI()
private void startGame()
private Map<Weapon, Collection<Weapon>> loadWeaponsData(File weaponData)
private void printAndUpdateResults(Player player1, Player player2)
private void newRound()
private void endGame()
private void reset()
private Weapon chooseWeapon()
private void showWinner(Player player1, Player player2);
'''
* loadUI() is responsible for generating the user interface for the game.
* loadWeaponsData(File weaponData) is responsible for reading a file of weapons and creating a map with relationships between weapons in the form of a Map.
* startGame() is responsible for instantiating Players (setting their scores and other stats to zero).
* printAndUpdateResults(Player player1, Player player2) is responsible for displaying the results between two players and updating their scores.
* newRound() clears the weapon choices of players.
* endGame() stops the UI running.
* reset() reinitializes scores and weapon choices for players (restarts the game without closing the UI).


###Weapon
'''java
public Weapon(String name, Collection<Weapon> listOfCanBeat)
public int compareTo(Weapon other)
'''
* Weapon(String name, Collection<String> listOfCanBeat) is a constructor that initializes a weapon with a name and the list of other weapons it can beat.
* compareTo(String other) determines whether two weapons are the same or who beats who.

###Player
'''java
public Player(int score)
public Weapon getWeapon();
public void addScore(int score);
'''
* Player(int score) is a constructor initializes with a score


CRC Design
=======

###Class 1


###Class 2

You can add images as well:

![This is cool, too bad you can't see it](crc-example.png "Our CRC cards")

![This is cool, too bad you can't see it](IMG_9844.JPG "Our CRC cards")
![This is cool, too bad you can't see it](IMG_9845.JPG "Our CRC cards")
![This is cool, too bad you can't see it](IMG_9846.JPG "Our CRC cards")

Use Cases
=======

You can put blocks of code in here like this:
```java
public int getTotal (Collection<Integer> data) {
int total = 0;
for (int d : data) {
total += d;
}
return total;
Player p1 = new Player(0);
Player p2 = new Player(0);
startRound();
int win = p1.getWeapon().compareTo(p2.getWeapon());
if (win == 1) {
p1.addScore(1);
} else if (win == -1){
p2.addScore(1);
}
showWinner(p1, p2);
}
```

''

Binary file added IMG_9844.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added IMG_9845.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added IMG_9846.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions build.fxbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="ASCII"?>
<anttasks:AntTask xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:anttasks="http://org.eclipse.fx.ide.jdt/1.0" buildDirectory="${project}/build">
<deploy>
<application name="lab_rps"/>
<info/>
</deploy>
<signjar/>
</anttasks:AntTask>
26 changes: 26 additions & 0 deletions src/application/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package application;

import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;


public class Main extends Application {
@Override
public void start(Stage primaryStage) {
try {
BorderPane root = new BorderPane();
Scene scene = new Scene(root,400,400);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}

public static void main(String[] args) {
launch(args);
}
}
1 change: 1 addition & 0 deletions src/application/application.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */