KOI ICT104: Game Development using GUI Application (Java) Project

Verified

Added on  2022/08/25

|5
|545
|18
Practical Assignment
AI Summary
This document presents a solution for a game development assignment focusing on creating a graphical user interface (GUI) application using Java. The game involves two players, one human and one computer, taking turns to pick beer bottles. The assignment details the game's introduction, algorithm, GUI components, and the process of picking bottles until the last one is chosen, which determines the winner. The solution includes Java code, explains the initialization of GUI components like JFrame, JLabel, and JTextArea, and describes the game's logic, including how the computer picks bottles randomly. The document also provides an example of the output, showing how the GUI displays the bottles and the changes as the game progresses. The assignment is designed for students in a programming course, like ICT104, to learn and apply GUI programming concepts in a game development context.
Document Page
Running head: GAME DEV USING GUI APPLICATION
GAME Dev using GUI application
Name of the Author
Name of the University
Author Note
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
1GAME DEV USING GUI APPLICATION
Create Java GUI application :
Introduction to the game:
The game application is in graphical user interface (GUI) based using java switch
components. There are 21 beer bottles is stored and the game is between two players. The
game application is about two players where one is user and another is computer. When
the game will start, a page is open wherein the above box a message is shown where
some description of the game is written. There is a possibility of getting a choice for who
will play first. Based on the choice game will start. If yes then user will pick a number
from 1 to 4. Then computer will pick the number from 1 to 4.This process is going till at
the end. Every time after user and computer will pick the number 1-4 the bottle will
decrease and in graphical user interface (GUI) page bottle will be deleted automatically.
If user is last pick then user will be the loser. Otherwise, computer will win. This is the
whole game process.
Algorithm of the program:
Step 1: Create a java class GameGuipage.java.
Step2: Declare a variable for accept value from player and computer.
Step 3: Declare java GUI component and Initiate all.
Step 4: Declare a constructor.
Step 5: Declare method initComponents ().
Step 6: In the method initComponents () we initialize all GUI components such as JFrame,
Jpanel, JLable, JTextArea, etc.
Document Page
2GAME DEV USING GUI APPLICATION
Step 7: Override the action performed () method in this method Player give a value (1-4) for pick
up the bottles, and the computer picks the bottles randomly (1-4). After choosing both Player and
computer Bottles are reduce from Application.
Step 8: If the Player chooses the last bottles, the user wins and pays the bill massage display.
Step 9: If the computer chooses the last bottle computer win and pay bill message display.
Step 10: Run the program.
Step 11: Show the GUI application.
Step 12: Player input the value within a range (1-4) is 2, So Computer chooses 3 randomly.
Step 13: the Aging player chooses bottles and The computers choose randomly.
Step 14: Step 13 repeat until all the bottles are picked up.
Step 15: If all bottles picked up, Who picks the last one win the match and Pay the bill massage
display
Document Page
3GAME DEV USING GUI APPLICATION
Output:
Here is the output of the GUI application where 21 bottle images are shown.
If user is pick any number for the artificial intelligent algorithm computer automatically
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
4GAME DEV USING GUI APPLICATION
pick any number from 1-4.So here when user is pick 3 computer automatically pick 2 for
that remaining bottles are 16 out of 21 and 5 bottles image are deleted.
chevron_up_icon
1 out of 5
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]