Computer Application
Computer Application
PROJECT
1. PROPOSAL LETTER
2. ACCEPTANCE LETTER
3. PROGRAM DESCRIPTION
4. VARIABLE LIST
5. PROGRAM CODE
6. OUTPUT SCREENS
7. ACKNOWLEDGEMENT
8. BIBLIOGRAPHY
PROPOSAL LETTER
Date: 10th December,2018.
To,
SPIEL STUDIOS PVT. LTD.,
7, Swastik Society,
Gulmohar Road,
Vile Parle(w),
Maharashtra-400056.
To,
A-604, Willows Tower,
Swapna Nagri,
Mulund(w),
Mumbia-400080.
In each turn a player may throw the dice up to three times. A player doesn't
have to roll all five dice on the second and third throw of a round, he may
put as many dice as he wants to the side and only throw the ones that don't
have the numbers he's trying to get. For example, a player throws and gets
1,3,3,4,6. He decides he want to try for the large straight, 1,2,3,4,5. So, he
puts 1,3,4 to the side and only throws 3 and 6 again, hoping to get 2 and 5.
In this game you click on the dice you want to keep. They will be moved
down and will not be thrown the next time you press the 'Roll Dice' button.
If you decide after the second throw in a turn that you don't want to keep
the same dice before the third throw then you can click them again and
they will move back to the table and be thrown in the third throw.
VARIABLE LIST
SR NO VARIABLE DATA TYPE USE
1. ch int To enter the user’s choice on the main
screen
2. cat int To enter the category number of user’s
choice
3. n1 int To store number shown on the 1st dice
4. n2 int To store number shown on the 2nd dice
5. n3 int To store number shown on the 3rd dice
6. n4 int To store number shown on the 4th dice
7. n5 int To store number shown on the 5th dice
8. n[ ] int To collect and store the numbers
shown on all dice
9. d1 int To indicate dice number 1
10. d2 int To indicate dice number 2
11. d3 int To indicate dice number 3
12. d4 int To indicate dice number 4
13. d5 int To indicate dice number 5
14. round int Indicates the round number for each
player
15. chance int Indicates the chance number in each
round
16. p_1[ ] int To store the points of player 1
//ctr1=ctr2=ctr3=ctr4=ctr5=ctr6=ctr7=ctr8=ctr9=ctr10=ctr11=ctr12=ctr13=
0;
void dice1()
{
Scanner sc= new Scanner(System.in);
int k1,k2,k3,k4,k5,k6;
k1=k2=k3=k4=k5=k6=1;
if(d1==1)
kd1=Math.random()*6+1;
n1=(int)kd1;
if(n1==1)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k1==5)
System.out.print(". ");
else
System.out.print(" ");
k1++;
}
System.out.println();
}
}
if(n1==2)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k2==3||k2==7)
System.out.print(". ");
else
System.out.print(" ");
k2++;
}
System.out.println();
}
}
if(n1==3)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k3==5||k3==3||k3==7)
System.out.print(". ");
else
System.out.print(" ");
k3++;
}
System.out.println();
}
}
if(n1==4)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k4==1||k4==7||k4==3||k4==9)
System.out.print(". ");
else
System.out.print(" ");
k4++;
}
System.out.println();
}
}
if(n1==5)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k5==5||k5==1||k5==3||k5==7||k5==9)
System.out.print(". ");
else
System.out.print(" ");
k5++;
}
System.out.println();
}
}
if(n1==6)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k6==1||k6==4||k6==7||k6==3||k6==6||k6==9)
System.out.print(". ");
else
System.out.print(" ");
k6++;
}
System.out.println();
}
}
System.out.print("DICE1");
}
void dice2()
{
int k1,k2,k3,k4,k5,k6;
k1=k2=k3=k4=k5=k6=1;
System.out.println();
System.out.println();
if(d2==1)
kd2=Math.random()*6+1;
n2=(int)kd2;
if(n2==1)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k1==5)
System.out.print(". ");
else
System.out.print(" ");
k1++;
}
System.out.println();
}
}
if(n2==2)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k2==3||k2==7)
System.out.print(". ");
else
System.out.print(" ");
k2++;
}
System.out.println();
}
}
if(n2==3)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k3==5||k3==3||k3==7)
System.out.print(". ");
else
System.out.print(" ");
k3++;
}
System.out.println();
}
}
if(n2==4)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k4==1||k4==7||k4==3||k4==9)
System.out.print(". ");
else
System.out.print(" ");
k4++;
}
System.out.println();
}
}
if(n2==5)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k5==5||k5==1||k5==3||k5==7||k5==9)
System.out.print(". ");
else
System.out.print(" ");
k5++;
}
System.out.println();
}
}
if(n2==6)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k6==1||k6==4||k6==7||k6==3||k6==6||k6==9)
System.out.print(". ");
else
System.out.print(" ");
k6++;
}
System.out.println();
}
}
System.out.print("DICE2");
}
void dice3()
{
int k1,k2,k3,k4,k5,k6;
k1=k2=k3=k4=k5=k6=1;
System.out.println();
System.out.println();
if(d3==1)
kd3=Math.random()*6+1;
n3=(int)kd3;
if(n3==1)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k1==5)
System.out.print(". ");
else
System.out.print(" ");
k1++;
}
System.out.println();
}
}
if(n3==2)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k2==3||k2==7)
System.out.print(". ");
else
System.out.print(" ");
k2++;
}
System.out.println();
}
}
if(n3==3)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k3==5||k3==3||k3==7)
System.out.print(". ");
else
System.out.print(" ");
k3++;
}
System.out.println();
}
}
if(n3==4)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k4==1||k4==7||k4==3||k4==9)
System.out.print(". ");
else
System.out.print(" ");
k4++;
}
System.out.println();
}
}
if(n3==5)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k5==5||k5==1||k5==3||k5==7||k5==9)
System.out.print(". ");
else
System.out.print(" ");
k5++;
}
System.out.println();
}
}
if(n3==6)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k6==1||k6==4||k6==7||k6==3||k6==6||k6==9)
System.out.print(". ");
else
System.out.print(" ");
k6++;
}
System.out.println();
}
}
System.out.print("DICE3");
}
void dice4()
{
int k1,k2,k3,k4,k5,k6;
int n;
k1=k2=k3=k4=k5=k6=1;
System.out.println();
System.out.println();
if(d4==1)
kd4=Math.random()*6+1;
n4=(int)kd4;
if(n4==1)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k1==5)
System.out.print(". ");
else
System.out.print(" ");
k1++;
}
System.out.println();
}
}
if(n4==2)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k2==3||k2==7)
System.out.print(". ");
else
System.out.print(" ");
k2++;
}
System.out.println();
}
}
if(n4==3)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k3==5||k3==3||k3==7)
System.out.print(". ");
else
System.out.print(" ");
k3++;
}
System.out.println();
}
}
if(n4==4)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k4==1||k4==7||k4==3||k4==9)
System.out.print(". ");
else
System.out.print(" ");
k4++;
}
System.out.println();
}
}
if(n4==5)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k5==5||k5==1||k5==3||k5==7||k5==9)
System.out.print(". ");
else
System.out.print(" ");
k5++;
}
System.out.println();
}
}
if(n4==6)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k6==1||k6==4||k6==7||k6==3||k6==6||k6==9)
System.out.print(". ");
else
System.out.print(" ");
k6++;
}
System.out.println();
}
}
System.out.print("DICE4");
}
void dice5()
{
int k1,k2,k3,k4,k5,k6;
k1=k2=k3=k4=k5=k6=1;
System.out.println();
System.out.println();
if(d5==1)
kd5=Math.random()*6+1;
n5=(int)kd5;
if(n5==1)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k1==5)
System.out.print(". ");
else
System.out.print(" ");
k1++;
}
System.out.println();
}
}
if(n5==2)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k2==3||k2==7)
System.out.print(". ");
else
System.out.print(" ");
k2++;
}
System.out.println();
}
}
if(n5==3)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k3==5||k3==3||k3==7)
System.out.print(". ");
else
System.out.print(" ");
k3++;
}
System.out.println();
}
}
if(n5==4)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k4==1||k4==7||k4==3||k4==9)
System.out.print(". ");
else
System.out.print(" ");
k4++;
}
System.out.println();
}
}
if(n5==5)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k5==5||k5==1||k5==3||k5==7||k5==9)
System.out.print(". ");
else
System.out.print(" ");
k5++;
}
System.out.println();
}
}
if(n5==6)
{
for(int i=1;i<=3;i++)
{
for(int j=1;j<=3;j++)
{
if(k6==1||k6==4||k6==7||k6==3||k6==6||k6==9)
System.out.print(". ");
else
System.out.print(" ");
k6++;
}
System.out.println();
}
}
System.out.print("DICE5");
}
void mainscreen()
{
/**int k=1;
for(int i=1;i<=3;i++)
{
System.out.print("\t\t\t\t\t\t\t\t\t");
for(int j=1;j<=11;j++)
{
if(k==4||k==6||k==8||k==12||k==14||k==15||k==19||k==22||k==23||k==25||
k==26||k==28||k==30)
System.out.print(" ");
else
System.out.print("*");
k++;
}
System.out.println();
}
k=1;
for(int i=1;i<=4;i++)
{
System.out.print("\t\t\t\t\t\t\t ");
for(int j=1;j<=32;j++)
{
if(k==2||k==4||k==8||k==10||k==12||k==18||k==23||k==28||k==36||k==38||
k==40||k==44||k==45||k==46||k==48||k==49||k==50||k==51||k==52||k==5
4||k==55||k==59||k==60||k==64||k==65||k==66||k==68||k==70||k==72||k=
=76||k==77||k==78||k==80||k==81||k==82||k==83||k==85||k==86||k==87||
k==91||k==92||k==96||k==97||k==100||k==102||k==104||k==106||k==108|
|k==109||k==110||k==112||k==113||k==114||k==119||k==124)
System.out.print(" ");
else
System.out.print("$");
k++;
}
System.out.println();
}*/
for(int i=0;i<16;i++)
{
p_1[i]=0;
p_2[i]=0;
}
flag=ctr1=ctr2=ctr3=ctr4=ctr5=ctr6=ctr7=ctr8=ctr9=ctr10=ctr11=ctr12=ctr
13=0;
c1=c2=c3=c4=c5=c6=c7=c8=c9=c10=c11=c12=c13=0;
int k=1;
for(int i=1;i<=5;i++)
{
//System.out.print("\t\t\t\t\t\t\t ");
for(int j=1;j<=41;j++)
{
if(k==1||k==5||k==10||k==16||k==19||k==21||k==22||k==23||k==24||k==25
||k==27||k==28||k==29||k==30||k==31||k==33||k==34||k==35||k==36||k==
38||k==39||k==40||k==41||k==43||k==45||k==50||k==52||k==57||k==60||k
==64||k==71||k==74||k==79||k==85||k==90||k==91||k==92||k==93||k==94
||k==98||k==99||k==100||k==101||k==105||k==111||k==115||k==116||k==
117||k==120||k==121||k==122||k==126||k==130||k==136||k==139||k==14
2||k==146||k==151||k==156||k==161||k==167||k==170||k==178||k==180||
k==183||k==187||k==191||k==192||k==193||k==194||k==195||k==197||k=
=198||k==199||k==200||k==202||k==203||k==204||k==205)
System.out.print("$");
else
System.out.print(" ");
k++;
}
System.out.println();
}
System.out.println();
System.out.println();
System.out.println();
System.out.println();
//System.out.print("\n\n\n\t\t\t\t\t\t\t");
String str="----WELCOME TO THE WORLD OF YAHTZEEE----";
for(int i=0;i<str.length();i++)
{
System.out.print(str.charAt(i));
for(long j=-10000000;j<=100000000;j++)
{}
}
System.out.println();
System.out.println();
System.out.println();
//System.out.print("\n\n\t\t\t\t\t\t\t ");
String str1="ENTER THE NUMBER TO SELECT YOUR MOVE....";
for(int i=0;i<str1.length();i++)
{
System.out.print(str1.charAt(i));
for(long j=-10000000;j<=100000000;j++)
{}
}
/*System.out.println();
System.out.print("\t\t\t\t\t\t\t\t\t ");
for(int i=0;i<4;i++)
{
System.out.print(".");
for(long j=-100000000;j<=100000000;j++)
{}
}
System.out.println();**/
System.out.println();
//System.out.println("\n\n");
//System.out.println("\t\t\t\t\t\t 1.START \t\t\t\t\t2.RULES &
REGULATIONS");
//System.out.println("\t\t\t\t\t\t 3.EXIT");
System.out.println("1.START");
System.out.println("2.RULES & REGULATIONS");
System.out.println("3.EXIT");
try
{
ch=sc.nextInt();
if(ch<1 ||ch>3)
{
System.out.println("INVALID ENTRY.....ENTER 1,2 OR 3");
t=true;
}
else
t=false;
}
catch(Exception e)
{
System.out.println("INVALID ENTRY.....ENTER 1,2 OR 3");
t=true;
}
}while(t);
if(ch==1)
{
k=1;
System.out.print("\n\n\n\n\n");
//System.out.print("\t\t\t\t\t\t\t\t\t");
String str2="LET'S ROLL :)";
for(int i=0;i<str2.length();i++)
{
System.out.print(str2.charAt(i));
for(long j=-100000000;j<=100000000;j++)
{}
/**for(int j=1;j<=34;j++)
{
if(k==1||k==35||k==69||k==70||k==71||k==28||k==62||k==96||k==97||k==9
8||k==32||k==66||k==100||k==101||k==102)
System.out.print("L");
else if(k==5||k==7||k==6||k==40||k==39||k==75||k==73||k==74)
System.out.print("E");
else if(k==11||k==9||k==78||k==10||k==44)
System.out.print("T");
else if(k==14||k==13||k==47||k==80||k==81)
System.out.print("S");
else if(k==20||k==54||k==88||k==21||k==55||k==90)
System.out.print("R");
else
if(k==25||k==24||k==26||k==58||k==60||k==92||k==93||k==94)
System.out.print("O");
else
System.out.print(" ");
k++;
}
System.out.println();*/
}
for(long l=-10000000;l<=100000000;l++)
{}
for(long l=-10000000;l<=100000000;l++)
{}
for(long l=-10000000;l<=100000000;l++)
{}
System.out.print("\f");
loading();
for(long l=-10000000;l<=100000000;l++)
{}
for(long l=-10000000;l<=100000000;l++)
{}
System.out.print("\f");
gamepage();
}
else if(ch==2)
{
System.out.print("\f");
rules();
}
void rules()
{
System.out.println("YAHTZEE RULES");
System.out.println("->The objective of YAHTZEE is to get as many
points as possible by rolling five dice and getting certain combinations of
dice. ");
System.out.println("GAMEPLAY");
System.out.println("->In each turn a player may throw the dice up to
three times. A player doesn't have to roll all five dice on the second and
third throw of a round,\nhe may put as many dice as he wants to the side
and only throw the ones that don't have the numbers he's trying to get.
For example, a player throws and \ngets 1,3,3,4,6. He decides he want
to try for the large straight, 1,2,3,4,5. So, he puts 1,3,4 to the side and
only throws 3 and 6 again, hoping to get 2\nand 5.");
System.out.println("->In this game you click on the dice you want to
keep. They will be moved down and will not be thrown the next time you
press the 'Roll Dice' button. \nIf you decide after the second throw in a
turn that you don't want to keep the same dice before the third throw
then you can click them again and they \nwill move back to the table and
be thrown in the third throw. ");
System.out.println("->Upper section combinations");
System.out.println("->Ones: Get as many ones as possible.");
System.out.println("->Twos: Get as many twos as possible.");
System.out.println("->Threes: Get as many threes as possible.");
System.out.println("->Fours: Get as many fours as possible.");
System.out.println("->Fives: Get as many fives as possible.");
System.out.println("->Sixes: Get as many sixes as possible.");
System.out.println("->For the six combinations above the score for
each of them is the sum of dice of the right kind. E.g. if you get 1,3,3,3,5
and you choose Threes you will\nget 3*3 = 9 points. The sum of all the
above combinations is calculated and if it is 63 or more, the player will
get a bonus of 35 points. On average\na player needs three of each to
reach 63, but it is not required to get three of each exactly, it is perfectly
OK to have five sixes, and zero ones\nfor example, as long as the sum
is 63 or more the bonus will be awarded. ");
System.out.println("->Lower section combinations");
System.out.println("->Three of a kind: Get three dice with the same
number. Points are the sum all dice (not just the three of a kind).");
System.out.println("->Four of a kind: Get four dice with the same
number. Points are the sum all dice (not just the four of a kind).");
System.out.println("->Full house: Get three of a kind and a pair, e.g.
1,1,3,3,3 or 3,3,3,6,6. Scores 25 points.");
System.out.println("->Small straight: Get four sequential dice,
1,2,3,4 or 2,3,4,5 or 3,4,5,6. Scores 30 points.");
System.out.println("->Large straight: Get five sequential dice,
1,2,3,4,5 or 2,3,4,5,6. Scores 40 points.");
System.out.println("->Chance: You can put anything into chance,
it's basically like a garbage can when you don't have anything else you
can use the dice for. The score is\nsimply the sum of the dice.");
System.out.println("->YAHTZEE: Five of a kind. Scores 50 points.");
/*System.out.println("Multiple Yahtzees");
System.out.println("There are a couple of different cases:");
System.out.println("You already have a Yahtzee: You get a 100
bonus points in the Yahtzee box, but you also have a joker, which
means that you can choose another move for\nthe Yahtzee you just got.
If the number you got yahtzees with has not been filled out in the upper
section, then you must choose that. E.g. if you get\nan additional
Yahtzee with 2's, and you haven't filled out the 2's in the upper section
then you must choose that, and get 10 points for it. If the\nupper section
box is already filled then you can choose any of the lower region boxes,
and they will be scored as normal. Yahtzee is a superset of\n3 of a kind,
4 of a kind, full house and chance, but you can also choose small or
large straight and will get the normal 30 and 40 points for those.");
System.out.println("You've already put 0 in the Yahtzee box: In this
case you get no 100 point bonus, but you do get a joker, and can
choose your move following the rules\ndescribed above for jokers. ");**/
System.out.println("Strategy tips");
System.out.println("->Try to get the bonus. Focus on getting good
throws with fives and sixes, then it won't matter if you put 0\nin the ones
or twos. You can always put in 0 for a combination if you don't have it,
even if you have some other combination. E.g. if you had 2,3,4,5,6\nand
the only things you had left were Ones and Sixes, then it would be better
to put 0 in Ones than to put only 6 in Sixes. ");
System.out.println("Maximum score");
System.out.println("->The maximum possible score is 375, and you
would get that by getting 5 ones (5), 5 twos (10), 5 threes (15), 5 fours
(20),\n5 fives (25), 5 sixes (30), get the bonus points (35), five sixes (30)
for three of a kind, five sixes (30) for four of a kind, get a full house
(25),\nget a small straight (30), get a large straight (40), five sixes for
chance (30), get a YAHTZEE (50).\n5 + 10 + 15 + 20 + 25 + 30 + 35 +
30 + 30 + 25 + 30 + 40 + 30 + 50 = 375! ");
System.out.println();
System.out.println();
System.out.println();
System.out.println("ENTER 1 TO START PLAYING AND 2 TO
RETURN TO MAIN MENU");
int rr=0;
boolean t=true;
do
{
Scanner sc=new Scanner(System.in);
try
{
rr=sc.nextInt();
if(rr<1 ||rr>2)
{
System.out.println("INVALID ENTRY.....ENTER 1 OR 2");
t=true;
}
else
t=false;
}
catch(Exception e)
{
System.out.println("INVALID ENTRY.....ENTER 1 OR 2");
t=true;
}
}while(t);
if(rr==1)
{
System.out.print("\f");
loading();
for(long l=-10000000;l<=100000000;l++)
{}
for(long l=-10000000;l<=100000000;l++)
{}
System.out.print("\f");
gamepage();
}
else if(rr==2)
{
System.out.print("\f");
mainscreen();
}
else
{
System.out.print("\f");
rules();
}
}
void loading()
{
String str3="LOADING....";
for( int i=0;i<4;i++)
{
//System.out.print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t\t\t\t\t");
for(int j=0;j<str3.length();j++)
{
System.out.print(str3.charAt(j));
for(long l=-10000000;l<=100000000;l++)
{}
}
if(i<3)
System.out.print("\u000c");
else
{
System.out.print("\u000c");
//System.out.print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t\t\t\t\t"+str3);
System.out.print(str3);
}
void alldice()
{
dice1();
dice2();
dice3();
dice4();
dice5();
n[0]=n1;
n[1]=n2;
n[2]=n3;
n[3]=n4;
n[4]=n5;
}
void scorepage()
{
//int
o=0,t=0,th=0,f=0,fi=0,s=0,tok=0,fok=0,fh=0,ss=0,ls=0,c=0,y=0,b=0,total=
0,TS=0;
int k=0,temp=0,l=0,m=0,c=0,a=0;
flag=0;
//alldice();
System.out.println("\t\t\tP_1\tP_2\t\t\t\t\t\t P_1 P_2");
System.out.println("1.ONES \t\t\t "+p_1[0]+"\t "+p_2[0]+"\t\t\t
7.THREE OF A KIND\t "+p_1[8]+"\t "+p_2[8]);
System.out.println("2.TWOS \t\t\t "+p_1[1]+"\t "+p_2[1]+"\t\t\t
8.FOUR OF A KIND\t "+p_1[9]+"\t "+p_2[9]);
System.out.println("3.THREES \t\t "+p_1[2]+"\t "+p_2[2]+" \t\t\t
9.FULL HOUSE\t\t "+p_1[10]+"\t "+p_2[10]);
System.out.println("4.FOURS \t\t "+p_1[3]+"\t "+p_2[3]+"\t\t\t
10.SMALL STRAIGHT\t "+p_1[11]+"\t "+p_2[11]);
System.out.println("5.FIVES \t\t "+p_1[4]+"\t "+p_2[4]+"\t\t\t
11.LARGE STRAIGHT \t "+p_1[12]+"\t "+p_2[12]);
System.out.println("6.SIXES \t\t "+p_1[5]+"\t "+p_2[5]+"\t\t\t
12.CHANCE\t\t "+p_1[13]+"\t "+p_2[13]);
System.out.println(" SUM \t\t "+p_1[6]+"\t "+p_2[6]+"\t\t\t
13.YAHTZEE\t\t "+p_1[14]+"\t "+p_2[14]);
System.out.println(" BONUS \t\t "+p_1[7]+"\t "+p_2[7]+"\t\t\t
TOTAL SCORE \t "+p_1[15]+"\t "+p_2[15]);
try
{
cat=sc.nextInt();
if(cat<1 ||cat>13)
{
System.out.println("INVALID ENTRY.....ENTER NUMBER
FROM 1 TO 13");
t=true;
}
else
t=false;
}
catch(Exception e)
{
System.out.println("INVALID ENTRY.....ENTER NUMBER
FROM 1 TO 13");
t=true;
}
}while(t);
if(cp==1)
{
if(cat==1)
{
if(ctr1==0)
{
if(n1==1)
p_1[0]+=1;
if(n2==1)
p_1[0]+=1;
if(n3==1)
p_1[0]+=1;
if(n4==1)
p_1[0]+=1;
if(n5==1)
p_1[0]+=1;
ctr1=1;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==2 )
{
if(ctr2==0)
{
if(n1==2)
p_1[1]+=2;
if(n2==2)
p_1[1]+=2;
if(n3==2)
p_1[1]+=2;
if(n4==2)
p_1[1]+=2;
if(n5==2)
p_1[1]+=2;
ctr2++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==3)
{
if(ctr3==0)
{
if(n1==3)
p_1[2]+=3;
if(n2==3)
p_1[2]+=3;
if(n3==3)
p_1[2]+=3;
if(n4==3)
p_1[2]+=3;
if(n5==3)
p_1[2]+=3;
ctr3++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==4)
{
if(ctr4==0)
{
if(n1==4)
p_1[3]+=4;
if(n2==4)
p_1[3]+=4;
if(n3==4)
p_1[3]+=4;
if(n4==4)
p_1[3]+=4;
if(n5==4)
p_1[3]+=4;
ctr4++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==5)
{
if(ctr5==0)
{
if(n1==5)
p_1[4]+=5;
if(n2==5)
p_1[4]+=5;
if(n3==5)
p_1[4]+=5;
if(n4==5)
p_1[4]+=5;
if(n5==5)
p_1[4]+=5;
ctr5++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==6)
{
if(ctr6==0)
{
if(n1==6)
p_1[5]+=6;
if(n2==6)
p_1[5]+=6;
if(n3==6)
p_1[5]+=6;
if(n4==6)
p_1[5]+=6;
if(n5==6)
p_1[5]+=6;
ctr6++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==7)
{
if(ctr7==0)
{
for(int i=0;i<4;i++)
{
for(int j=i+1;j<5;j++)
{
if(n[i]==n[j])
{
k++;
}
if(k==2)
break;
}
if(k==2)
break;
}
if(k==2)
p_1[8]=n1+n2+n3+n4+n5;
ctr7++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==8)
{
if(ctr8==0)
{
if((n2==n3 && n2==n4 && n2==n5)||(n1==n3 && n1==n4 &&
n1==n5)||(n1==n2 && n1==n4 && n1==n5)||(n1==n2 && n1==n3 &&
n1==n5)||(n1==n2 && n1==n3 && n1==n4))
p_1[9]=n1+n2+n3+n4+n5;
ctr8++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==9)
{
if(ctr9==0)
{
for(int i=0;i<4;i++)
{
for(int j=i+1;j<5;j++)
{
if(n[i]==n[j])
{
l++;
}
if(l==2)
{
temp=n[i];
break;
}
}
if(l==2)
break;
}
if(l==2)
{
for(int i=0;i<4;i++)
{
if(n[i]!=temp)
{
for(int j=i+1;j<5;j++)
{
if(n[i]==n[j])
l++;
}
}
}
}
if(l==3)
p_1[10]=25;
ctr9++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==10)
{
if(ctr10==0)
{
for(int i=0;i<5;i++)
{
c=m;
for(int j=0;j<5;j++)
{
if(n[i]!=n[j])
{
if(n[i]==(n[j]+1))
{
m++;
if(m==(c+1)||m==3)
break;
}
}
if(m==3)
break;
}
if(m==3)
break;
}
if(m==3)
p_1[11]=30;
ctr10++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==11)
{
if(ctr11==0)
{
for(int i=0;i<5;i++)
{
c=a;
for(int j=0;j<5;j++)
{
if(n[i]!=n[j])
{
if(n[i]==(n[j]+1))
{
a++;
if(a==(c+1))
break;
}
if(a==4)
p_1[12]=40;
ctr11++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==12)
{
if(ctr12==0)
{
p_1[13]=n1+n2+n3+n4+n5;
ctr12++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==13)
{
}
}
if(cp==2)
{
if(cat==1)
{
if(c1==0)
{
if(n1==1)
p_2[0]+=1;
if(n2==1)
p_2[0]+=1;
if(n3==1)
p_2[0]+=1;
if(n4==1)
p_2[0]+=1;
if(n5==1)
p_2[0]+=1;
c1=1;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==2 )
{
if(c2==0)
{
if(n1==2)
p_2[1]+=2;
if(n2==2)
p_2[1]+=2;
if(n3==2)
p_2[1]+=2;
if(n4==2)
p_2[1]+=2;
if(n5==2)
p_2[1]+=2;
c2++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==3)
{
if(c3==0)
{
if(n1==3)
p_2[2]+=3;
if(n2==3)
p_2[2]+=3;
if(n3==3)
p_2[2]+=3;
if(n4==3)
p_2[2]+=3;
if(n5==3)
p_2[2]+=3;
c3++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==4)
{
if(c4==0)
{
if(n1==4)
p_2[3]+=4;
if(n2==4)
p_2[3]+=4;
if(n3==4)
p_2[3]+=4;
if(n4==4)
p_2[3]+=4;
if(n5==4)
p_2[3]+=4;
c4++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==5)
{
if(c5==0)
{
if(n1==5)
p_2[4]+=5;
if(n2==5)
p_2[4]+=5;
if(n3==5)
p_2[4]+=5;
if(n4==5)
p_2[4]+=5;
if(n5==5)
p_2[4]+=5;
c5++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==6)
{
if(c6==0)
{
if(n1==6)
p_2[5]+=6;
if(n2==6)
p_2[5]+=6;
if(n3==6)
p_2[5]+=6;
if(n4==6)
p_2[5]+=6;
if(n5==6)
p_2[5]+=6;
c6++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==7)
{
if(c7==0)
{
for(int i=0;i<4;i++)
{
for(int j=i+1;j<5;j++)
{
if(n[i]==n[j])
{
k++;
}
if(k==2)
break;
}
if(k==2)
break;
}
if(k==2)
p_2[8]=n1+n2+n3+n4+n5;
c7++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==8)
{
if(c8==0)
{
if((n2==n3 && n2==n4 && n2==n5)||(n1==n3 && n1==n4 &&
n1==n5)||(n1==n2 && n1==n4 && n1==n5)||(n1==n2 && n1==n3 &&
n1==n5)||(n1==n2 && n1==n3 && n1==n4))
p_2[9]=n1+n2+n3+n4+n5;
c8++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==9)
{
if(c9==0)
{
for(int i=0;i<4;i++)
{
for(int j=i+1;j<5;j++)
{
if(n[i]==n[j])
{
l++;
}
if(l==2)
{
temp=n[i];
break;
}
}
if(l==2)
break;
}
if(l==2)
{
for(int i=0;i<4;i++)
{
if(n[i]!=temp)
{
for(int j=i+1;j<5;j++)
{
if(n[i]==n[j])
l++;
}
}
}
}
if(l==3)
p_2[10]=25;
c9++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==10)
{
if(c10==0)
{
for(int i=0;i<5;i++)
{
c=m;
for(int j=0;j<5;j++)
{
if(n[i]!=n[j])
{
if(n[i]==(n[j]+1))
{
m++;
if(m==(c+1)||m==3)
break;
}
if(m==3)
break;
}
if(m==3)
break;
}
if(m==3)
p_2[11]=30;
c10++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==11)
{
if(c11==0)
{
for(int i=0;i<5;i++)
{
c=a;
for(int j=0;j<5;j++)
{
if(n[i]!=n[j])
{
if(n[i]==(n[j]+1))
{
a++;
if(a==(c+1))
break;
}
if(a==4)
p_2[12]=40;
c11++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==12)
{
if(c12==0)
{
p_2[13]=n1+n2+n3+n4+n5;
c12++;
}
else
{
System.out.println("YOU HAVE ALREADY USED THIS
COMBINATION......PLEASE ENTER ANOTHER CATEGORY
NUMBER");
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
for(long i=-10000000;i<=10000000;i++)
{}
scorepage();
}
}
else if(cat==13)
{
}
}
if(flag==0)
{
System.out.println("\t\t\tP_1\tP_2\t\t\t\t\t\t P_1 P_2");
System.out.println("1.ONES \t\t\t "+p_1[0]+"\t "+p_2[0]+"\t\t\t
7.THREE OF A KIND\t "+p_1[8]+"\t "+p_2[8]);
System.out.println("2.TWOS \t\t\t "+p_1[1]+"\t "+p_2[1]+"\t\t\t
8.FOUR OF A KIND\t "+p_1[9]+"\t "+p_2[9]);
System.out.println("3.THREES \t\t "+p_1[2]+"\t "+p_2[2]+" \t\t\t
9.FULL HOUSE\t\t "+p_1[10]+"\t "+p_2[10]);
System.out.println("4.FOURS \t\t "+p_1[3]+"\t "+p_2[3]+"\t\t\t
10.SMALL STRAIGHT\t "+p_1[11]+"\t "+p_2[11]);
System.out.println("5.FIVES \t\t "+p_1[4]+"\t "+p_2[4]+"\t\t\t
11.LARGE STRAIGHT \t "+p_1[12]+"\t "+p_2[12]);
System.out.println("6.SIXES \t\t "+p_1[5]+"\t "+p_2[5]+"\t\t\t
12.CHANCE\t\t "+p_1[13]+"\t "+p_2[13]);
System.out.println(" SUM \t\t "+p_1[6]+"\t "+p_2[6]+"\t\t\t
13.YAHTZEE\t\t "+p_1[14]+"\t "+p_2[14]);
System.out.println(" BONUS \t\t "+p_1[7]+"\t "+p_2[7]+"\t\t\t
TOTAL SCORE \t "+p_1[15]+"\t "+p_2[15]);
flag=1;
}
void gamepage()
{
int round1=1,round2=1;
int count=0;
for(int i=1;i<=26;i++)
{
d1=1;
d2=1;
d3=1;
d4=1;
d5=1;
int ctr=0;
String sp="";
String di1="";
String di2="";
String di3="";
String di4="";
String di5="";
String skip="";
if(i%2==1)
{
cp=1;
System.out.println("P_1");
System.out.println("ROUND "+round1);
for(chance=1;chance<=3;chance++)
{
System.out.println("Chance "+chance);
alldice();
di1=di2=di3=di4=di5="";
d1=d2=d3=d4=d5=1;
System.out.println();
if(chance==1||chance==2)
{
System.out.println("DO YOU WANT TO END THE
CHANCE AND ENTER YOUR POINTS?(ENTER Y/y TO END)");
sp=sc.nextLine();
if(sp.equalsIgnoreCase("y"))
{
ctr=1;
scorepage();
break;
}
else
{
System.out.println("DO YOU WANT TO SKIP ANY
DICE?(ENTER Y/y TO SKIP)");
skip=sc.nextLine();
if(skip.equalsIgnoreCase("y"))
{
System.out.println("DO YOU WANT TO SKIP
DICE1?(ENTER Y/y TO SKIP)");
di1=sc.nextLine();
if(di1.equalsIgnoreCase("y"))
d1=0;
System.out.println("DO YOU WANT TO SKIP
DICE2?(ENTER Y/y TO SKIP)");
di2=sc.nextLine();
if(di2.equalsIgnoreCase("y"))
d2=0;
System.out.println("DO YOU WANT TO SKIP
DICE3?(ENTER Y/y TO SKIP)");
di3=sc.nextLine();
if(di3.equalsIgnoreCase("y"))
d3=0;
System.out.println("DO YOU WANT TO SKIP
DICE4?(ENTER Y/y TO SKIP)");
di4=sc.nextLine();
if(di4.equalsIgnoreCase("y"))
d4=0;
System.out.println("DO YOU WANT TO SKIP
DICE5?(ENTER Y/y TO SKIP)");
di5=sc.nextLine();
if(di5.equalsIgnoreCase("y"))
d5=0;
}
}
}
round1++;
if(ctr!=1)
{
/*for(long a=-10000000;a<=10000000;a++)
{for(long j=-10000000;j<=10000000;j++)
{for(long k=-10000000;k<=10000000;k++)
}}**/
scorepage();
}
}
if(i%2==0)
{
cp=2;
System.out.println("P_2");
System.out.println("ROUND "+round2);
for( chance=1;chance<=3;chance++)
{
System.out.println("Chance "+chance);
alldice();
di1=di2=di3=di4=di5="";
d1=d2=d3=d4=d5=1;
System.out.println();
if(chance==1||chance==2)
{
System.out.println("DO YOU WANT TO END THE
CHANCE AND ENTER YOUR POINTS?(ENTER Y/y TO END)");
sp=sc.nextLine();
if(sp.equalsIgnoreCase("y"))
{
ctr=1;
scorepage();
break;
}
else
{
System.out.println("DO YOU WANT TO SKIP ANY
DICE?(ENTER Y/y TO SKIP)");
skip=sc.nextLine();
if(skip.equalsIgnoreCase("y"))
{
System.out.println("DO YOU WANT TO SKIP
DICE1?(ENTER Y/y TO SKIP)");
di1=sc.nextLine();
if(di1.equalsIgnoreCase("y"))
d1=0;
System.out.println("DO YOU WANT TO SKIP
DICE2?(ENTER Y/y TO SKIP)");
di2=sc.nextLine();
if(di2.equalsIgnoreCase("y"))
d2=0;
System.out.println("DO YOU WANT TO SKIP
DICE3?(ENTER Y/y TO SKIP)");
di3=sc.nextLine();
if(di3.equalsIgnoreCase("y"))
d3=0;
System.out.println("DO YOU WANT TO SKIP
DICE4?(ENTER Y/y TO SKIP)");
di4=sc.nextLine();
if(di4.equalsIgnoreCase("y"))
d4=0;
System.out.println("DO YOU WANT TO SKIP
DICE5?(ENTER Y/y TO SKIP)");
di5=sc.nextLine();
if(di5.equalsIgnoreCase("y"))
d5=0;
}
}
}
//System.out.println("HI");
round2++;
if(ctr!=1)
{
/*for(long a=-10000000;a<=10000000;a++)
{for(long j=-10000000;j<=10000000;j++)
{for(long k=-10000000;k<=10000000;k++)
{}}**/
scorepage();
}
}
System.out.println("ENTER 1 TO RETURN TO MAIN MENU
AND ENTER ANY OTHER NUMBER TO CONTINUE PLAYING");
//int mm=sc.nextInt();
int mm=0;
boolean t=true;
do
{
Scanner sc=new Scanner(System.in);
try
{
mm=sc.nextInt();
/*if(ch<1 ||ch>3)
{
System.out.println("INVALID ENTRY.....ENTER 1,2 OR 3");
temp=true;
}
else**/
t=false;
}
catch(Exception e)
{
System.out.println("INVALID ENTRY.....ENTER 1 OR ANY
OTHER NUMBER");
t=true;
}
}while(t);
if(mm==1)
{
count=1;
break;
}
//System.out.println("HI");
}
if(count==1)
{
System.out.print("\f");
mainscreen();
}
else
{
p_1[6]=p_1[0]+p_1[1]+p_1[2]+p_1[3]+p_1[4]+p_1[5];
p_2[6]=p_2[0]+p_2[1]+p_2[2]+p_2[3]+p_2[4]+p_2[5];
if(p_1[6]>=63)
p_1[7]=35;
if(p_2[6]>=63)
p_2[7]=35;
p_1[15]=p_1[6]+p_1[7]+p_1[8]+p_1[9]+p_1[10]+p_1[11]+p_1[12]+p_1[13
]+p_1[14];
p_2[15]=p_2[6]+p_2[7]+p_2[8]+p_2[9]+p_2[10]+p_2[11]+p_2[12]+p_2[13
]+p_2[14];
System.out.print("\f");
System.out.println("FINAL SCORES");
System.out.println();
System.out.println("\t\t\tP_1\tP_2\t\t\t\t\t\t P_1 P_2");
System.out.println("1.ONES \t\t\t "+p_1[0]+"\t "+p_2[0]+"\t\t\t
7.THREE OF A KIND\t "+p_1[8]+"\t "+p_2[8]);
System.out.println("2.TWOS \t\t\t "+p_1[1]+"\t "+p_2[1]+"\t\t\t
8.FOUR OF A KIND\t "+p_1[9]+"\t "+p_2[9]);
System.out.println("3.THREES \t\t "+p_1[2]+"\t "+p_2[2]+" \t\t\t
9.FULL HOUSE\t\t "+p_1[10]+"\t "+p_2[10]);
System.out.println("4.FOURS \t\t "+p_1[3]+"\t "+p_2[3]+"\t\t\t
10.SMALL STRAIGHT\t "+p_1[11]+"\t "+p_2[11]);
System.out.println("5.FIVES \t\t "+p_1[4]+"\t "+p_2[4]+"\t\t\t
11.LARGE STRAIGHT \t "+p_1[12]+"\t "+p_2[12]);
System.out.println("6.SIXES \t\t "+p_1[5]+"\t "+p_2[5]+"\t\t\t
12.CHANCE\t\t "+p_1[13]+"\t "+p_2[13]);
System.out.println(" SUM \t\t "+p_1[6]+"\t "+p_2[6]+"\t\t\t
13.YAHTZEE\t\t "+p_1[14]+"\t "+p_2[14]);
System.out.println(" BONUS \t\t "+p_1[7]+"\t "+p_2[7]+"\t\t\t
TOTAL SCORE \t "+p_1[15]+"\t "+p_2[15]);
if(p_1[15]>p_2[15])
{
System.out.println();
System.out.println();
System.out.println();
System.out.println();
System.out.println();
System.out.println("PLAYER 1 WINS");
}
else if(p_1[15]<p_2[15])
{
System.out.println();
System.out.println();
System.out.println();
System.out.println();
System.out.println();
System.out.println("PLAYER 2 WINS");
}
else
{
System.out.println();
System.out.println();
System.out.println();
System.out.println();
System.out.println();
System.out.println("DRAW");
}
try
{
mm1=sc.nextInt();
/*if(ch<1 ||ch>3)
{
System.out.println("INVALID ENTRY.....ENTER 1,2 OR 3");
temp=true;
}
else**/
t=false;
}
catch(Exception e)
{
System.out.println("INVALID ENTRY.....ENTER 1 OR ANY
OTHER NUMBER");
t=true;
}
}while(t);
if(mm1==1)
{
System.out.print("\f");
mainscreen();
}
else
{
System.out.print("\f");
System.out.println("THANK YOU FOR PLAYING (:");
}
}
}