-
Notifications
You must be signed in to change notification settings - Fork 12
/
exotic_sim.html
83 lines (83 loc) · 2.79 KB
/
exotic_sim.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
<html>
<head>
<title>Exotic Experiment Simulator</title>
<style>
input {
width: 80px;
}
</style>
</head>
<body>
<script>
function go() {
let tf_boost = .01
let prod_boost = .01
let u_boost = 1
let time_factor = 1
let production = 1
let universes = 0
let time_factor_upg = parseInt(document.getElementById("time_factor").value);
let production_upg = parseInt(document.getElementById("production").value);
let universe_upg = parseInt(document.getElementById("universe").value);
let boost_upg = parseInt(document.getElementById("boost").value);
let results = document.getElementById("results");
results.textContent = "Cost: " + (
time_factor_upg * (1.5 * time_factor_upg - 0.5) +
production_upg * (0.5 * production_upg + 0.5) +
universe_upg * (0.5 * universe_upg + 1.5) +
boost_upg * (2.5 * boost_upg + 3.5)) + "\n";
let tf_time = 60 * 3600 * (0.8 ** (time_factor_upg - 1));
let prod_time = 25 * 3600 * (0.8 ** (production_upg - 1));
let u_time = 100 * 3600 * (0.8 ** (universe_upg - 1));
let boost_time = 50 * 3600 * (0.8 ** (boost_upg - 1));
let tf = tf_time, prod = prod_time, u = u_time, boost = boost_time;
let total_time = 0;
while (universes < 5000) {
let next_time = Math.min(tf, prod, u, boost);
tf -= next_time;
prod -= next_time;
u -= next_time;
boost -= next_time;
total_time += next_time;
if (u === 0) {
universes += production;
u = u_time / time_factor;
}
if (boost === 0) {
tf_boost += .001;
prod_boost *= 1.05;
boost = boost_time / time_factor;
}
if (tf === 0) {
let old_factor = time_factor;
time_factor += tf_boost;
let time_shift = old_factor / time_factor;
u *= time_shift;
boost *= time_shift;
prod *= time_shift;
tf = tf_time / time_factor;
}
if (prod === 0) {
production += prod_boost;
prod = prod_time / time_factor;
}
results.textContent += "Time: " + total_time + ", Universes: " +
universes.toFixed(3) + ", production: " + production.toFixed(3) + ", time_factor: " +
time_factor.toFixed(3) + "\n";
}
}
</script>
<table>
<tr><td>Time Factor:</td>
<td><input id="time_factor" type="number" min="1" value="1"></td></tr>
<tr><td>Production:</td>
<td><input id="production" type="number" min="1" value="1"></td></tr>
<tr><td>Universe:</td>
<td><input id="universe" type="number" min="1" value="1"></td></tr>
<tr><td>Boost:</td>
<td><input id="boost" type="number" min="1" value="1"></td></tr>
</table>
<input type="button" value="Go" onclick="go()">
<pre id="results"></pre>
</body>
</html>