Skip to content
Open
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
92 changes: 68 additions & 24 deletions DESIGN.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,57 @@
CompSci 308 : RPS Design
NetIDs: smk44, abz3, at200, rss44
===================

> 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
=======

###Class 1

* Bullets are made with asterisks

1. You can also order things with numbers


###Class 2


##Initial Design

### Main class
* instantiates instance of a game and launches the game

### Game class
* constructor will load file and populate hash maps
* variables:
* private Map\<String, Set\<String\>\> weaponBeats;
* private Map\<String, Set\<String\>\> weaponLosesTo;
* private User myUser;
* private final AI myAI;
* private Timer myTurnTimer;
* methods:
* public void init(); call loadWeaponInfo, create player, create AI, prompt user for choice, scheduleTurnTimer
* private void loadWeaponInfo(textfile text); parses text file with weapon info and populates the hashmaps weaponBeats and weaponLosesTo
* private void createPlayers(); creates user object and AI object
* public void updateAI(); update myAI's UsersPastMoves structure
* scheduleTurnTimer(); schedules the turn timer, once timer expires have both players' choices show, then schedule new timer and prompt user for choice

### AI class

* private List<String> usersPastMoves;
* chooseMove(); algorithm to choose weapon based on usersPastMoves
* updateData(String move); updates data structure storing data regarding player's previous moves

CRC Design
=======

###Class 1


###Class 2
###public class Main
* void start()

###AI class
* private List<String>
* public void chooseMove()
* public void updateData(String Move)
###Game class
* private void init()
* private void loadWeaponInfo
* private void createPlayer()
* public void updateUI()
* private void scheduleTimeTurner()
* private final Map\<String, Set\<String\>\> weaponBeats
* private final Map\<String, Set\<String\>\> loseTo
* private user myUser
* private final AI myAI
* prvate Timer myTurnTimer

You can add images as well:

Expand All @@ -34,14 +61,31 @@ You can add images as well:
Use Cases
=======

You can put blocks of code in here like this:
Used Raghav, Austin, Frank's group's CRC cards (atw15):

```java
public int getTotal (Collection<Integer> data) {
int total = 0;
for (int d : data) {
total += d;
}
return total;
public class Game {
private final Player player1;
private final Player player2;
private boolean stillGame = true;
Game(String name1, String name2) {
player1 = new Player();
player2 = new Player();
player1.setName(name1);
player2.setName(name2);
player1.setWins(0);
player2.setWins(0);
while (stillGame) {
playRound();
}
}

private void playRound() {
// code code code

}

}
}
```