SlideShare a Scribd company logo
1 of 23
Download to read offline
I don't know what is wrong with this roulette program I can't seem to get it to run.
Game Class:
public class Game {
public static void main(String[] args) {
Table table = new Table();
BinBuilder bb = new BinBuilder();
Outcome black = new Outcome("Black", 35);
Bet bet = new Bet(10, black);
table.placeBet(bet);
Bin bin = bb.wheel.get(8);
System.out.println(bin.toString());
System.out.println(table.bets.toString());
System.out.println(black.toString());
ListIterator i = table.bets.listIterator();
Iterator b = bin.outcomes.iterator();
while(i.hasNext()) {
System.out.println(i.next().outcome.name.toString());
while(b.hasNext()){
System.out.println(b.next().name.toString());
if(i.next().outcome.equals(b.next())){
System.out.println("Win!");
}
else{
System.out.println("Win :/");
}
}
}
}
}
Player Class
public class Player {
public Table table;
public Outcome black;
public Bet bet;
public Player(Table table) {
table = new Table();
black = new Outcome("Black", 1);
}
void placeBets() {
Bet bet = new Bet(100, black);
table.placeBet(bet);
}
void win(Bet bet) {
System.out.println("You've won: " + bet.winAmount());
}
void lose(Bet bet) {
System.out.println("You lost!" + bet.loseAmount() + ":/");
}
}
Outcome class
public class Outcome implements Comparable {
public String name;
public int odds;
public Outcome(String name, int odds){
this.name = name;
this.odds = odds;
}
public int winAmount(int amount){
return amount*this.odds;
}
public boolean equals(Outcome other){
return (this.name.equals(other.name));
}
public String toString() {
Object[] values= { name, new Integer(odds) };
String msgTempl= "{0} ({1}:1)";
return MessageFormat.format( msgTempl, values );
}
@Override
public int compareTo(E arg0) {
if(this.equals(arg0)){
return 0;
}
return 1;
}
}
Table Class
public class Table {
public int limit = 1000;
public LinkedList bets;
public Table() {
bets = new LinkedList();
}
public boolean isValid(Bet bet) {
int sum = 0;
for(Bet bett: bets) {
sum += bett.amountBet;
}
return (sum>limit);
}
public void placeBet(Bet bet) {
bets.add(bet);
}
ListIterator iterator() {
return bets.listIterator();
}
}
Wheel Class
public class Wheel extends TreeSet {
Vector bins;
NonRandom rng;
Set all_outcomes;
Wheel(NonRandom rng){
this.rng = rng;
rng = new NonRandom();
all_outcomes = new TreeSet();
bins = new Vector(38);
for (int i=0; i<38; i++){
bins.add(i, new Bin());
}
}
Bin next(){
int rand = rng.next(38);
return bins.elementAt(rand);
}
Bin get(int bin){
return bins.elementAt(bin);
}
public Outcome getOutcome( String name ){
TreeSet result= new TreeSet();
for( Iterator i = all_outcomes.iterator(); i.hasNext(); ) {
Outcome oc= i.next();
if( oc.name.contains(name) ) {result.add( oc );}
}
return result.first();
}
public void addOutcome(int bin, Outcome outcome) {
all_outcomes.add(outcome);
this.bins.elementAt(bin).add(outcome);
}
}
Bet Class
public class Bet {
public int amountBet;
public Outcome outcome;
public Bet(int amount, Outcome outcome) {
this.outcome = outcome;
this.amountBet = amount;
}
public int winAmount() {
int winAmount = this.outcome.odds * this.amountBet;
return winAmount + this.amountBet;
}
public int loseAmount() {
int loseAmount = this.amountBet;
return loseAmount;
}
public String toString() {
return this.amountBet+" on "+"["+this.outcome.toString()+"]";
}
}
Bin Class
public class Bin {
public TreeSet outcomes;
int i =0;
Bin(){
outcomes = new TreeSet();
}
Bin(Outcome[] outcomes){
this();
for(Outcome anOutcome: outcomes){
add(anOutcome);
}
}
Bin(Collection outcomes){
this();
for(Outcome anOutcome: outcomes){
add(anOutcome);
}
}
void add(Outcome outcome){
this.outcomes.add(outcome);
}
public String toString(){
String string ="";
Iterator it1 =this.outcomes.iterator();
while(it1.hasNext()){
string += "["+it1.next().toString()+"]";
}
return string;
}
}
BinBuilder Class
public class BinBuilder {
public Wheel wheel;
public NonRandom nrng;
public BinBuilder() {
this.nrng = new NonRandom();
this.wheel = new Wheel(nrng);
buildBins(wheel);
}
public Wheel getWheel() {
return wheel;
}
private void buildBins(Wheel wheel){
straightBets(wheel);
splitBets(wheel);
streetBets(wheel);
cornerBets(wheel);
lineBets(wheel);
dozenBets(wheel);
columnBets(wheel);
evenMoneyBets(wheel);
}
void straightBets(Wheel wheel){
for(int i = 1; i<37; i++){
Outcome outcome = new Outcome(""+i, 35);
String u = ""+i;
wheel.addOutcome(i , outcome);
}
}
void splitBets(Wheel wheel){
for(int r = 0; r<12; r++){
int n = (3*r) +1;
Outcome outcome = new Outcome("'"+n+", "+n+1+"'", 17);
wheel.addOutcome(n , outcome);
wheel.addOutcome(n+1 , outcome);
n = (3*r) +2;
Outcome outcome2 = new Outcome("'"+n+", "+n+1+"'", 17);
wheel.addOutcome(n , outcome2);
wheel.addOutcome(n+1, outcome2);
}
for(int n = 1; n<34; n++){
Outcome outcomen = new Outcome(n+", "+n+3, 17);
wheel.addOutcome(n , outcomen);
wheel.addOutcome(n+3 , outcomen);
}
}
void streetBets(Wheel wheel){
for(int r = 0; r<12; r++){
int n = (3*r) +1;
Outcome outcome = new Outcome(""+n, 11);
wheel.addOutcome(n , outcome);
wheel.addOutcome(n+1 , outcome);
wheel.addOutcome(n+2 , outcome);
}
}
void cornerBets(Wheel wheel){
for(int r = 0; r<11; r++){
int n = (3*r) +1;
Outcome outcome = new Outcome(n +", " +n +1+", " +n +3+", " +n +4, 8);
wheel.addOutcome(n , outcome);
wheel.addOutcome(n+1 , outcome);
wheel.addOutcome(n+3 , outcome);
wheel.addOutcome(n+4 , outcome);
int s = (3*r) +2;
Outcome outcome2 = new Outcome(s +", "+ s +1+", "+ s+3+", "+ s +4, 17);
wheel.addOutcome(n , outcome2);
wheel.addOutcome(n+1, outcome2);
wheel.addOutcome(n+3, outcome2);
wheel.addOutcome(n+4, outcome2);
}
}
void lineBets(Wheel wheel){
for(int r = 0; r<10; r++){
int n = (3*r) +1;
Outcome outcome = new Outcome(n+", "+ (n +1)+","+ (n +2)+", "+ (n +3)+", "+ (n
+4)+", "+ (n +5), 5);
wheel.addOutcome(n , outcome);
wheel.addOutcome(n+1 , outcome);
wheel.addOutcome(n+2 , outcome);
wheel.addOutcome(n+3 , outcome);
wheel.addOutcome(n+4 , outcome);
wheel.addOutcome(n+5 , outcome);
}
}
void dozenBets(Wheel wheel){
for(int d = 0; d<3; d++){
Outcome outcome = new Outcome(""+(d+1), 2);
for(int m = 0; m<12; m++){
wheel.addOutcome(12*d+m+1 , outcome);
}
}
}
void columnBets(Wheel wheel){
for(int c = 0; c<3; c++){
Outcome outcome = new Outcome(""+c+1,2);
for(int r = 0; r<12; r++){
wheel.addOutcome((3*r)+c+1 , outcome);
}
}
}
void evenMoneyBets(Wheel wheel){
for(int n = 0; n<37; n++){
if(n>=1 && n<19){
Outcome outcome_l = new Outcome("Low",1);
wheel.addOutcome(n , outcome_l);
}
else {
Outcome outcome_h = new Outcome("High",1);
wheel.addOutcome(n , outcome_h);
}
if(n%2==0){
Outcome outcome_e = new Outcome("Even",1);
wheel.addOutcome(n , outcome_e);
}
else {
Outcome outcome_o = new Outcome("Odd",1);
wheel.addOutcome(n , outcome_o);
}
int[] Red = {1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36};
if (Arrays.binarySearch(Red, n) >= 0){
Outcome outcome_r = new Outcome("Red",1);
wheel.addOutcome(n , outcome_r);
}
else {
Outcome outcome_b = new Outcome("Black",1);
wheel.addOutcome(n , outcome_b);
}
}
}
}
NonRandom Class
public class NonRandom {
private long value;
public void NonRandom(){
value = 0;
}
public int next(int bits) {
return (int) value;
}
public void setSeed(long value) {
this.value = value;
}
}
Solution
In the main method you are calling the i.next() and b.next() method twice in a loop which cause
an error. I have made the changes. Kindly go through the changes that i have made.
------------------------------------------------code--------------------------------------------------------------
---------------------------------
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.Set;
import java.util.TreeSet;
import java.util.Vector;
import java.util.LinkedList;
public class Game {
public static void main(String[] args) {
Table table = new Table();
BinBuilder bb = new BinBuilder();
Outcome black = new Outcome("Black", 35);
Bet bet = new Bet(10, black);
table.placeBet(bet);
Bin bin = bb.wheel.get(8);
System.out.println(bin.toString());
System.out.println(table.bets.toString());
System.out.println(black.toString());
ListIterator i = table.bets.listIterator();
Iterator b = bin.outcomes.iterator();
while(i.hasNext()) {
Outcome outcome=i.next().outcome;
System.out.println(outcome);
while(b.hasNext()){
Outcome binOutcome=b.next();
System.out.println(binOutcome);
if(outcome.equals(binOutcome)){
System.out.println("Win!");
}
else{
System.out.println("Win :/");
}
}
}
}
}
class Player {
public Table table;
public Outcome black;
public Bet bet;
public Player(Table table) {
table = new Table();
black = new Outcome("Black", 1);
}
void placeBets() {
Bet bet = new Bet(100, black);
table.placeBet(bet);
}
void win(Bet bet) {
System.out.println("You've won: " + bet.winAmount());
}
void lose(Bet bet) {
System.out.println("You lost!" + bet.loseAmount() + ":/");
}
}
class Outcome implements Comparable {
public String name;
public int odds;
public Outcome(String name, int odds){
this.name = name;
this.odds = odds;
}
public int winAmount(int amount){
return amount*this.odds;
}
public boolean equals(Outcome other){
return (this.name.equals(other.name));
}
public String toString() {
Object[] values= { name, new Integer(odds) };
String msgTempl= "{0} ({1}:1)";
return MessageFormat.format( msgTempl, values );
}
@Override
public int compareTo(E arg0) {
if(this.equals(arg0)){
return 0;
}
return 1;
}
}
class Table {
public int limit = 1000;
public LinkedListbets;
public Table() {
bets = new LinkedList();
}
public boolean isValid(Bet bet) {
int sum = 0;
for(Bet bett: bets) {
sum += bett.amountBet;
}
return (sum>limit);
}
public void placeBet(Bet bet) {
bets.add(bet);
}
ListIterator iterator() {
return bets.listIterator();
}
}
class Wheel extends TreeSet {
Vector bins;
NonRandom rng;
Set all_outcomes;
Wheel(NonRandom rng){
this.rng = rng;
rng = new NonRandom();
all_outcomes = new TreeSet();
bins = new Vector(38);
for (int i=0; i<38; i++){
bins.add(i, new Bin());
}
}
Bin next(){
int rand = rng.next(38);
return bins.elementAt(rand);
}
Bin get(int bin){
return bins.elementAt(bin);
}
public Outcome getOutcome( String name ){
TreeSet result= new TreeSet();
for( Iterator i = all_outcomes.iterator(); i.hasNext(); ) {
Outcome oc= i.next();
if( oc.name.contains(name) ) {result.add( oc );}
}
return result.first();
}
public void addOutcome(int bin, Outcome outcome) {
all_outcomes.add(outcome);
this.bins.elementAt(bin).add(outcome);
}
}
class Bet {
public int amountBet;
public Outcome outcome;
public Bet(int amount, Outcome outcome) {
this.outcome = outcome;
this.amountBet = amount;
}
public int winAmount() {
int winAmount = this.outcome.odds * this.amountBet;
return winAmount + this.amountBet;
}
public int loseAmount() {
int loseAmount = this.amountBet;
return loseAmount;
}
public String toString() {
return this.amountBet+" on "+"["+this.outcome.toString()+"]";
}
}
class Bin {
public TreeSet outcomes;
int i =0;
Bin(){
outcomes = new TreeSet();
}
Bin(Outcome[] outcomes){
this();
for(Outcome anOutcome: outcomes){
add(anOutcome);
}
}
Bin(Collection outcomes){
this();
for(Outcome anOutcome: outcomes){
add(anOutcome);
}
}
void add(Outcome outcome){
this.outcomes.add(outcome);
}
public String toString(){
String string ="";
Iterator it1 =this.outcomes.iterator();
while(it1.hasNext()){
string += "["+it1.next().toString()+"]";
}
return string;
}
}
class BinBuilder {
public Wheel wheel;
public NonRandom nrng;
public BinBuilder() {
this.nrng = new NonRandom();
this.wheel = new Wheel(nrng);
buildBins(wheel);
}
public Wheel getWheel() {
return wheel;
}
private void buildBins(Wheel wheel){
straightBets(wheel);
splitBets(wheel);
streetBets(wheel);
cornerBets(wheel);
lineBets(wheel);
dozenBets(wheel);
columnBets(wheel);
evenMoneyBets(wheel);
}
void straightBets(Wheel wheel){
for(int i = 1; i<37; i++){
Outcome outcome = new Outcome(""+i, 35);
String u = ""+i;
wheel.addOutcome(i , outcome);
}
}
void splitBets(Wheel wheel){
for(int r = 0; r<12; r++){
int n = (3*r) +1;
Outcome outcome = new Outcome("'"+n+", "+n+1+"'", 17);
wheel.addOutcome(n , outcome);
wheel.addOutcome(n+1 , outcome);
n = (3*r) +2;
Outcome outcome2 = new Outcome("'"+n+", "+n+1+"'", 17);
wheel.addOutcome(n , outcome2);
wheel.addOutcome(n+1, outcome2);
}
for(int n = 1; n<34; n++){
Outcome outcomen = new Outcome(n+", "+n+3, 17);
wheel.addOutcome(n , outcomen);
wheel.addOutcome(n+3 , outcomen);
}
}
void streetBets(Wheel wheel){
for(int r = 0; r<12; r++){
int n = (3*r) +1;
Outcome outcome = new Outcome(""+n, 11);
wheel.addOutcome(n , outcome);
wheel.addOutcome(n+1 , outcome);
wheel.addOutcome(n+2 , outcome);
}
}
void cornerBets(Wheel wheel){
for(int r = 0; r<11; r++){
int n = (3*r) +1;
Outcome outcome = new Outcome(n +", " +n +1+", " +n +3+", " +n +4, 8);
wheel.addOutcome(n , outcome);
wheel.addOutcome(n+1 , outcome);
wheel.addOutcome(n+3 , outcome);
wheel.addOutcome(n+4 , outcome);
int s = (3*r) +2;
Outcome outcome2 = new Outcome(s +", "+ s +1+", "+ s+3+", "+ s +4, 17);
wheel.addOutcome(n , outcome2);
wheel.addOutcome(n+1, outcome2);
wheel.addOutcome(n+3, outcome2);
wheel.addOutcome(n+4, outcome2);
}
}
void lineBets(Wheel wheel){
for(int r = 0; r<10; r++){
int n = (3*r) +1;
Outcome outcome = new Outcome(n+", "+ (n +1)+","+ (n +2)+", "+ (n +3)+", "+ (n
+4)+", "+ (n +5), 5);
wheel.addOutcome(n , outcome);
wheel.addOutcome(n+1 , outcome);
wheel.addOutcome(n+2 , outcome);
wheel.addOutcome(n+3 , outcome);
wheel.addOutcome(n+4 , outcome);
wheel.addOutcome(n+5 , outcome);
}
}
void dozenBets(Wheel wheel){
for(int d = 0; d<3; d++){
Outcome outcome = new Outcome(""+(d+1), 2);
for(int m = 0; m<12; m++){
wheel.addOutcome(12*d+m+1 , outcome);
}
}
}
void columnBets(Wheel wheel){
for(int c = 0; c<3; c++){
Outcome outcome = new Outcome(""+c+1,2);
for(int r = 0; r<12; r++){
wheel.addOutcome((3*r)+c+1 , outcome);
}
}
}
void evenMoneyBets(Wheel wheel){
for(int n = 0; n<37; n++){
if(n>=1 && n<19){
Outcome outcome_l = new Outcome("Low",1);
wheel.addOutcome(n , outcome_l);
}
else {
Outcome outcome_h = new Outcome("High",1);
wheel.addOutcome(n , outcome_h);
}
if(n%2==0){
Outcome outcome_e = new Outcome("Even",1);
wheel.addOutcome(n , outcome_e);
}
else {
Outcome outcome_o = new Outcome("Odd",1);
wheel.addOutcome(n , outcome_o);
}
int[] Red = {1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36};
if (Arrays.binarySearch(Red, n) >= 0){
Outcome outcome_r = new Outcome("Red",1);
wheel.addOutcome(n , outcome_r);
}
else {
Outcome outcome_b = new Outcome("Black",1);
wheel.addOutcome(n , outcome_b);
}
}
}
}
class NonRandom {
private long value;
public void NonRandom(){
value = 0;
}
public int next(int bits) {
return (int) value;
}
public void setSeed(long value) {
this.value = value;
}
}
------------------------------------------------output-----------------------------------------------------
[8 (35:1)]['7, 71' (17:1)]['8, 81' (17:1)][5, 53 (17:1)][8, 83 (17:1)][7 (11:1)][4, 41, 43, 44
(8:1)][5, 51, 53, 54 (17:1)][7, 71, 73, 74 (8:1)][8, 81, 83, 84 (17:1)][4, 5,6, 7, 8, 9 (5:1)][7, 8,9,
10, 11, 12 (5:1)][1 (2:1)][11 (2:1)][Low (1:1)][Even (1:1)][Black (1:1)]
[10 on [Black (35:1)]]
Black (35:1)
Black (35:1)
8 (35:1)
Win :/
'7, 71' (17:1)
Win :/
'8, 81' (17:1)
Win :/
5, 53 (17:1)
Win :/
8, 83 (17:1)
Win :/
7 (11:1)
Win :/
4, 41, 43, 44 (8:1)
Win :/
5, 51, 53, 54 (17:1)
Win :/
7, 71, 73, 74 (8:1)
Win :/
8, 81, 83, 84 (17:1)
Win :/
4, 5,6, 7, 8, 9 (5:1)
Win :/
7, 8,9, 10, 11, 12 (5:1)
Win :/
1 (2:1)
Win :/
11 (2:1)
Win :/
Low (1:1)
Win :/
Even (1:1)
Win :/
Black (1:1)
Win!

