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

RPS Design (bjk20, plg5, bcw22, jtb43) #18

Open
wants to merge 5 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
6 changes: 6 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?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="output" path="bin"/>
</classpath>
96 changes: 72 additions & 24 deletions DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,92 @@ CompSci 308 : RPS Design
> This is the link to the Lab Description:
[Lab - RPS](http://www.cs.duke.edu/courses/compsci308/spring16/classwork/02_design_rps/index.php)

Initial Design
=======
#Design
####By Blake Kaplan (bjk20), Patrick Grady (plg5), Bobby Wang (bcw22), and Justin Bergkamp (jtb43)

###Class 1
###Class: Weapon

* Bullets are made with asterisks
* A class that can be instantiated for any weapon based on what is fed into the constructor

1. You can also order things with numbers


###Class 2
Methods:
```java
//Used for updating the inter-weapon game dynamics
public void addBeats(Weapon beatWeapon)

//Determines the result when two weapons are played against each other
public boolean doesBeat(Weapon otherWeapon)
```
Instance Variables:
`List<Weapon> beats`


CRC Design
=======
###Class: Player

###Class 1
* Represents each game player
* Will be able to determine which weapon it would like to throw

Methods:
```java
//Generates a Weapon that the user throws
public Weapon pickWeapon()

###Class 2
//Gets the players current score
public int getScore()

You can add images as well:
//Returns a boolean expressing whether or not the player beats the given other player
public boolean doesBeat(Player otherPlayer)

![This is cool, too bad you can't see it](crc-example.png "Our CRC cards")
//Returns the player's current played weapon
public Weapon getCurrentWeapon()

//Changes the player's score
public void setScore(int score)
```
Instance Variables:
`Weapon currentWeapon`
`int myScore`
`List<Weapon> priorThrows`

Use Cases
=======
###Class: Game
* The central game class
* Will have to have an initialization method(s) where it properly configures which weapons beat which other weapons

You can put blocks of code in here like this:
Methods:
```java
public int getTotal (Collection<Integer> data) {
int total = 0;
for (int d : data) {
total += d;
}
return total;
}
//Starts the game and generates the GUI
public void start()

//Adds a new weapon to the game
public void addWeapon(Weapon newWeapon)
```

Instance Variables:
`int roundsElapsed`
`List<Player> players`
`List<Weapon> weapons`

#Use Cases

A new game is started with two players, their scores are reset to 0.

`Game.begin();`

A player chooses his RPS "weapon" with which he wants to play for this round.

`Player.pickWeapon();`

Given two players' choices, one player wins the round, and their scores are updated.

`Player.doesBeat(Player otherPlayer);`

A new choice is added to an existing game and its relationship to all the other choices is updated.

`Game.addWeapon(Weapon newWeapon);`

A new game is added to the system, with its own relationships for its all its "weapons".

`Game.begin();`

#CRC Cards

![Our Design CRC Cards](crc-cards.jpg "Our CRC cards")
Binary file added crc-cards.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.