-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalgorithms_6.html
50 lines (40 loc) · 1.84 KB
/
algorithms_6.html
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
<!DOCTYPE html>
<html>
<head>
<title>Algorithms_6_Dragon_Game</title>
</head>
<body>
<h1 align = center>Welcome to the Dragon Dungeon</h1>
<div id ="firstmove"></div>
<script>
var firstmessage = prompt("You are in a room. There are exits to the north and west. You can hear loud noises and feel heat coming from the north. To the west, the room is quiet. Which direction do you choose?");
if(firstmessage === "North"){
var secondattempt = prompt("A fire breathing dragon stares down at you. You need a shield to pass! Go back?");
if(secondattempt === "Yes"){
var thirdattempt = prompt("You have returned to the main room. Go west?")
if(thirdattempt === "Yes"){
var fourthattempt = prompt("A treasure chest stands in the middle of the room. You move to open it. Congratulations! You've secured the shield. Return to main room?")
if(fourthattempt === "Yes"){
var advance2 = prompt("It is time to advance on the dragon. Move north?")
}
if(advance2 === "Yes" ){
var dragon = prompt("You confront the dragon! As the beast spits fire you raise your shield and run to the north door. Safety and Victory!")
}
}
}else{
document.getElementById("firstmove").innerHTML = "You have been charred by the dragon. Game Over."
}
} else if(firstmessage === "West"){
var shield = prompt("A treasure chest stands in the middle of the room. You move to open it. Congratulations! You've secured the shield. Return to main room?")
if(shield === "Yes"){
var advance = prompt("It is time to advance on the dragon. Move north?")
}
if(advance === "Yes" ){
var dragon = prompt("You confront the dragon! As the beast spits fire you raise your shield and run to the north door. Safety and Victory!")
}
} else {
document.getElementById("firstmove").innerHTML = ("Enter West or North");
}
</script>
</body>
</html>