PROGRAM GAME LABIRIN MAZE
1. Tujuan
Program ini bertujuan untuk membuat user yang suka bermain game menikmati permainan maze
2. Sasaran user
Sasaran dari program ini yaitu para user yang sangat suka bermain game dan juga para user yang suka game game bertipe tantangan
3. Deskripsi
Game labirin maze adalah game dimana kita harus menuntun sebuah bola untuk keluar dari labirin. Game ini membutuhkan sebuah pemikiran agar kita dapat mengeluarkan bola dari labirin tersebut. Jika bola menabrak tembok labirin maka dianggap gagal dan akhirnya pun game over. Game ini membuat control a,s,d dimana fungsi a untuk bergerak ke kiri, s untuk bergerak ke bawah, dan d untuk bergerak ke kanan.
4. Pseudocode
Program Game_maze
{Program permainan labirin maze}
Deklarasi
move,coba,x,nama,user
:String;
Deskripsi
Println("
____________________________________________");
Println("|
|");
Println(“|
MAZE |");
Println("|____________________________________________|");
Println("
_____________________________________________");
Println("|
|");
Println("|-----------------CARA BERMAIN---------------|");
Println("|_____________________________________________|");
Println("|-
Gerakan ( o ) menuju finish dengan tombol |");
Println("|
a,s,d
|");
Println("|-
Control : a=kiri
|");
Println("| s=bawah |");
Println("| d=kanan |");
Println("|-
Gerakan bola keluar labirin
|");
Println("|-
Hindari labirin agar tidak game over
|");
Println("|-
Kesempatan bermain hanyalah sekali
|");
Println("
--------------------------------------------- ");
Writeln("Nama Pemain : ");
Read(nama);
Writeln("User id : ");
Read(User);
Println(" _______________________ ");
Println("| PEMAIN |");
Println("|"+nama+" |");
Println("|"+user+" |");
Println("| |");
Println("|
SELAMAT BERMAIN |");
Println("|_______________________|" );
Println("Tekan tombol apapun");
Read(x);
Println("---------------------");
Println(" mulai
o | |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Print(" Move = ");
Read(move);
if
(move.equals("s")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
o | | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" | | |---|
|");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Println("");}
else
if (move.equals("a")){
Println("---------------------");
Println(" mulai
| |");
Println("------|o |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" | |
|");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" | |--------|
|");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN
");
Println("________________________________");
Read(x);
Println("");}
else
if (move.equals("d")){
Println("---------------------");
Println(" mulai
| |");
Println("------| o|
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN
");
Println("________________________________");
Read(x);
Println("");}
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
o | | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Print(" Move = ");
Read(move)
if
(move.equals("s")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" | |
o |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" | |--------|
|");
Println("--|---| ");
Println("");}
else
if (move.equals("a")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" | |o |---|
|");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN
");
Println("________________________________");
Read(x);
Println("");}
else
if (move.equals("d")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| o|---| |");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN
");
Println("________________________________");
Read(x);
Println("");}
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| o |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Print(" Move = ");
Read(move);
if
(move.equals("s")){
Println("---------------------");
Println(" mulai
| |");
Println("------| | |
|");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| |");
Println(" |-----o-----| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN
");
Println("________________________________");
Read(x);
Println("");}
else
if (move.equals("a")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" | | |---|
|");
Println(" | | |");
Println(" | |o |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN
");
Println("________________________________");
Read(x);
Println("");}
else
if (move.equals("d")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| o |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Println("");}
Println("
mulai | |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| o |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Pring(" Move = ");
Read(move);
if
(move.equals("s")){
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| o
");
Println("");}
else
if (move.equals("a")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
|o |");
Println(" |
|--------| |");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println("
PLEASE PRESS F11 TO PLAY AGAIN ");
Println("________________________________");
Read(x);
Println("");}
else
if (move.equals("d")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| o|");
Println(" |
|--------| |");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN
");
Println("________________________________");
Read(x);
Println("");}
Println("
___________________________________");
Println("| |");
Println("| FINISH |");
Println("| |");
Println("| SELAMAT ANDA MENANG |");
Println("| |");
Println("|ANDA
TELAH MENYELESAIKAN GAME MAZE |");
Println("| |");
Println("|
APAKAH ANDA INGIN BERMAIN LAGI ?
|");
Println("| |");
Println("| (Y/N) |");
Println("| |");
Println("|___________________________________|");
Read(coba);
if(coba.equals("n")){
Println("
__________________________________");
Println("|M M|");
Println("|A TERIMAKASI TELAH BERMAIN A|");
Println("|Z HOPE YOU ENJOYED IT! Z|");
Println("|E________________________________E|");}
while
(coba.equals("y")){
Println("
____________________________________________");
Println("|
|");
Println(“| MAZE |");
Println("|____________________________________________|");
Println("
_____________________________________________");
Println("| |");
Println("|-----------------CARA BERMAIN---------------|");
Println("|_____________________________________________|");
Println("|-
Gerakan ( o ) menuju finish dengan tombol |");
Println("|
a,s,d
|");
Println("|-
Control : a=kiri
|");
Println("| s=bawah |");
Println("| d=kanan |");
Println("|-
Gerakan bola keluar labirin
|");
Println("|-
Hindari labirin agar tidak game over
|");
Println("|-
Kesempatan bermain hanyalah sekali
|");
Println("
--------------------------------------------- ");
Writeln("Nama Pemain : ");
Read(nama);
Writeln("User id : ");
Read(User);
Println(" _______________________ ");
Println("| PEMAIN |");
Println("|"+nama+" |");
Println("|"+user+" |");
Println("| |");
Println("|
SELAMAT BERMAIN |");
Println("|_______________________|" );
Println("Tekan tombol apapun");
Read(x);
Println("---------------------");
Println(" mulai
o | |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Print(" Move = ");
Read(move);
if
(move.equals("s")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
o | | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Println("");}
else
if (move.equals("a")){
Println("---------------------");
Println(" mulai
| |");
Println("------|o |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN
");
Println("________________________________");
Read(x);
Println("");}
else
if (move.equals("d")){
Println("---------------------");
Println(" mulai
| |");
Println("------| o|
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" | |
|");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" | |--------|
|");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN
");
Println("________________________________");
Read(x);
Println("");}
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
o | | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" | |
|---| |");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Print(" Move = ");
Read(move)
if
(move.equals("s")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" | | |");
Println(" |
| o |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Println("");}
else
if (move.equals("a")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
|o |---| |");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN
");
Println("________________________________");
Read(x);
Println("");}
else
if (move.equals("d")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" | | o|---|
|");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN
");
Println("________________________________");
Read(x);
Println("");}
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| o |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" | |
|");
Println(" |
|--------| |");
Println("--|---| ");
Print(" Move = ");
Read(move);
if
(move.equals("s")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" | |
|");
Println(" |-----o-----| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" | |--------|
|");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN
");
Println("________________________________");
Read(x);
Println("");}
else
if (move.equals("a")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
|o |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN
");
Println("________________________________");
Read(x);
Println("");}
else
if (move.equals("d")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" | | |---|
|");
Println(" |
| |");
Println(" |
| o |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Println("");}
Println("
mulai | |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| |
|");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| o |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| ");
Pring(" Move = ");
Read(move);
if
(move.equals("s")){
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" |
| |");
Println(" |
|--------| |");
Println("--|---| o
");
Println("");}
else
if (move.equals("a")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" |
|");
Println("--| |
|");
Println(" |
|o |");
Println(" |
|--------| |");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN
");
Println("________________________________");
Read(x);
Println("");}
else
if (move.equals("d")){
Println("---------------------");
Println(" mulai
| |");
Println("------| |
| |");
Println(" |
| | |");
Println(" |
| |----|");
Println(" |
| | |");
Println(" ---|
| | |");
Println(" |
| |---| |");
Println(" |
| |");
Println(" |
| |");
Println(" |-----------| |");
Println(" | |");
Println("--| |
|");
Println(" | |
o|");
Println(" |
|--------| |");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN
");
Println("________________________________");
Read(x);
Println("");}
Println("
___________________________________");
Println("| |");
Println("|
FINISH |");
Println("| |");
Println("| SELAMAT
ANDA MENANG |");
Println("| |");
Println("|ANDA TELAH MENYELESAIKAN GAME MAZE |");
Println("| |");
Println("| APAKAH ANDA INGIN BERMAIN LAGI ? |");
Println("| |");
Println("| (Y/N) |");
Println("| |");
Println("|___________________________________|");
Read(coba);
if(coba.equals("n")){
Println("
__________________________________");
Println("|M M|");
Println("|A TERIMAKASI
TELAH BERMAIN A|");
Println("|Z HOPE YOU
ENJOYED IT! Z|");
Println("|E________________________________E|");}
}}}}
Penjelasan mengenai pseudocode :
1. Deklarasi
move,coba,x,nama,user :String
=> bagian diatas menjelaskan bahwa program ini mempunyai 5 variabel yaitu move,coba,x,nama,user dan semua bertipe data String.
2. Println("---------------------");
Println(" mulai o | |");
Println("------| | | |");
Println(" | | | |");
Println(" | | |----|");
Println(" | | | |");
Println(" ---| | | |");
Println(" | | |---| |");
Println(" | | |");
Println(" | | |");
Println(" |-----------| |");
Println(" | |");
Println("--| | |");
Println(" | | |");
Println(" | |--------| |");
Println("--|---| ");
Print(" Move = ");
Read(move);
if (move.equals("s")){
Println("---------------------");
Println(" mulai | |");
Println("------| | | |");
Println(" | o | | |");
Println(" | | |----|");
Println(" | | | |");
Println(" ---| | | |");
Println(" | | |---| |");
Println(" | | |");
Println(" | | |");
Println(" |-----------| |");
Println(" | |");
Println("--| | |");
Println(" | | |");
Println(" | |--------| |");
Println("--|---| ");
Println("");}
else if (move.equals("a")){
Println("---------------------");
Println(" mulai | |");
Println("------|o | | |");
Println(" | | | |");
Println(" | | |----|");
Println(" | | | |");
Println(" ---| | | |");
Println(" | | |---| |");
Println(" | | |");
Println(" | | |");
Println(" |-----------| |");
Println(" | |");
Println("--| | |");
Println(" | | |");
Println(" | |--------| |");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN ");
Println("________________________________");
Read(x);
Println("");}
else if (move.equals("d")){
Println("---------------------");
Println(" mulai | |");
Println("------| o| | |");
Println(" | | | |");
Println(" | | |----|");
Println(" | | | |");
Println(" ---| | | |");
Println(" | | |---| |");
Println(" | | |");
Println(" | | |");
Println(" |-----------| |");
Println(" | |");
Println("--| | |");
Println(" | | |");
Println(" | |--------| |");
Println("--|---| ");
Println("");
Println("");
Println("________________________________");
Println(" GAME OVER ");
Println(" ANDA MENABRAK SEBUAH PEMBATAS ");
Println(" PLEASE PRESS F11 TO PLAY AGAIN ");
Println("________________________________");
Read(x);
Println("");}
=> Bagian diatas menjelaskan bahwa kita akan menginputkan sebuah gerakan entah itu a atau s atau d. Nah karena program menggunakan percanbangan else if maka jika kita menginputkan move a/d maka program akan mengeluarkan output gameover karena menabrak. Dan jika kita menginputkan move s maka program akan mengluarkan input lanjutan karena bola tidak menabrak
5. Flowchart
6. Screenshot Console
0 komentar:
Posting Komentar