-
Notifications
You must be signed in to change notification settings - Fork 1
/
dottedgame.html
54 lines (54 loc) · 1.51 KB
/
dottedgame.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
<html>
<head>
<link rel="icon" href="jatloesmile-hd.png">
<link rel="stylesheet" type="text/css" href="website.css">
<style>
a {
color: blue;
text-decoration: none;
}
h1 {
color: orange;
text-shadow: 0px 0px 8px gold;
font-size: 60px;
text-align: center;
}
</style>
<title>Random Game</title>
</head>
<body>
<h1>DottedCalculator's Random Game Version 1.1</h1>
<center style="font-size: 20;"><a id="text1" style="color: orange;">You have </a><a id="money">0</a><a id="text2" style="color: orange;"> points.</a></center><br>
<button onclick="rand()">Click here to earn points</button><br>
<button onclick="u1()">Upgrade 1: Double the base of the gain (Requires 10000 points and square roots score)</button>
</body>
<script>
let i=0;
let base=1/2;
let time=0;
function rand(){
if(time==0){
time=Date.now();
}
let x=Math.random();
n = Math.pow(Math.max(Math.log(i),2/base)*base,Math.floor(Math.log(1/x)));
i += n;
console.log(n);
document.getElementById("money").innerHTML = String(Math.floor(i));
if(isFinite(i) == false){
x = (Date.now()-time)/1000;
alert('You win! You beat the game in '+String(x)+' seconds.');
document.getElementById("text1").innerHTML = "You beat the game in ";
document.getElementById("money").innerHTML = String(x);
document.getElementById("text2").innerHTML = " seconds.";
}
}
function u1(){
if(i > 10000){
base *= 2;
i = Math.sqrt(i);
document.getElementById("money").innerHTML = String(Math.floor(i));
}
}
</script>
</html>