init commit
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
body {
|
||||
|
||||
margin: auto;
|
||||
position: relative;
|
||||
|
||||
background-color: #4A245E;
|
||||
font-family: Lato sans-serif;
|
||||
color: white;
|
||||
|
||||
}
|
||||
|
||||
h1 {
|
||||
|
||||
padding: 25px;
|
||||
font-size: 5em;
|
||||
|
||||
}
|
||||
|
||||
div {
|
||||
|
||||
display: inline-block;
|
||||
margin: auto;
|
||||
|
||||
}
|
||||
|
||||
button {
|
||||
|
||||
background-color: white;
|
||||
color: #4A245E;
|
||||
border: none;
|
||||
padding: 25px;
|
||||
text-decoration: none;
|
||||
font-size: 1.5em;
|
||||
font-family: Lato sans-serif;
|
||||
display: inline-block;
|
||||
|
||||
}
|
||||
|
||||
p {
|
||||
|
||||
padding : 25px;
|
||||
font-size: 2em;
|
||||
display: inline-block;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
body {
|
||||
|
||||
margin: auto;
|
||||
position: relative;
|
||||
|
||||
background-color: #4A245E;
|
||||
font-family: Lato sans-serif;
|
||||
color: white;
|
||||
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
|
||||
h1 {
|
||||
|
||||
padding: 25px;
|
||||
font-size: 5em;
|
||||
|
||||
}
|
||||
|
||||
div {
|
||||
|
||||
display: inline-block;
|
||||
margin: auto;
|
||||
width: 50%;
|
||||
|
||||
}
|
||||
|
||||
button {
|
||||
|
||||
background-color: white;
|
||||
color: #4A245E;
|
||||
border: none;
|
||||
padding: 25px;
|
||||
text-decoration: none;
|
||||
font-size: 1.5em;
|
||||
font-family: Lato sans-serif;
|
||||
display: inline-block;
|
||||
|
||||
}
|
||||
|
||||
p {
|
||||
|
||||
padding : 25px;
|
||||
font-size: 2em;
|
||||
display: inline-block;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta name = "viewport" content = "width=device-width, initial-scale=1" charset="UTF-8">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
|
||||
<title>Lottery</title>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Ashton's Lottery</h1>
|
||||
|
||||
<div>
|
||||
|
||||
<button onclick="refresh()">Play Again!</button>
|
||||
|
||||
<p id="output">Awaiting player...</p>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
<footer>
|
||||
|
||||
<script src="js/script.js"></script>
|
||||
|
||||
</footer>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,71 @@
|
||||
|
||||
//function userPrompt() {
|
||||
|
||||
let size = prompt("Please enter the lottery size you\'d like:");
|
||||
|
||||
console.log(size);
|
||||
|
||||
function clickRegistered() {
|
||||
|
||||
console.log("Click registered, printing to console.");
|
||||
|
||||
}
|
||||
|
||||
//}
|
||||
|
||||
|
||||
/*
|
||||
const playButton = document.querySelector("#playbutton")
|
||||
|
||||
function userPrompt() {
|
||||
|
||||
let size = prompt("Please enter the lottery size you\'d like:");
|
||||
|
||||
if((size == null) || (size < 1) || (size < 10)) {
|
||||
|
||||
userPrompt();
|
||||
|
||||
} else {
|
||||
|
||||
createArray(size);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function createArray(size) {
|
||||
|
||||
const lotteryPool = [];
|
||||
|
||||
for(let i = 0; i < size; i ++) {
|
||||
|
||||
lotteryPool[i] = Math.floor(Math.random() * 100);
|
||||
|
||||
}
|
||||
|
||||
displayOutput(lotteryPool);
|
||||
|
||||
}
|
||||
|
||||
function displayOutput(lotteryPool) {
|
||||
|
||||
let result = "";
|
||||
|
||||
for(let i = 0; i < lotteryPool.length; i++) {
|
||||
|
||||
if(i < lotteryPool.length - 1) {
|
||||
|
||||
result += lotteryPool[i] + "-";
|
||||
|
||||
} else {
|
||||
|
||||
result += lotteryPool[i];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
document.getElementById("output").innerHtml = result;
|
||||
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,61 @@
|
||||
const size = prompt("Please enter the size of the lottery pool:");
|
||||
|
||||
const lotteryValues = [];
|
||||
|
||||
window.onLoad = start();
|
||||
|
||||
function start() {
|
||||
|
||||
createArray();
|
||||
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
|
||||
createArray();
|
||||
|
||||
}
|
||||
|
||||
function createArray() {
|
||||
|
||||
for(let i = 0; i < size; i++) {
|
||||
|
||||
lotteryValues[i] = getRandomInt();
|
||||
|
||||
}
|
||||
|
||||
generateOutput();
|
||||
|
||||
}
|
||||
|
||||
function generateOutput() {
|
||||
|
||||
let output = "";
|
||||
|
||||
for(let i = 0; i < lotteryValues.length; i++) {
|
||||
|
||||
output += lotteryValues[i];
|
||||
|
||||
if(i < lotteryValues.length - 1) {
|
||||
|
||||
output += "-";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
document.getElementById("output").innerHTML = output
|
||||
|
||||
}
|
||||
|
||||
function getRandomInt() {
|
||||
|
||||
let min = 1;
|
||||
let max = 100;
|
||||
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
|
||||
return Math.floor(Math.random() * (max - min) + min);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user