-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.html
More file actions
77 lines (76 loc) · 2.24 KB
/
index.html
File metadata and controls
77 lines (76 loc) · 2.24 KB
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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<link href='https://fonts.googleapis.com/css?family=Passion+One' rel='stylesheet' type='text/css'>
<title>War!</title>
</head>
<body>
<h1 id='header'>WAR!</h1>
<span class="btn-start">START</span>
<span class="btn-flip">FLIP!</span>
<div id="decision"></div>
<br />
<div id="userPoints"></div>
<br />
<div id="computerPoints"></div>
<br />
<div id= "user_deck">
<span id="user-name">User</span>
</br>
<img id= "deck-img" src="images/deck-cards-red.png">
<div id="user-card-flipped"></div>
</div>
<div id="here"></div>
<div id= "computer_deck">
<span id="computer-name">Computer</span>
</br>
<img id= "deck-img" src="images/deck-cards-blue.png">
<div id="computer-card-flipped"></div>
</div>
<span class="btn-playagain">Play Again?</span>
<script src="war.js"></script>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script>
$(document).ready(function() {
$('.btn-start').show();
$('.btn-flip').hide();
$('.btn-playagain').hide();
});
$('.btn-start').click(function(e) {
$(this).remove();
$('.btn-flip').toggle();
assignDeck(shuffle(cards));
console.log("userDeck: ", userDeck);
console.log("computerDeck: ", computerDeck);
mainGame();
$('#userPoints').empty().append("UserPoints: " + userPoints);
$('#computerPoints').empty().append("ComputerPoints: " + computerPoints);
winnerCheck(userPoints, computerPoints);
});
$('.btn-flip').click(function(e) {
mainGame();
$('#userPoints').empty().append("UserPoints: " + userPoints);
$('#computerPoints').empty().append("ComputerPoints: " + computerPoints);
winnerCheck(userPoints, computerPoints);
// $('#war').remove();
});
$('.btn-playagain').click(function(e) {
$(this).hide();
$('.btn-flip').toggle();
$('#win').remove();
$('#lose').remove();
MGi = 0;
userDeck = [], userPoints = 0;
computerDeck = [], computerPoints = 0;
assignDeck(shuffle(cards));
console.log("userDeck: ", userDeck);
console.log("computerDeck: ", computerDeck);
mainGame();
$('#userPoints').empty().append("UserPoints: " + userPoints);
$('#computerPoints').empty().append("ComputerPoints: " + computerPoints);
winnerCheck(userPoints, computerPoints);
});
</script>
</body>
</html>