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

akt16, aaa53, dm269 #22

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
121 changes: 78 additions & 43 deletions DESIGN.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,82 @@
CompSci 308 : RPS Design
**lab_rps**
===================

> This is the link to the Lab Description:
[Lab - RPS](http://www.cs.duke.edu/courses/compsci308/spring16/classwork/02_design_rps/index.php)
akt16, dm269, aaa53
Annie Tang, Jonathan Ma, Aamir Azhar

**Cases:**
- A new game is started with two players, their scores are reset to 0.
>readGame("datafile1");
>Player A = new Player();
>Player B = new Player();
>A.setScore(0);
>B.setScore(0);

- A player chooses his RPS "weapon" with which he wants to play for this round.
>A.getPlayerWeapon();

- Given two players' choices, one player wins the round, and their scores are updated.
>if(getWinner(A, B) == 1){
> A.setScore(A.getScore() + 1);
>}
>else if(getWinner(A, B) == -1){
> B.setScore(B.getScore() + 1);
>}

- A new choice is added to an existing game and its relationship to all the other choices is updated.
>readNewWeapon();
- A new game is added to the system, with its own relationships for its all its "weapons".
>readGame("datafile2");



Classes
-------------

MainRPS
> **public void readGame(String textfile)**
> Input: new game data added to system
> Output: void
> Can read in new game here and turn each weapon & relationship within this game to Weapon objects,
>
> **public int getWinner**
> Input: two players; ex: getWinner(A,B)
> Output: 1/-1/0, where 1 means A wins, -1 means B wins, 0 is tie.
> calls compareTo method on weapons of player A and B
> two weapons, from getPlayerWeapon
>
>**public void readNewWeapon**
>Input: new weapon choice data
>Output: none, just creates a Weapon option

Weapon
> **Input:** interactions
> **Output:** usable Weapon object
>
>**public void init**
> Input: interactions
> Output: no return, but creates collection structure
> method to create collection structure from interactions (possibly ArrayList of ArrayLists, i.e. matrix implementation)
>
>**public int compareTo**
> Input: "this" and another weapon
> Output: returns 1/-1 based on which weapon wins, 0 is tie

Player
> **Input:** none, i.e. Player A = new Player();
> **Output:** a player
>
> **public int getScore**
> Input: none
> Output: score of player
>
> **public Weapon getPlayerWeapon**
> Input: no parameters
> Output: player's choice of weapon, is stored in Player class
> user input here
>
>**public void setScore**
>Input: int
>Output: void

Initial Design
=======

###Class 1

* Bullets are made with asterisks

1. You can also order things with numbers


###Class 2



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")


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;
}
```

84 changes: 82 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,82 @@
# lab_rps
Duke CompSci 308 Lab : Design for the game Rock-Paper-Scissors
**lab_rps**
===================

akt16, dm269, aaa53
Annie Tang, Jonathan Ma, Aamir Azhar

**Cases:**
- A new game is started with two players, their scores are reset to 0.
>readGame("datafile1");
>Player A = new Player();
>Player B = new Player();
>A.setScore(0);
>B.setScore(0);

- A player chooses his RPS "weapon" with which he wants to play for this round.
>A.getPlayerWeapon();

- Given two players' choices, one player wins the round, and their scores are updated.
>if(getWinner(A, B) == 1){
> A.setScore(A.getScore() + 1);
>}
>else if(getWinner(A, B) == -1){
> B.setScore(B.getScore() + 1);
>}

- A new choice is added to an existing game and its relationship to all the other choices is updated.
>readNewWeapon();
- A new game is added to the system, with its own relationships for its all its "weapons".
>readGame("datafile2");



Classes
-------------

MainRPS
> **public void readGame(String textfile)**
> Input: new game data added to system
> Output: void
> Can read in new game here and turn each weapon & relationship within this game to Weapon objects,
>
> **public int getWinner**
> Input: two players; ex: getWinner(A,B)
> Output: 1/-1/0, where 1 means A wins, -1 means B wins, 0 is tie.
> calls compareTo method on weapons of player A and B
> two weapons, from getPlayerWeapon
>
>**public void readNewWeapon**
>Input: new weapon choice data
>Output: none, just creates a Weapon option

Weapon
> **Input:** interactions
> **Output:** usable Weapon object
>
>**public void init**
> Input: interactions
> Output: no return, but creates collection structure
> method to create collection structure from interactions (possibly ArrayList of ArrayLists, i.e. matrix implementation)
>
>**public int compareTo**
> Input: "this" and another weapon
> Output: returns 1/-1 based on which weapon wins, 0 is tie

Player
> **Input:** none, i.e. Player A = new Player();
> **Output:** a player
>
> **public int getScore**
> Input: none
> Output: score of player
>
> **public Weapon getPlayerWeapon**
> Input: no parameters
> Output: player's choice of weapon, is stored in Player class
> user input here
>
>**public void setScore**
>Input: int
>Output: void