-
Notifications
You must be signed in to change notification settings - Fork 0
/
BatuKertasGunting.cpp
152 lines (140 loc) · 5.12 KB
/
BatuKertasGunting.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#include <iostream> //library dasar
#include <windows.h> //library masuk ke system
//#include <conio.h> //library getch
#include <time.h> //library untuk time
using namespace std;
//fungsi void kesalahan
void kesalahan(){
cout<<" ---------------------- \n";
cout<<"| NOTE KESALAHAN |\n";
cout<<"| - Input Salah |\n";
cout<<"| - Masukkan angka 1-3 |\n";
cout<<" ---------------------- \n\n";
}
int main(){
awal :
int player, bot;
char jwb;
srand(time(0));
bot = rand()%3;
system("color a");
cout<<"========SELAMAT DATANG DI GAME========\n";Sleep(800);
cout<<"Choose Your Charracter\n";Sleep(700);
cout<<"1";Sleep(100);cout<<">";Sleep(100);cout<<" Batu\n";Sleep(200);
cout<<"2";Sleep(100);cout<<">";Sleep(100);cout<<" Kertas\n";Sleep(200);
cout<<"3";Sleep(100);cout<<">";Sleep(100);cout<<" Gunting\n";Sleep(200);
cout<<"\nP";Sleep(100);cout<<"I";Sleep(100);cout<<"L";Sleep(100);cout<<"I";Sleep(100);cout<<"H";cout<<" ";Sleep(100);cout<<"=";Sleep(100);cout<<"> ";Sleep(100);
cin>>player;
//If not integer(selain nomor) goto player;
if(cin.fail()){
cin.clear();
cin.ignore();
system("cls");
kesalahan();
goto awal;
}
//Message Box
switch (player){
case 1 :
MessageBox (NULL, "ANDA MEMILIH BATU", "NOTIFF", MB_OK);
break;
case 2 :
MessageBox (NULL, "ANDA MEMILIH KERTAS", "NOTIFF", MB_OK);
break;
case 3 :
MessageBox (NULL, "ANDA MEMILIH GUNTING", "NOTIFF", MB_OK);
}
//BATU/KERTAS/GUNTING ??
if (bot == 0){
switch (player){
case 1 :
cout<<"\nDANNNNN HASILNYAA";Sleep(800);cout<<". ";Sleep(800);cout<<". ";Sleep(800);cout<<". \n\n";
cout<<"==========> SERI <=========="<<endl;system("color 6");Sleep(100);//mengganti color kuning tua/oren
cout<<"Player = "<<player<<" BATU"<<endl;
cout<<"Bot = "<<bot+1<<" BATU"<<endl;
break;
case 2 :
cout<<"\nDANNNNN HASILNYAA";Sleep(800);cout<<". ";Sleep(800);cout<<". ";Sleep(800);cout<<". \n\n";
cout<<"==========> ANDA MENANG <=========="<<endl;system("color e");Sleep(100);//mengganti color kuning
cout<<"Player = "<<player<<" KERTAS"<<endl;
cout<<"Bot = "<<bot+1<<" BATU"<<endl;
break;
case 3 :
cout<<"\nDANNNNN HASILNYAA";Sleep(800);cout<<". ";Sleep(800);cout<<". ";Sleep(800);cout<<". \n\n";
cout<<"==========> ANDA KALAH <=========="<<endl;system("color 4");Sleep(100);//mengganti color merah
cout<<"Player = "<<player<<" GUNTING"<<endl;
cout<<"Bot = "<<bot+1<<" BATU"<<endl;
break;
default :
system("cls");
kesalahan();
goto awal;
}
}else if (bot == 1){
switch (player){
case 1 :
cout<<"\nDANNNNN HASILNYAA";Sleep(800);cout<<". ";Sleep(800);cout<<". ";Sleep(800);cout<<". \n\n";
cout<<"==========> ANDA KALAH <=========="<<endl;system("color 4");Sleep(100);//mengganti color merah
cout<<"Player = "<<player<<" BATU"<<endl;
cout<<"Bot = "<<bot+1<<" KERTAS"<<endl;
break;
case 2 :
cout<<"\nDANNNNN HASILNYAA";Sleep(800);cout<<". ";Sleep(800);cout<<". ";Sleep(800);cout<<". \n\n";
cout<<"==========> SERI <=========="<<endl;system("color 6");Sleep(100);//mengganti color kuning tua/oren
cout<<"Player = "<<player<<" KERTAS"<<endl;
cout<<"Bot = "<<bot+1<<" KERTAS"<<endl;
break;
case 3 :
cout<<"\nDANNNNN HASILNYAA";Sleep(800);cout<<". ";Sleep(800);cout<<". ";Sleep(800);cout<<". \n\n";
cout<<"==========> ANDA MENANG <=========="<<endl;system("color e");Sleep(100);//mengganti color kuning
cout<<"Player = "<<player<<" GUNTING"<<endl;
cout<<"Bot = "<<bot+1<<" KERTAS"<<endl;
break;
default :
system("cls");
kesalahan();
goto awal;
}
}else if (bot == 2){
switch (player){
case 1 :
cout<<"\nDANNNNN HASILNYAA";Sleep(800);cout<<". ";Sleep(800);cout<<". ";Sleep(800);cout<<". \n\n";
cout<<"==========> ANDA MENANG <=========="<<endl;system("color e");Sleep(100);//mengganti color kuning
cout<<"Player = "<<player<<" BATU"<<endl;
cout<<"Bot = "<<bot+1<<" GUNTING"<<endl;
break;
case 2 :
cout<<"\nDANNNNN HASILNYAA";Sleep(800);cout<<". ";Sleep(800);cout<<". ";Sleep(800);cout<<". \n\n";
cout<<"==========> ANDA KALAH <=========="<<endl;system("color 4");Sleep(100);//mengganti color merah
cout<<"Player = "<<player<<" KERTAS"<<endl;
cout<<"Bot = "<<bot+1<<" GUNTING"<<endl;
break;
case 3 :
cout<<"\nDANNNNN HASILNYAA";Sleep(800);cout<<". ";Sleep(800);cout<<". ";Sleep(800);cout<<". \n\n";
cout<<"=========> SERI <=========="<<endl;system("color 6");Sleep(100);//mengganti color kuning tua/oren
cout<<"Player = "<<player<<" GUNTING"<<endl;
cout<<"Bot = "<<bot+1<<" GUNTING"<<endl;
break;
default :
system("cls");
kesalahan();
goto awal;
}
}
//LAGI ??
//(y/n) =>
lagi :
cout<<"\nL";Sleep(200);cout<<"A";Sleep(200);cout<<"G";Sleep(200);cout<<"I";Sleep(200);cout<<"?\n";Sleep(200);cout<<"(y/n) => ";Sleep(200);
cin>>jwb;
if (jwb == 'y'){
system("cls");
goto awal;
} else if (jwb == 'n'){
cout<<"OKAY BYEE"<<endl;
}else{
cout<<"Masukkan salah\n";
goto lagi;
}
//PROGRAM BERAKHIR
MessageBox (NULL, "Terima kasih telah mencoba qaqa\nDatang lagi yaa ^3^", "BAI BAIII", MB_OK);
}