More Related Content

Similar to I dont know what is wrong with this roulette program I cant seem.pdf

OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdfakkhan101
 
The main class of the tictoe game looks like.public class Main {.pdf
The main class of the tictoe game looks like.public class Main {.pdfThe main class of the tictoe game looks like.public class Main {.pdf
The main class of the tictoe game looks like.public class Main {.pdfasif1401
 
public interface Game Note interface in place of class { .pdf
public interface Game  Note interface in place of class { .pdfpublic interface Game  Note interface in place of class { .pdf
public interface Game Note interface in place of class { .pdfkavithaarp
 
In Java using Eclipse, Im suppose to write a class that encapsulat.pdf
In Java using Eclipse, Im suppose to write a class that encapsulat.pdfIn Java using Eclipse, Im suppose to write a class that encapsulat.pdf
In Java using Eclipse, Im suppose to write a class that encapsulat.pdfanjandavid
 
Whats new in_csharp4
Whats new in_csharp4Whats new in_csharp4
Whats new in_csharp4Abed Bukhari
 
Redux saga: managing your side effects. Also: generators in es6
Redux saga: managing your side effects. Also: generators in es6Redux saga: managing your side effects. Also: generators in es6
Redux saga: managing your side effects. Also: generators in es6Ignacio Martín
 
Wap to implement bitwise operators
Wap to implement bitwise operatorsWap to implement bitwise operators
Wap to implement bitwise operatorsHarleen Sodhi
 
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdfWorking with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdfudit652068
 
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...British Council
 
Given the following codepackage data1;import java.util.;p.pdf
Given the following codepackage data1;import java.util.;p.pdfGiven the following codepackage data1;import java.util.;p.pdf
Given the following codepackage data1;import java.util.;p.pdfillyasraja7
 
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdfimport java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdfshaktisinhgandhinaga
 
Please help with this. program must be written in C# .. All of the g.pdf
Please help with this. program must be written in C# .. All of the g.pdfPlease help with this. program must be written in C# .. All of the g.pdf
Please help with this. program must be written in C# .. All of the g.pdfmanjan6
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_04-Mar-2021_L14...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_04-Mar-2021_L14...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_04-Mar-2021_L14...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_04-Mar-2021_L14...MaruMengesha
 

Similar to I dont know what is wrong with this roulette program I cant seem.pdf (20)

OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdf
 
The main class of the tictoe game looks like.public class Main {.pdf
The main class of the tictoe game looks like.public class Main {.pdfThe main class of the tictoe game looks like.public class Main {.pdf
The main class of the tictoe game looks like.public class Main {.pdf
 
Java programs
Java programsJava programs
Java programs
 
public interface Game Note interface in place of class { .pdf
public interface Game  Note interface in place of class { .pdfpublic interface Game  Note interface in place of class { .pdf
public interface Game Note interface in place of class { .pdf
 
In Java using Eclipse, Im suppose to write a class that encapsulat.pdf
In Java using Eclipse, Im suppose to write a class that encapsulat.pdfIn Java using Eclipse, Im suppose to write a class that encapsulat.pdf
In Java using Eclipse, Im suppose to write a class that encapsulat.pdf
 
Awt
AwtAwt
Awt
 
Whats new in_csharp4
Whats new in_csharp4Whats new in_csharp4
Whats new in_csharp4
 
Academy PRO: ES2015
Academy PRO: ES2015Academy PRO: ES2015
Academy PRO: ES2015
 
5 Rmi Print
5  Rmi Print5  Rmi Print
5 Rmi Print
 
Redux saga: managing your side effects. Also: generators in es6
Redux saga: managing your side effects. Also: generators in es6Redux saga: managing your side effects. Also: generators in es6
Redux saga: managing your side effects. Also: generators in es6
 
Wap to implement bitwise operators
Wap to implement bitwise operatorsWap to implement bitwise operators
Wap to implement bitwise operators
 
C# labprograms
C# labprogramsC# labprograms
C# labprograms
 
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdfWorking with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
 
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
 
Given the following codepackage data1;import java.util.;p.pdf
Given the following codepackage data1;import java.util.;p.pdfGiven the following codepackage data1;import java.util.;p.pdf
Given the following codepackage data1;import java.util.;p.pdf
 
.net progrmming part2
.net progrmming part2.net progrmming part2
.net progrmming part2
 
Java oops features
Java oops featuresJava oops features
Java oops features
 
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdfimport java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
 
Please help with this. program must be written in C# .. All of the g.pdf
Please help with this. program must be written in C# .. All of the g.pdfPlease help with this. program must be written in C# .. All of the g.pdf
Please help with this. program must be written in C# .. All of the g.pdf
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_04-Mar-2021_L14...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_04-Mar-2021_L14...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_04-Mar-2021_L14...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_04-Mar-2021_L14...
 

More from archanaemporium

Identify a article about a communicable or noncommunicable disease i.pdf
Identify a article about a communicable or noncommunicable disease i.pdfIdentify a article about a communicable or noncommunicable disease i.pdf
Identify a article about a communicable or noncommunicable disease i.pdfarchanaemporium
 
i safari File Edit View History Bookmarks Window Help 67 D. Thu 101.pdf
i safari File Edit View History Bookmarks Window Help 67 D. Thu 101.pdfi safari File Edit View History Bookmarks Window Help 67 D. Thu 101.pdf
i safari File Edit View History Bookmarks Window Help 67 D. Thu 101.pdfarchanaemporium
 
I know that water molecules attract each other, but why do water mol.pdf
I know that water molecules attract each other, but why do water mol.pdfI know that water molecules attract each other, but why do water mol.pdf
I know that water molecules attract each other, but why do water mol.pdfarchanaemporium
 
How can Internet technologies be involved in improving a process in .pdf
How can Internet technologies be involved in improving a process in .pdfHow can Internet technologies be involved in improving a process in .pdf
How can Internet technologies be involved in improving a process in .pdfarchanaemporium
 
How many paths are there in a tree with n nodesHow many paths a.pdf
How many paths are there in a tree with n nodesHow many paths a.pdfHow many paths are there in a tree with n nodesHow many paths a.pdf
How many paths are there in a tree with n nodesHow many paths a.pdfarchanaemporium
 
Hypothesize a way for a virus to evade a host defense & then devise .pdf
Hypothesize a way for a virus to evade a host defense & then devise .pdfHypothesize a way for a virus to evade a host defense & then devise .pdf
Hypothesize a way for a virus to evade a host defense & then devise .pdfarchanaemporium
 
How many ways can letters of the word SINGAPORE be arranged such that.pdf
How many ways can letters of the word SINGAPORE be arranged such that.pdfHow many ways can letters of the word SINGAPORE be arranged such that.pdf
How many ways can letters of the word SINGAPORE be arranged such that.pdfarchanaemporium
 
Haploid. After is complete, the resulting gametes are haploid. This m.pdf
Haploid. After is complete, the resulting gametes are haploid. This m.pdfHaploid. After is complete, the resulting gametes are haploid. This m.pdf
Haploid. After is complete, the resulting gametes are haploid. This m.pdfarchanaemporium
 
FTP and TFTP are primarily file transfer protocols. What is the main.pdf
FTP and TFTP are primarily file transfer protocols. What is the main.pdfFTP and TFTP are primarily file transfer protocols. What is the main.pdf
FTP and TFTP are primarily file transfer protocols. What is the main.pdfarchanaemporium
 
Given Starter Fileimport java.util.Arrays; Encapsulates.pdf
Given Starter Fileimport java.util.Arrays;   Encapsulates.pdfGiven Starter Fileimport java.util.Arrays;   Encapsulates.pdf
Given Starter Fileimport java.util.Arrays; Encapsulates.pdfarchanaemporium
 
Express the verbal representation for the function f symbolically. M.pdf
Express the verbal representation for the function f symbolically.  M.pdfExpress the verbal representation for the function f symbolically.  M.pdf
Express the verbal representation for the function f symbolically. M.pdfarchanaemporium
 
Economic resources have a price above zero because...A. there are .pdf
Economic resources have a price above zero because...A. there are .pdfEconomic resources have a price above zero because...A. there are .pdf
Economic resources have a price above zero because...A. there are .pdfarchanaemporium
 
DOES NOT NEED TO BE ANSWERED UNTIL NOV 13thWords AssignmentRober.pdf
DOES NOT NEED TO BE ANSWERED UNTIL NOV 13thWords AssignmentRober.pdfDOES NOT NEED TO BE ANSWERED UNTIL NOV 13thWords AssignmentRober.pdf
DOES NOT NEED TO BE ANSWERED UNTIL NOV 13thWords AssignmentRober.pdfarchanaemporium
 
Discuss in detail how two different Progressive reformers tackled th.pdf
Discuss in detail how two different Progressive reformers tackled th.pdfDiscuss in detail how two different Progressive reformers tackled th.pdf
Discuss in detail how two different Progressive reformers tackled th.pdfarchanaemporium
 
Describe the major parts of the nervous system and their functions..pdf
Describe the major parts of the nervous system and their functions..pdfDescribe the major parts of the nervous system and their functions..pdf
Describe the major parts of the nervous system and their functions..pdfarchanaemporium
 
DEFINE gene enhancer and gene promoter (3-4 sentences each).Sol.pdf
DEFINE gene enhancer and gene promoter (3-4 sentences each).Sol.pdfDEFINE gene enhancer and gene promoter (3-4 sentences each).Sol.pdf
DEFINE gene enhancer and gene promoter (3-4 sentences each).Sol.pdfarchanaemporium
 
Cisco Systems, Inc. offers a switching technology known as Multi-Lay.pdf
Cisco Systems, Inc. offers a switching technology known as Multi-Lay.pdfCisco Systems, Inc. offers a switching technology known as Multi-Lay.pdf
Cisco Systems, Inc. offers a switching technology known as Multi-Lay.pdfarchanaemporium
 
C# ProgramingHow a derived class that inherits attributes and beha.pdf
C# ProgramingHow a derived class that inherits attributes and beha.pdfC# ProgramingHow a derived class that inherits attributes and beha.pdf
C# ProgramingHow a derived class that inherits attributes and beha.pdfarchanaemporium
 
Assume that x and y are already defined as being of type int . Write.pdf
Assume that x and y are already defined as being of type int . Write.pdfAssume that x and y are already defined as being of type int . Write.pdf
Assume that x and y are already defined as being of type int . Write.pdfarchanaemporium
 
Briefly define cyberterrorism. Define hacktivism. Illustrate example.pdf
Briefly define cyberterrorism. Define hacktivism. Illustrate example.pdfBriefly define cyberterrorism. Define hacktivism. Illustrate example.pdf
Briefly define cyberterrorism. Define hacktivism. Illustrate example.pdfarchanaemporium
 

More from archanaemporium (20)

Identify a article about a communicable or noncommunicable disease i.pdf
Identify a article about a communicable or noncommunicable disease i.pdfIdentify a article about a communicable or noncommunicable disease i.pdf
Identify a article about a communicable or noncommunicable disease i.pdf
 
i safari File Edit View History Bookmarks Window Help 67 D. Thu 101.pdf
i safari File Edit View History Bookmarks Window Help 67 D. Thu 101.pdfi safari File Edit View History Bookmarks Window Help 67 D. Thu 101.pdf
i safari File Edit View History Bookmarks Window Help 67 D. Thu 101.pdf
 
I know that water molecules attract each other, but why do water mol.pdf
I know that water molecules attract each other, but why do water mol.pdfI know that water molecules attract each other, but why do water mol.pdf
I know that water molecules attract each other, but why do water mol.pdf
 
How can Internet technologies be involved in improving a process in .pdf
How can Internet technologies be involved in improving a process in .pdfHow can Internet technologies be involved in improving a process in .pdf
How can Internet technologies be involved in improving a process in .pdf
 
How many paths are there in a tree with n nodesHow many paths a.pdf
How many paths are there in a tree with n nodesHow many paths a.pdfHow many paths are there in a tree with n nodesHow many paths a.pdf
How many paths are there in a tree with n nodesHow many paths a.pdf
 
Hypothesize a way for a virus to evade a host defense & then devise .pdf
Hypothesize a way for a virus to evade a host defense & then devise .pdfHypothesize a way for a virus to evade a host defense & then devise .pdf
Hypothesize a way for a virus to evade a host defense & then devise .pdf
 
How many ways can letters of the word SINGAPORE be arranged such that.pdf
How many ways can letters of the word SINGAPORE be arranged such that.pdfHow many ways can letters of the word SINGAPORE be arranged such that.pdf
How many ways can letters of the word SINGAPORE be arranged such that.pdf
 
Haploid. After is complete, the resulting gametes are haploid. This m.pdf
Haploid. After is complete, the resulting gametes are haploid. This m.pdfHaploid. After is complete, the resulting gametes are haploid. This m.pdf
Haploid. After is complete, the resulting gametes are haploid. This m.pdf
 
FTP and TFTP are primarily file transfer protocols. What is the main.pdf
FTP and TFTP are primarily file transfer protocols. What is the main.pdfFTP and TFTP are primarily file transfer protocols. What is the main.pdf
FTP and TFTP are primarily file transfer protocols. What is the main.pdf
 
Given Starter Fileimport java.util.Arrays; Encapsulates.pdf
Given Starter Fileimport java.util.Arrays;   Encapsulates.pdfGiven Starter Fileimport java.util.Arrays;   Encapsulates.pdf
Given Starter Fileimport java.util.Arrays; Encapsulates.pdf
 
Express the verbal representation for the function f symbolically. M.pdf
Express the verbal representation for the function f symbolically.  M.pdfExpress the verbal representation for the function f symbolically.  M.pdf
Express the verbal representation for the function f symbolically. M.pdf
 
Economic resources have a price above zero because...A. there are .pdf
Economic resources have a price above zero because...A. there are .pdfEconomic resources have a price above zero because...A. there are .pdf
Economic resources have a price above zero because...A. there are .pdf
 
DOES NOT NEED TO BE ANSWERED UNTIL NOV 13thWords AssignmentRober.pdf
DOES NOT NEED TO BE ANSWERED UNTIL NOV 13thWords AssignmentRober.pdfDOES NOT NEED TO BE ANSWERED UNTIL NOV 13thWords AssignmentRober.pdf
DOES NOT NEED TO BE ANSWERED UNTIL NOV 13thWords AssignmentRober.pdf
 
Discuss in detail how two different Progressive reformers tackled th.pdf
Discuss in detail how two different Progressive reformers tackled th.pdfDiscuss in detail how two different Progressive reformers tackled th.pdf
Discuss in detail how two different Progressive reformers tackled th.pdf
 
Describe the major parts of the nervous system and their functions..pdf
Describe the major parts of the nervous system and their functions..pdfDescribe the major parts of the nervous system and their functions..pdf
Describe the major parts of the nervous system and their functions..pdf
 
DEFINE gene enhancer and gene promoter (3-4 sentences each).Sol.pdf
DEFINE gene enhancer and gene promoter (3-4 sentences each).Sol.pdfDEFINE gene enhancer and gene promoter (3-4 sentences each).Sol.pdf
DEFINE gene enhancer and gene promoter (3-4 sentences each).Sol.pdf
 
Cisco Systems, Inc. offers a switching technology known as Multi-Lay.pdf
Cisco Systems, Inc. offers a switching technology known as Multi-Lay.pdfCisco Systems, Inc. offers a switching technology known as Multi-Lay.pdf
Cisco Systems, Inc. offers a switching technology known as Multi-Lay.pdf
 
C# ProgramingHow a derived class that inherits attributes and beha.pdf
C# ProgramingHow a derived class that inherits attributes and beha.pdfC# ProgramingHow a derived class that inherits attributes and beha.pdf
C# ProgramingHow a derived class that inherits attributes and beha.pdf
 
Assume that x and y are already defined as being of type int . Write.pdf
Assume that x and y are already defined as being of type int . Write.pdfAssume that x and y are already defined as being of type int . Write.pdf
Assume that x and y are already defined as being of type int . Write.pdf
 
Briefly define cyberterrorism. Define hacktivism. Illustrate example.pdf
Briefly define cyberterrorism. Define hacktivism. Illustrate example.pdfBriefly define cyberterrorism. Define hacktivism. Illustrate example.pdf
Briefly define cyberterrorism. Define hacktivism. Illustrate example.pdf
 

Recently uploaded

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 

Recently uploaded (20)

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 

I dont know what is wrong with this roulette program I cant seem.pdf

  • 1. I don't know what is wrong with this roulette program I can't seem to get it to run. Game Class: public class Game { public static void main(String[] args) { Table table = new Table(); BinBuilder bb = new BinBuilder(); Outcome black = new Outcome("Black", 35); Bet bet = new Bet(10, black); table.placeBet(bet); Bin bin = bb.wheel.get(8); System.out.println(bin.toString()); System.out.println(table.bets.toString()); System.out.println(black.toString()); ListIterator i = table.bets.listIterator(); Iterator b = bin.outcomes.iterator(); while(i.hasNext()) { System.out.println(i.next().outcome.name.toString()); while(b.hasNext()){ System.out.println(b.next().name.toString()); if(i.next().outcome.equals(b.next())){ System.out.println("Win!"); } else{ System.out.println("Win :/"); } } } } }
  • 2. Player Class public class Player { public Table table; public Outcome black; public Bet bet; public Player(Table table) { table = new Table(); black = new Outcome("Black", 1); } void placeBets() { Bet bet = new Bet(100, black); table.placeBet(bet); } void win(Bet bet) { System.out.println("You've won: " + bet.winAmount()); } void lose(Bet bet) { System.out.println("You lost!" + bet.loseAmount() + ":/"); } } Outcome class public class Outcome implements Comparable { public String name; public int odds; public Outcome(String name, int odds){ this.name = name; this.odds = odds; } public int winAmount(int amount){
  • 3. return amount*this.odds; } public boolean equals(Outcome other){ return (this.name.equals(other.name)); } public String toString() { Object[] values= { name, new Integer(odds) }; String msgTempl= "{0} ({1}:1)"; return MessageFormat.format( msgTempl, values ); } @Override public int compareTo(E arg0) { if(this.equals(arg0)){ return 0; } return 1; } } Table Class public class Table { public int limit = 1000; public LinkedList bets; public Table() { bets = new LinkedList(); } public boolean isValid(Bet bet) { int sum = 0; for(Bet bett: bets) { sum += bett.amountBet; } return (sum>limit);
  • 4. } public void placeBet(Bet bet) { bets.add(bet); } ListIterator iterator() { return bets.listIterator(); } } Wheel Class public class Wheel extends TreeSet { Vector bins; NonRandom rng; Set all_outcomes; Wheel(NonRandom rng){ this.rng = rng; rng = new NonRandom(); all_outcomes = new TreeSet(); bins = new Vector(38); for (int i=0; i<38; i++){ bins.add(i, new Bin()); } } Bin next(){ int rand = rng.next(38); return bins.elementAt(rand); } Bin get(int bin){ return bins.elementAt(bin);
  • 5. } public Outcome getOutcome( String name ){ TreeSet result= new TreeSet(); for( Iterator i = all_outcomes.iterator(); i.hasNext(); ) { Outcome oc= i.next(); if( oc.name.contains(name) ) {result.add( oc );} } return result.first(); } public void addOutcome(int bin, Outcome outcome) { all_outcomes.add(outcome); this.bins.elementAt(bin).add(outcome); } } Bet Class public class Bet { public int amountBet; public Outcome outcome; public Bet(int amount, Outcome outcome) { this.outcome = outcome; this.amountBet = amount; } public int winAmount() { int winAmount = this.outcome.odds * this.amountBet; return winAmount + this.amountBet; } public int loseAmount() { int loseAmount = this.amountBet; return loseAmount;
  • 6. } public String toString() { return this.amountBet+" on "+"["+this.outcome.toString()+"]"; } } Bin Class public class Bin { public TreeSet outcomes; int i =0; Bin(){ outcomes = new TreeSet(); } Bin(Outcome[] outcomes){ this(); for(Outcome anOutcome: outcomes){ add(anOutcome); } } Bin(Collection outcomes){ this(); for(Outcome anOutcome: outcomes){ add(anOutcome); } } void add(Outcome outcome){ this.outcomes.add(outcome); } public String toString(){ String string =""; Iterator it1 =this.outcomes.iterator(); while(it1.hasNext()){ string += "["+it1.next().toString()+"]";
  • 7. } return string; } } BinBuilder Class public class BinBuilder { public Wheel wheel; public NonRandom nrng; public BinBuilder() { this.nrng = new NonRandom(); this.wheel = new Wheel(nrng); buildBins(wheel); } public Wheel getWheel() { return wheel; } private void buildBins(Wheel wheel){ straightBets(wheel); splitBets(wheel); streetBets(wheel); cornerBets(wheel); lineBets(wheel); dozenBets(wheel); columnBets(wheel); evenMoneyBets(wheel); } void straightBets(Wheel wheel){ for(int i = 1; i<37; i++){ Outcome outcome = new Outcome(""+i, 35); String u = ""+i; wheel.addOutcome(i , outcome); } } void splitBets(Wheel wheel){ for(int r = 0; r<12; r++){
  • 8. int n = (3*r) +1; Outcome outcome = new Outcome("'"+n+", "+n+1+"'", 17); wheel.addOutcome(n , outcome); wheel.addOutcome(n+1 , outcome); n = (3*r) +2; Outcome outcome2 = new Outcome("'"+n+", "+n+1+"'", 17); wheel.addOutcome(n , outcome2); wheel.addOutcome(n+1, outcome2); } for(int n = 1; n<34; n++){ Outcome outcomen = new Outcome(n+", "+n+3, 17); wheel.addOutcome(n , outcomen); wheel.addOutcome(n+3 , outcomen); } } void streetBets(Wheel wheel){ for(int r = 0; r<12; r++){ int n = (3*r) +1; Outcome outcome = new Outcome(""+n, 11); wheel.addOutcome(n , outcome); wheel.addOutcome(n+1 , outcome); wheel.addOutcome(n+2 , outcome); } } void cornerBets(Wheel wheel){ for(int r = 0; r<11; r++){ int n = (3*r) +1; Outcome outcome = new Outcome(n +", " +n +1+", " +n +3+", " +n +4, 8); wheel.addOutcome(n , outcome); wheel.addOutcome(n+1 , outcome); wheel.addOutcome(n+3 , outcome); wheel.addOutcome(n+4 , outcome); int s = (3*r) +2; Outcome outcome2 = new Outcome(s +", "+ s +1+", "+ s+3+", "+ s +4, 17); wheel.addOutcome(n , outcome2); wheel.addOutcome(n+1, outcome2);
  • 9. wheel.addOutcome(n+3, outcome2); wheel.addOutcome(n+4, outcome2); } } void lineBets(Wheel wheel){ for(int r = 0; r<10; r++){ int n = (3*r) +1; Outcome outcome = new Outcome(n+", "+ (n +1)+","+ (n +2)+", "+ (n +3)+", "+ (n +4)+", "+ (n +5), 5); wheel.addOutcome(n , outcome); wheel.addOutcome(n+1 , outcome); wheel.addOutcome(n+2 , outcome); wheel.addOutcome(n+3 , outcome); wheel.addOutcome(n+4 , outcome); wheel.addOutcome(n+5 , outcome); } } void dozenBets(Wheel wheel){ for(int d = 0; d<3; d++){ Outcome outcome = new Outcome(""+(d+1), 2); for(int m = 0; m<12; m++){ wheel.addOutcome(12*d+m+1 , outcome); } } } void columnBets(Wheel wheel){ for(int c = 0; c<3; c++){ Outcome outcome = new Outcome(""+c+1,2); for(int r = 0; r<12; r++){ wheel.addOutcome((3*r)+c+1 , outcome); } } } void evenMoneyBets(Wheel wheel){ for(int n = 0; n<37; n++){ if(n>=1 && n<19){
  • 10. Outcome outcome_l = new Outcome("Low",1); wheel.addOutcome(n , outcome_l); } else { Outcome outcome_h = new Outcome("High",1); wheel.addOutcome(n , outcome_h); } if(n%2==0){ Outcome outcome_e = new Outcome("Even",1); wheel.addOutcome(n , outcome_e); } else { Outcome outcome_o = new Outcome("Odd",1); wheel.addOutcome(n , outcome_o); } int[] Red = {1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36}; if (Arrays.binarySearch(Red, n) >= 0){ Outcome outcome_r = new Outcome("Red",1); wheel.addOutcome(n , outcome_r); } else { Outcome outcome_b = new Outcome("Black",1); wheel.addOutcome(n , outcome_b); } } } } NonRandom Class public class NonRandom { private long value; public void NonRandom(){ value = 0; } public int next(int bits) { return (int) value;
  • 11. } public void setSeed(long value) { this.value = value; } } Solution In the main method you are calling the i.next() and b.next() method twice in a loop which cause an error. I have made the changes. Kindly go through the changes that i have made. ------------------------------------------------code-------------------------------------------------------------- --------------------------------- import java.text.MessageFormat; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.ListIterator; import java.util.Set; import java.util.TreeSet; import java.util.Vector; import java.util.LinkedList; public class Game { public static void main(String[] args) { Table table = new Table(); BinBuilder bb = new BinBuilder(); Outcome black = new Outcome("Black", 35); Bet bet = new Bet(10, black); table.placeBet(bet); Bin bin = bb.wheel.get(8); System.out.println(bin.toString()); System.out.println(table.bets.toString()); System.out.println(black.toString());
  • 12. ListIterator i = table.bets.listIterator(); Iterator b = bin.outcomes.iterator(); while(i.hasNext()) { Outcome outcome=i.next().outcome; System.out.println(outcome); while(b.hasNext()){ Outcome binOutcome=b.next(); System.out.println(binOutcome); if(outcome.equals(binOutcome)){ System.out.println("Win!"); } else{ System.out.println("Win :/"); } } } } } class Player { public Table table; public Outcome black; public Bet bet; public Player(Table table) { table = new Table(); black = new Outcome("Black", 1); } void placeBets() { Bet bet = new Bet(100, black); table.placeBet(bet); }
  • 13. void win(Bet bet) { System.out.println("You've won: " + bet.winAmount()); } void lose(Bet bet) { System.out.println("You lost!" + bet.loseAmount() + ":/"); } } class Outcome implements Comparable { public String name; public int odds; public Outcome(String name, int odds){ this.name = name; this.odds = odds; } public int winAmount(int amount){ return amount*this.odds; } public boolean equals(Outcome other){ return (this.name.equals(other.name)); } public String toString() { Object[] values= { name, new Integer(odds) }; String msgTempl= "{0} ({1}:1)"; return MessageFormat.format( msgTempl, values ); } @Override public int compareTo(E arg0) { if(this.equals(arg0)){
  • 14. return 0; } return 1; } } class Table { public int limit = 1000; public LinkedListbets; public Table() { bets = new LinkedList(); } public boolean isValid(Bet bet) { int sum = 0; for(Bet bett: bets) { sum += bett.amountBet; } return (sum>limit); } public void placeBet(Bet bet) { bets.add(bet); } ListIterator iterator() { return bets.listIterator(); } } class Wheel extends TreeSet { Vector bins; NonRandom rng; Set all_outcomes;
  • 15. Wheel(NonRandom rng){ this.rng = rng; rng = new NonRandom(); all_outcomes = new TreeSet(); bins = new Vector(38); for (int i=0; i<38; i++){ bins.add(i, new Bin()); } } Bin next(){ int rand = rng.next(38); return bins.elementAt(rand); } Bin get(int bin){ return bins.elementAt(bin); } public Outcome getOutcome( String name ){ TreeSet result= new TreeSet(); for( Iterator i = all_outcomes.iterator(); i.hasNext(); ) { Outcome oc= i.next(); if( oc.name.contains(name) ) {result.add( oc );} } return result.first(); } public void addOutcome(int bin, Outcome outcome) { all_outcomes.add(outcome); this.bins.elementAt(bin).add(outcome);
  • 16. } } class Bet { public int amountBet; public Outcome outcome; public Bet(int amount, Outcome outcome) { this.outcome = outcome; this.amountBet = amount; } public int winAmount() { int winAmount = this.outcome.odds * this.amountBet; return winAmount + this.amountBet; } public int loseAmount() { int loseAmount = this.amountBet; return loseAmount; } public String toString() { return this.amountBet+" on "+"["+this.outcome.toString()+"]"; } } class Bin { public TreeSet outcomes; int i =0; Bin(){ outcomes = new TreeSet(); }
  • 17. Bin(Outcome[] outcomes){ this(); for(Outcome anOutcome: outcomes){ add(anOutcome); } } Bin(Collection outcomes){ this(); for(Outcome anOutcome: outcomes){ add(anOutcome); } } void add(Outcome outcome){ this.outcomes.add(outcome); } public String toString(){ String string =""; Iterator it1 =this.outcomes.iterator(); while(it1.hasNext()){ string += "["+it1.next().toString()+"]"; } return string; } } class BinBuilder { public Wheel wheel; public NonRandom nrng; public BinBuilder() {
  • 18. this.nrng = new NonRandom(); this.wheel = new Wheel(nrng); buildBins(wheel); } public Wheel getWheel() { return wheel; } private void buildBins(Wheel wheel){ straightBets(wheel); splitBets(wheel); streetBets(wheel); cornerBets(wheel); lineBets(wheel); dozenBets(wheel); columnBets(wheel); evenMoneyBets(wheel); } void straightBets(Wheel wheel){ for(int i = 1; i<37; i++){ Outcome outcome = new Outcome(""+i, 35); String u = ""+i; wheel.addOutcome(i , outcome); } } void splitBets(Wheel wheel){ for(int r = 0; r<12; r++){ int n = (3*r) +1; Outcome outcome = new Outcome("'"+n+", "+n+1+"'", 17); wheel.addOutcome(n , outcome); wheel.addOutcome(n+1 , outcome);
  • 19. n = (3*r) +2; Outcome outcome2 = new Outcome("'"+n+", "+n+1+"'", 17); wheel.addOutcome(n , outcome2); wheel.addOutcome(n+1, outcome2); } for(int n = 1; n<34; n++){ Outcome outcomen = new Outcome(n+", "+n+3, 17); wheel.addOutcome(n , outcomen); wheel.addOutcome(n+3 , outcomen); } } void streetBets(Wheel wheel){ for(int r = 0; r<12; r++){ int n = (3*r) +1; Outcome outcome = new Outcome(""+n, 11); wheel.addOutcome(n , outcome); wheel.addOutcome(n+1 , outcome); wheel.addOutcome(n+2 , outcome); } } void cornerBets(Wheel wheel){ for(int r = 0; r<11; r++){ int n = (3*r) +1; Outcome outcome = new Outcome(n +", " +n +1+", " +n +3+", " +n +4, 8); wheel.addOutcome(n , outcome); wheel.addOutcome(n+1 , outcome); wheel.addOutcome(n+3 , outcome);
  • 20. wheel.addOutcome(n+4 , outcome); int s = (3*r) +2; Outcome outcome2 = new Outcome(s +", "+ s +1+", "+ s+3+", "+ s +4, 17); wheel.addOutcome(n , outcome2); wheel.addOutcome(n+1, outcome2); wheel.addOutcome(n+3, outcome2); wheel.addOutcome(n+4, outcome2); } } void lineBets(Wheel wheel){ for(int r = 0; r<10; r++){ int n = (3*r) +1; Outcome outcome = new Outcome(n+", "+ (n +1)+","+ (n +2)+", "+ (n +3)+", "+ (n +4)+", "+ (n +5), 5); wheel.addOutcome(n , outcome); wheel.addOutcome(n+1 , outcome); wheel.addOutcome(n+2 , outcome); wheel.addOutcome(n+3 , outcome); wheel.addOutcome(n+4 , outcome); wheel.addOutcome(n+5 , outcome); } } void dozenBets(Wheel wheel){ for(int d = 0; d<3; d++){ Outcome outcome = new Outcome(""+(d+1), 2); for(int m = 0; m<12; m++){ wheel.addOutcome(12*d+m+1 , outcome); } } }
  • 21. void columnBets(Wheel wheel){ for(int c = 0; c<3; c++){ Outcome outcome = new Outcome(""+c+1,2); for(int r = 0; r<12; r++){ wheel.addOutcome((3*r)+c+1 , outcome); } } } void evenMoneyBets(Wheel wheel){ for(int n = 0; n<37; n++){ if(n>=1 && n<19){ Outcome outcome_l = new Outcome("Low",1); wheel.addOutcome(n , outcome_l); } else { Outcome outcome_h = new Outcome("High",1); wheel.addOutcome(n , outcome_h); } if(n%2==0){ Outcome outcome_e = new Outcome("Even",1); wheel.addOutcome(n , outcome_e); } else { Outcome outcome_o = new Outcome("Odd",1); wheel.addOutcome(n , outcome_o); } int[] Red = {1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36};
  • 22. if (Arrays.binarySearch(Red, n) >= 0){ Outcome outcome_r = new Outcome("Red",1); wheel.addOutcome(n , outcome_r); } else { Outcome outcome_b = new Outcome("Black",1); wheel.addOutcome(n , outcome_b); } } } } class NonRandom { private long value; public void NonRandom(){ value = 0; } public int next(int bits) { return (int) value; } public void setSeed(long value) { this.value = value; } } ------------------------------------------------output----------------------------------------------------- [8 (35:1)]['7, 71' (17:1)]['8, 81' (17:1)][5, 53 (17:1)][8, 83 (17:1)][7 (11:1)][4, 41, 43, 44 (8:1)][5, 51, 53, 54 (17:1)][7, 71, 73, 74 (8:1)][8, 81, 83, 84 (17:1)][4, 5,6, 7, 8, 9 (5:1)][7, 8,9, 10, 11, 12 (5:1)][1 (2:1)][11 (2:1)][Low (1:1)][Even (1:1)][Black (1:1)] [10 on [Black (35:1)]] Black (35:1) Black (35:1) 8 (35:1) Win :/ '7, 71' (17:1)
  • 23. Win :/ '8, 81' (17:1) Win :/ 5, 53 (17:1) Win :/ 8, 83 (17:1) Win :/ 7 (11:1) Win :/ 4, 41, 43, 44 (8:1) Win :/ 5, 51, 53, 54 (17:1) Win :/ 7, 71, 73, 74 (8:1) Win :/ 8, 81, 83, 84 (17:1) Win :/ 4, 5,6, 7, 8, 9 (5:1) Win :/ 7, 8,9, 10, 11, 12 (5:1) Win :/ 1 (2:1) Win :/ 11 (2:1) Win :/ Low (1:1) Win :/ Even (1:1) Win :/ Black (1:1) Win!