-
Notifications
You must be signed in to change notification settings - Fork 14
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
help, lost! #4
Open
ztmurphy21
wants to merge
8
commits into
WCCCEDU:master
Choose a base branch
from
ztmurphy21:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
help, lost! #4
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3378fa5
help, lost!
4a6e9d7
a little bit of progress. i think..
19ad814
making some progress, but still error message
b53fe68
debug
b98702b
now outputing the file
16f123c
starting to tokenize
2ca5a26
another try
a99bec9
removing the #### from the file
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
compile.on.save=true | ||
user.properties.file=/Users/samuraipanzer/Library/Application Support/NetBeans/8.0.2/build.properties | ||
user.properties.file=C:\\Users\\Zachary\\AppData\\Roaming\\NetBeans\\8.0.2\\build.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1"> | ||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> | ||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> | ||
<group> | ||
<file>file:/C:/Users/Zachary/Documents/GitHub/CPT-163-27-F2015-Assignment-9-Files-Strings/src/dnddiceroller/Die.java</file> | ||
<file>file:/C:/Users/Zachary/Documents/GitHub/CPT-163-27-F2015-Assignment-9-Files-Strings/src/assignment/pkg9/DiceReaderTest.java</file> | ||
<file>file:/C:/Users/Zachary/Documents/GitHub/CPT-163-27-F2015-Assignment-9-Files-Strings/src/dnddiceroller/DnDDiceRoller.java</file> | ||
<file>file:/C:/Users/Zachary/Documents/GitHub/CPT-163-27-F2015-Assignment-9-Files-Strings/src/assignment/pkg9/DiceFileReader.java</file> | ||
<file>file:/C:/Users/Zachary/Documents/GitHub/CPT-163-27-F2015-Assignment-9-Files-Strings/src/dnddiceroller/Load.java</file> | ||
<file>file:/C:/Users/Zachary/Documents/GitHub/CPT-163-27-F2015-Assignment-9-Files-Strings/src/dnddiceroller/DiceTower.java</file> | ||
<file>file:/C:/Users/Zachary/Documents/GitHub/CPT-163-27-F2015-Assignment-9-Files-Strings/src/dnddiceroller/Fudge.java</file> | ||
<file>file:/C:/Users/Zachary/Documents/GitHub/CPT-163-27-F2015-Assignment-9-Files-Strings/src/dnddiceroller/NumberedDie.java</file> | ||
</group> | ||
</open-files> | ||
</project-private> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package dnddiceroller; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.io.*; | ||
import java.util.Scanner; | ||
|
||
/** | ||
* Dice Tower. | ||
* A Dice Tower is a tool used by serious gamers use to roll many dice at once. | ||
* It looks like this https://www.miniaturescenery.com/Images/PortableDiceTowerLarge.jpg | ||
* An instance of a dice tower is defined by the number panels it contains to help | ||
* provide a more regular distribution of die values. The die bounce from panel to | ||
* panel until they exit the dice tower at the bottom tray. | ||
* A dice tower will accept a collection of dice and reports their results when | ||
* they reach the tray at the bottom | ||
* @author Paul Scarrone | ||
*/ | ||
public class DiceTower { | ||
final int PANEL_COUNT = 3; | ||
private int trayValue; | ||
private List<Die> dice; | ||
|
||
public DiceTower(int trayValue, List<Die> dice) { | ||
this.trayValue = trayValue; | ||
this.dice = dice; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
//for loop in this | ||
public void dropDice(){ | ||
for(int i=0; i<this.dice.size();i++){ | ||
this.dice.get(i).rollDice(); | ||
} | ||
|
||
} | ||
|
||
//consturctor for variables out of array list function | ||
public DiceTower(List dice) { | ||
this.dice=dice; | ||
|
||
} | ||
|
||
|
||
//this will retunr the value of trayValue | ||
public int getTrayValue(){ | ||
return trayValue; | ||
} | ||
|
||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package dnddiceroller; | ||
|
||
import java.io.*; | ||
import java.util.Scanner; | ||
|
||
/** | ||
* A Die is a many sided object that when rolled provides a random value from | ||
* 1 through the number of sides on the object. Some dice are 6 sided and have | ||
* the numbers 1-6 on them. Some dice are 20 sided with the numbers 1-20 on them. | ||
* Others are called fudge dice and have the values of -1 0 or +1 | ||
* @author Paul Scarrone | ||
*/ | ||
public interface Die { | ||
|
||
public int rollDice(); //variable for rolling | ||
public int getValue(); //to get value from | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package dnddiceroller; | ||
|
||
import assignment.pkg9.DiceFileReader; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.io.*; | ||
import java.util.Scanner; | ||
import java.util.StringTokenizer; | ||
|
||
/** | ||
* | ||
* @author Paul Scarrone | ||
*/ | ||
public class DnDDiceRoller { | ||
|
||
/** | ||
* Try out your dies and dice tower | ||
* @param args the command line arguments | ||
*/ | ||
public static void main(String[] args) throws FileNotFoundException { | ||
for(int i = 0; i< 1000; i++){ | ||
int d6 = test_oneD6(); | ||
if(d6 != -1){ | ||
System.out.println("Die Test Failed with Value: " + d6); | ||
} | ||
int tower = test_diceTowerWithTwoD6(); | ||
if(tower != -1){ | ||
System.out.println("Tower Test Failed with Value: " + tower); | ||
} | ||
DiceFileReader diceReader = diceReader = new DiceFileReader("./dice.txt"); | ||
} | ||
Scanner scanner = null; | ||
ArrayList<String> list = new ArrayList<String>(); | ||
File temp = new File ("dice.txt"); | ||
Scanner file = new Scanner (temp); | ||
String s = scanner.nextLine(); | ||
|
||
String lineToRemove="#"; | ||
String currentLine; | ||
|
||
|
||
while(file.hasNext()){ | ||
s = scanner.nextLine(); | ||
String[] tempList=s.split(" "); | ||
String title = tempList[0]; | ||
String type = tempList[1].substring(1); | ||
list.add(title); | ||
} | ||
while(file.hasNext()){ | ||
s=scanner.nextLine(); | ||
String[] tempList=s.split(":"); | ||
String title=tempList[0]; | ||
String type=tempList[1].substring(1); | ||
list.add(title); | ||
|
||
} | ||
|
||
System.out.println(s); | ||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
public static int test_oneD6(){ | ||
NumberedDie die = new NumberedDie(6); | ||
die.rollDice();//method | ||
int dieValue = die.getvalueOfDie(); | ||
if(dieValue >= 1 && dieValue <= 6){ | ||
return -1; // Means the die value is outside its bounds for a d6 | ||
}else{ | ||
return dieValue; | ||
} | ||
|
||
|
||
} | ||
|
||
public static int test_diceTowerWithTwoD6(){ | ||
List<NumberedDie> dice = new ArrayList();//declaring an array list | ||
dice.add(new NumberedDie(6)); | ||
dice.add(new NumberedDie(6)); | ||
DiceTower tower = new DiceTower(dice);//new dicetower value to dice | ||
tower.dropDice();//drop dice method access class | ||
int trayValue = tower.getTrayValue();//getting the valye of tray | ||
if(trayValue >= 2 && trayValue <= 12){ | ||
return -1; // means the die value is outside the bounds of 2 d6 | ||
}else{ | ||
return trayValue; //return the value of trayvalue if if statement is false. else | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package dnddiceroller; | ||
|
||
import java.util.Random; | ||
import java.io.*; | ||
import java.util.Scanner; | ||
/** | ||
* | ||
* @author Zachary | ||
*/ | ||
public class Fudge implements Die { | ||
private int sideOfDie; | ||
private int valueOfDie; | ||
|
||
public int getvaleOfDie(){ | ||
return valueOfDie; | ||
|
||
} | ||
|
||
public Fudge (int sideOfDie){ | ||
this.sideOfDie=sideOfDie; | ||
} | ||
|
||
public int roll(){ | ||
Random rand1=new Random(); | ||
return this.valueOfDie=rand1.nextInt(this.sideOfDie)-1; | ||
} | ||
|
||
@Override | ||
public int rollDice() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
public int getValue() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package dnddiceroller; | ||
|
||
import java.util.Random; | ||
import java.io.*; | ||
import java.util.Scanner; | ||
/** | ||
* | ||
* @author Zachary | ||
*/ | ||
public class Load implements Die{ | ||
private int sideOfDie; | ||
private int valueOfDie; | ||
|
||
|
||
public int getvaleOfDie(){ | ||
return valueOfDie; | ||
|
||
} | ||
|
||
public Load (int sideOfDie){ | ||
this.sideOfDie=sideOfDie; | ||
} | ||
|
||
public int roll(){ | ||
Random rand1=new Random(); | ||
this.valueOfDie=rand1.nextInt(this.sideOfDie)+1; | ||
while(this.valueOfDie<this.sideOfDie){ | ||
this.valueOfDie=rand1.nextInt(this.sideOfDie)+1;///loop to repated | ||
} | ||
return this.sideOfDie; | ||
} | ||
|
||
@Override | ||
public int rollDice() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
public int getValue() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package dnddiceroller; | ||
|
||
import java.io.*; | ||
import java.util.Scanner; | ||
import java.util.Random; | ||
|
||
/** | ||
* | ||
* @author Zachary | ||
*/ | ||
public class NumberedDie implements Die{ | ||
private int valueOfDie; | ||
private int sideOfDie; | ||
|
||
|
||
//con to get the # of sides oof the value | ||
public NumberedDie(int sideOfDie){ | ||
this.sideOfDie=sideOfDie; | ||
|
||
} | ||
//access | ||
public int getvalueOfDie(){ | ||
return valueOfDie; | ||
} | ||
|
||
|
||
@Override | ||
public int rollDice() { | ||
Random rand1=new Random(); | ||
return this.valueOfDie=rand1.nextInt(this.sideOfDie)+1; | ||
} | ||
|
||
@Override | ||
public int getValue() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You assigned this scanner to
file
instead ofscanner
so it can't read any lines