forked from rocketacademy/basics-blackjack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
232 lines (213 loc) Β· 7.33 KB
/
index.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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Page setup configurations -->
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Favicon configuration -->
<link
rel="apple-touch-icon"
sizes="180x180"
href="https://ra-web-files.s3.ap-southeast-1.amazonaws.com/all/favicons/apple-touch-icon.png?v=2"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="https://ra-web-files.s3.ap-southeast-1.amazonaws.com/all/favicons/favicon-32x32.png?v=2"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="https://ra-web-files.s3.ap-southeast-1.amazonaws.com/all/favicons/favicon-16x16.png?v=2"
/>
<link rel="manifest" href="/site.webmanifest?v=2" />
<link
rel="mask-icon"
href="https://ra-web-files.s3.ap-southeast-1.amazonaws.com/all/favicons/safari-pinned-tab.svg?v=2"
color="#e73c3e"
/>
<link
rel="shortcut icon"
href="https://ra-web-files.s3.ap-southeast-1.amazonaws.com/all/favicons/favicon.ico?v=2"
/>
<meta name="apple-mobile-web-app-title" content="Rocket Academy" />
<meta name="application-name" content="Rocket Academy" />
<meta name="msapplication-TileColor" content="#2b5797" />
<meta name="theme-color" content="#ffffff" />
<!-- sharing configuration -->
<!-- Primary Meta Tags -->
<title>Rocket Academy - Blackjack Project</title>
<meta name="2NE1" content="Calvin's BlackJack Game!" />
<meta
name="Rocket last project for Fundamentals"
content="A card game I made myself! ππͺπ"
/>
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website" />
<meta
property="og:url"
content="https://rocketacademy.github.io/basics-blackjack/index.html"
/>
<meta property="og:21 Card" content="CN's BlackJack Game!" />
<meta
property="og:description"
content="A fun card game I made myself! ππͺπ"
/>
<meta
property="og:image"
content="https://ra-web-files.s3.ap-southeast-1.amazonaws.com/basics/basics-blackjack-share-small.jpeg"
/>
<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image" />
<meta
name="twitter:url"
content="https://rocketacademy.github.io/basics-blackjack/index.html"
/>
<meta name="twitter:title" content="YOURNAME's BlackJack Game!" />
<meta
name="twitter:description"
content="A fun card game I made myself! ππͺπ"
/>
<meta
name="twitter:image"
content="https://ra-web-files.s3.ap-southeast-1.amazonaws.com/basics/basics-blackjack-share-small.jpeg"
/>
<meta name="twitter:site" content="@rocketacademyco" />
<meta name="twitter:creator" content="@rocketacademyco" />
<!-- fonts -->
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Open+Sans"
/>
<!-- CSS -->
<style>
* {
box-sizing: border-box;
}
body {
font-family: "Open Sans", sans-serif;
margin-left: 30px;
margin-right: 30px;
background-color: rgb(0, 0, 0);
color: rgb(0, 0, 0); /* sets the font color */
background-image: url("https://assets.nintendo.com/image/upload/ar_16:9,b_auto:border,c_lpad/b_white/f_auto/q_auto/dpr_1.5/c_scale,w_600/ncom/en_US/games/switch/b/black-jack-switch/hero"); /* The image used */
background-position: top; /* Center the image */
background-repeat: no-repeat; /* Do not repeat the image */
background-size: auto; /* Resize the background image to cover the entire container */
}
#output-div img {
display: block;
max-width: 100%;
max-height: 200px;
}
.header {
text-align: center;
font-size: 1.2rem;
margin-bottom: 3rem;
background-color: rgba(255, 255, 255, 0.26);
}
#container {
background-color: rgb(235, 255, 21);
margin: 10px auto;
max-width: 600px;
padding: 15px 31px;
}
input {
font-size: 21px;
line-height: 33px;
margin: 0 0 23px 0;
padding: 0 9px;
width: 100%;
}
button {
font-size: 21px;
line-height: 33px;
margin: 0 0 23px 0;
padding: 0 6px;
}
#output-div {
background-color: rgb(255, 255, 255);
margin: 20px auto;
padding: 20px;
width: 100%;
}
.logo-img {
height: 49px;
position: relative;
top: 22px;
}
/* increase header font size on wider screens */
@media screen and (min-width: 600px) {
.header {
font-size: 2rem;
}
}
</style>
</head>
<body>
<h1 class="header">
<img
class="logo-img"
src="https://firebasestorage.googleapis.com/v0/b/ftbc11-sample.appspot.com/o/images%2F1-PRIMARY_CRIMSON.png?alt=media&token=ce9e8333-2a45-44be-adb2-1f1bf054adf7"
/>
Rocket Fundamentals
<img
class="logo-img"
src="https://firebasestorage.googleapis.com/v0/b/ftbc11-sample.appspot.com/o/images%2F1-PRIMARY_CRIMSON.png?alt=media&token=ce9e8333-2a45-44be-adb2-1f1bf054adf7"
/>
</h1>
<br />
<h1 class="header">β¦οΈ β£οΈ Basics - Blackjack Project β₯οΈ β οΈ</h1>
<div id="container">
<p>
Draw a hand of cards and decide if you want to "Hit" or "Hold". Beat the
dealer with a score that is closest to 21! <br /><br />Input:
</p>
<input id="input-field" />
<br />
<button id="submit-button">Submit</button>
<br /><button id="hit-button">Hit</button>
<button id="Hold-button">Hold</button>
<p>Results:</p>
<div id="output-div"></div>
</div>
<!-- Import program logic -->
<script src="script.js"></script>
<!-- Define button click functionality -->
<script>
//declare and define a variable that represents the name Submit button
var button = document.querySelector("#submit-button");
var hitButton = document.querySelector("#hit-button");
var holdButton = document.querySelector("#Hold-button");
//when the submit button is clicked, it will trigger the main function
button.addEventListener("click", function () {
// Set result to input value
var input = document.querySelector("#input-field");
// store the output of manin()
var result = main(input.value);
// Display result in output element
var output = document.querySelector("#output-div");
output.innerHTML = result;
// Reset input value
input.value = "";
});
hitButton.addEventListener("click", function () {
//display results in output element
var input = document.querySelector("#input-field");
var result = drawCard(input.value);
var output = document.querySelector("#output-div");
output.innerHTML = result;
});
holdButton.addEventListener("click", function () {
//display results in output element
var input = document.querySelector("#input-field");
var result = cpuDraw(input.value);
var output = document.querySelector("#output-div");
output.innerHTML = result;
});
</script>
</body>
</html>