Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 2.27 KB

README.md

File metadata and controls

49 lines (39 loc) · 2.27 KB

Dice_Game_Servlets

DESCRIPTION

Dice game is a web app written using Java servlets to access to the game, the user have to eathier create a new account or Sign In using account that are already created (account are saved in the servlets context)
This is a game where the player rolls three dice in any order through a user interface,. The dice are numbered 1, 2, and 3. The text field allows the user to indicate the number of the dice to roll, and the dice is rolled by clicking the "Roll the dice" button. During the game, the same dice cannot be rolled more than once. If a player rolls the same die more than once, the game stops and the player receives a score of -1.

Scoring System

  • case result(dice_1)<result(dice_2)<result(dice_2)  :
        score = result(dice_1)+result(dice_2)+result(dice_3)
  • case result(dice_1)>result(dice_2)>result(dice_2)  :
        score = result(dice_1)*result(dice_2)*result(dice_3)
  • other cases :
        score = 0

Sign Up Form

Sign In Form

Play Form

Capture2

After rolling a dice , the result is showed graphically using this code

if(request.getSession().getAttribute("result")!=null){
	int result = (int) request.getSession().getAttribute("result");
	out.print("<h3>the result is "+result+"</h3><br>");
	String image = "picture/"+result;
	out.print("<img src=\"picture/"+result+".png\" alt=\"Dice\" width=\"256\" height=\"256\">");
}

Capture3

Score Popup

Capture4

LeaderBoard

Capture5

Tool Used

  • IDE :
    • Eclipse for Entreprise Java and Web Developers
  • Package :
    • jakarta.servlet
  • server :
    • Apache Tomcat v10.1