Midas Odds

Developer
Size
6,237 Kb
Views
32,384

How do I make an midas odds?

What is a midas odds? How do you make a midas odds? This script and codes were developed by Steven on 31 July 2022, Sunday.

Midas Odds Previews

Midas Odds - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Midas Odds</title> <link rel='stylesheet prefetch' href='http://cdnjs.cloudflare.com/ajax/libs/c3/0.4.10/c3.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h2>Crystal Odds</h2>
<h3>Now with added Web Workers</h3>
<p> 750 Draws = Tickets from full Beer Festival inc. extra week<br> 850 Draws = Expected Presents from full Xmas Event inc. extension<br> 1375 Draws = Expected Islands from full Mythical Invasion inc. extention.<br> <span id="beerv2draws"></span> Draws = Beer Festival v2 estimate up to right now.<br> <span id="totalDraws"></span> Draws = Full Beer Festival + Full Xmas + Full Mythical Invasion + Beer Festival v2.
</p>
<!-- 1150 Mythical Invasion pre extension. Approx 1375 after -->
<div id="inputForm"> <label>Players</label><input type="number" id="attempts" placeholder="100000" value="10000"><br> <label>Draws</label><input type="number" id="draws" placeholder="2975" value="2975"><br> <label>Crystal Odds %</label><input type="number" min=0.5 step=0.5 max=100 id="odds" placeholder="2.5" value="2.5"> <label id="lblDecreasing">Decreasing</label><input type="checkbox" id="chkDecreasing" checked> <label id="lblIndividual">Individual</label><input type="checkbox" id="chkIndividual"><br> <div id="indContainer"> <label class="indLabel">1st</label><input class="indText" type="number" placeholder="4.5" value="4.5"> <label class="indLabel">2nd</label><input class="indText" type="number" placeholder="4.3" value="4.3"> <label class="indLabel">3rd</label><input class="indText" type="number" placeholder="1.1" value="1.1"> <label class="indLabel">4th</label><input class="indText" type="number" placeholder="0.8" value="0.8"> <label class="indLabel">5th</label><input class="indText" type="number" placeholder="0.4" value="0.4"> </div> <label>Goal Crystals</label><input type="number" id="crystals" placeholder="5" value="5"><br> <button id="calculate">Calculate</button><br> <progress id="progBar" max=1 value=0>
</div>
<div id="result"></div>
<div id="furtherStats1"></div>
<div id="chartContainer">
<div id="volvChart"></div>
<div id="volvPieChart"></div>
</div>
<div id="furtherStats2"></div>
<div id="resultTime"></div>
<script type="text/js-worker"> // This script WON'T be parsed by JS engines because its MIME type is text/js-worker. self.addEventListener('message', function(e) { self.postMessage(calculate(e.data)); }, false); function calculate([iterations, attempts, crystalOdds, crystalGoal, decreasing, userDefinedOdds]) { let t0 = performance.now(); let crystalCount = 0; let score = 0;	let _iterations = iterations; // copy for loop let _crystalOdds = crystalOdds; let individualOdds = (crystalOdds / 5)*1000; // To split into 5ths let totals = []; do {	if (_iterations % 100 === 0 ) { // Update progress every 100 attempts	self.postMessage({prog: 1-(_iterations/iterations)}); } for (let i = 0; i < attempts; i++) {	if (userDefinedOdds) {	_crystalOdds = userDefinedOdds[crystalCount%5]/100 } if (Math.random() < _crystalOdds) { crystalCount++; if (decreasing && !userDefinedOdds) {	_crystalOdds = (_crystalOdds*1000 - individualOdds)/1000; if (crystalCount % 5 === 0) { // Every 5th crystal	_crystalOdds = crystalOdds; // Reset odds	} } } } if (crystalCount >= crystalGoal) { score++; }	_crystalOdds = crystalOdds; // Reset odds totals.push(crystalCount); crystalCount = 0; } while (--_iterations); let t1 = performance.now(); return { msg: `With ${Number(iterations)} players with ${attempts} draws each${ (decreasing) ? ` with` : `` } ${ (!decreasing) ? `at ${(crystalOdds*100).toFixed(2)}% flat chance per crystal` : `` } ${ (decreasing) ? `	<table><tr><td><b>Crystal</b></td><b><td>Chance%</b></td></tr> <tr><td><b>1st</b></td><td><b>${(userDefinedOdds) ? userDefinedOdds[0] : (individualOdds*5/10).toFixed(2)}</b></td></tr> <tr><td><b>2nd</b></td><td><b>${(userDefinedOdds) ? userDefinedOdds[1] : (individualOdds*4/10).toFixed(2)}</b></td></tr> <tr><td><b>3rd</b></td><td><b>${(userDefinedOdds) ? userDefinedOdds[2] : (individualOdds*3/10).toFixed(2)}</b></td></tr> <tr><td><b>4th</b></td><td><b>${(userDefinedOdds) ? userDefinedOdds[3] : (individualOdds*2/10).toFixed(2)}</b></td></tr> <tr><td><b>5th</b></td><td><b>${(userDefinedOdds) ? userDefinedOdds[4] : (individualOdds*1/10).toFixed(2)}</b></td></tr></table> ` : `` } ${score} players hit at least ${crystalGoal} Crystals or a success rate of ${((score/Number(iterations))*100).toFixed(2)}%`, time: `Took, ${(t1 - t0).toFixed(2)}, milliseconds to generate`, totals: totals };	} // Rest of your worker code goes here.
</script> <script src='http://d3js.org/d3.v3.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/c3/0.4.10/c3.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.0/moment.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Midas Odds - Script Codes CSS Codes

body { background: #622806; background: #491447; background: rgba(200, 167, 112, 1); color: lightblue; color: #00D50F; color: black; font-weight: bold; text-align: center;
}
#inputForm, #result, #resultTime { width: 486px; padding: 2rem; padding-top: 1rem; margin: auto; text-align: center;
}
label { display: inline-block; width: 140px; text-align: left; padding: 0.5rem;
}
input { font-weight: bold; width: 320px;
}
#calculate { font-weight: bold;
}
label::after { content: ":";
}
#calculate { width:100%; margin-top: 1rem;;
}
#result, #resultTime, #furtherStats1, #furtherStats2 { font-size: 18px; font-weight: bold; font-family: cursive;
}
#resultTime { color: skyblue; color: #00D50F; color: black;
}
#progBar { width: 100%; margin: 1rem auto; margin-bottom: -20px; visibility: hidden;
}
#odds { width: 50px;
}
#chkDecreasing, #lblDecreasing, #chkIndividual, #lblIndividual { display: inline-block; width: 50px; margin: auto 4px;
}
#chkDecreasing, #chkIndividual { vertical-align:middle;
}
table { font-size: smaller; margin: 10px auto;
}
td { padding-left: 20px;
}
.chart { background: #b0e0f8; margin: 5px;
}
.chart rect { stroke: white; fill: steelblue;
}
#chartContainer {
}
#volvChart { display: inline-block; margin: 0px; padding: 0px; width: 70%; left: 10%;
}
#volvPieChart { display: inline-block; margin: 0px; padding: 0px; width: 20%; left: -10%; top: -50px;
}
#indContainer { visibility: hidden; max-height: 0px; transition: all 1s;
}
#chkIndividual:checked ~ #indContainer { visibility: visible; max-height: 300px;
}
.indLabel { width: 24px;
}
.indText { width: 48px;
}

Midas Odds - Script Codes JS Codes

let formAttempts = document.getElementById("attempts");
let draws = document.getElementById("draws");
let odds = document.getElementById("odds");
let crystals = document.getElementById("crystals");
let decreasing = document.getElementById("chkDecreasing");
let individual = document.getElementById("chkIndividual");
let btnCalc = document.getElementById("calculate");
let result = document.getElementById("result");
let resultTime = document.getElementById("resultTime");
let furtherStats1 = document.getElementById("furtherStats1");
let furtherStats2 = document.getElementById("furtherStats2");
let progBar = document.getElementById("progBar");
let buttonProg = buttonProgress(btnCalc);
let now = new moment();
let startDate = new moment("2017-04-10T09:15Z"); // Festival start date
let diff = now - startDate;
let timeFromStart = moment.duration(diff);
let minutesFromStart = timeFromStart.asMinutes();
let beers = (minutesFromStart / 5) + 70; // Started with 70
let tickets = (Math.floor(beers / 95)*5)+5; // Started with 5
tickets = Math.floor(tickets + (tickets*0.04*2.5)); // Ticket drop estimate at 4% average 2.5 tickets per hit.
console.clear();
console.log(tickets);
draws.setAttribute("placeholder", `${2975+tickets}`);
draws.setAttribute("value", `${2975+tickets}`);
document.getElementById("beerv2draws").innerHTML = tickets;
document.getElementById("totalDraws").innerHTML = `${2975+tickets}`;
var blob = new Blob(Array.prototype.map.call(document.querySelectorAll("script[type=\"text\/js-worker\"]"), function (oScript) { return oScript.textContent;
}),{type: "text/javascript"});
// Creating a new document.worker property containing all our "text/js-worker" scripts.
document.worker = new Worker(window.URL.createObjectURL(blob));
document.worker.addEventListener('message', function(e) { if (e.data.msg) { buttonProg.stop(); progBar.style.visibility = "hidden"; result.innerHTML = e.data.msg; resultTime.innerHTML = e.data.time; doFurtherStats(e.data.totals); } if (e.data.prog) { // Update progress bar progBar.value = e.data.prog; }
}, false);
function doFurtherStats(totals) { let dataMap = {}; let maxCrystals = Math.max(...totals); let minCrystals = Math.min(...totals); let totalPlayers = totals.length; let totalCrystals = totals.reduce((acc, cur) => { return acc+cur }, 0); let averageCrystals = totalCrystals / totalPlayers; let tickets = Number(draws.value); let EP = (tickets*.75); for (let i = 0; i <= maxCrystals; i++) { dataMap[i] = 0; } totals.forEach(each => dataMap[each] += 1) makeChart(dataMap, totalPlayers) let outputString = ``; outputString += `<h3>Full Breakdown</h3><table style="text-align: left">`; outputString += `<tr><td>Total Players</td><td>${totalPlayers}</td></tr>`; outputString += `<tr><td>Total Crystals Earned</td><td>${totalCrystals}</td></tr>`; //outputString += `<tr><td>Estimated EP earned</td><td>${(EP*30).toFixed(0)}</td></tr>`; outputString += `<tr><td>Lowest Crystals Earned</td><td>${minCrystals}</td></tr>`; outputString += `<tr><td>Highest Crystals Earned</td><td>${maxCrystals}</td></tr>`; outputString += `<tr><td>Average Crystals per Player</td><td>${Math.floor(averageCrystals)}</td></tr>`; outputString += `</table>`; furtherStats1.innerHTML = outputString; outputString = ``; outputString += `<table border><tr><td>Crystals Earned</td><td>Number of Players</td><td>Percentage of Total</td></tr>`; for (let i = 0; i <= maxCrystals; i++) { outputString += `<tr><td>${i}</td><td>${dataMap[i]}</td><td>${((dataMap[i]/totalPlayers)*100).toFixed(2)}</td></tr>`; } outputString += `</table>`; furtherStats2.innerHTML = outputString;
}
btnCalc.addEventListener("click", function() { let iterations = Number(formAttempts.value); let attempts = Number(draws.value); let crystalOdds = Number(odds.value/100); let crystalGoal = Number(crystals.value); let chkDecreasing = decreasing.checked; let chkIndividual = individual.checked; let oddObject = {}; if (chkIndividual) { // Build odd object Array.from(document.getElementById("indContainer") .querySelectorAll(".indText")) .map(oddbox => oddbox.value) .forEach((each, i, arr) => { oddObject[i] = each === "" ? 0 : Number(each); }); } else { oddObject = undefined; } console.log(oddObject) buttonProg.start(); progBar.style.visibility = "visible"; document.worker.postMessage([iterations, attempts, crystalOdds, crystalGoal, chkDecreasing, oddObject]);
});
function buttonProgress(btn) { let dotCount = 0 let upTimer = ""; let downTimer = ""; function update() { btn.innerHTML = `${"-".repeat(dotCount)} Calculate ${"-".repeat(dotCount)}`; } function countUp() { dotCount += 1; update(); if (dotCount === 5) { clearInterval(upTimer); downTimer = setInterval(countDown, 250); } } function countDown() { dotCount -= 1; update(); if (dotCount === 0) { clearInterval(downTimer); upTimer = setInterval(countUp, 250); } } return { start: function() { btn.disabled = true; upTimer = setInterval(countUp, 250); }, stop: function() { dotCount = 0; btn.innerHTML = `Calculate`; btn.disabled = false; clearInterval(upTimer); clearInterval(downTimer); } }
}
var chart;
var chart2;
function makeChart(inData, count) { let data = Object.assign({}, inData) let values = Object.values(data).map(m => Number((m/count*100).toPrecision(2)) ); for (let keys in data) { if (data[keys] === 0) { delete data[keys]; } } let names = Object.keys(data); console.log(values) values.unshift("Percentage"); chart = c3.generate({ bindto: '#volvChart', data: { columns: [ values ], type: "bar" }, axis: { y: { label: { text: 'Percentage', position: 'outer-middle' }, padding: { bottom: 0 } }, x: { label: { text: `No of Crystals`, position: `outer-center` }, min: names[0] } }, tooltip: { format: { title: function (d) { return `${d} Crystals`; }, value: function (value, ratio, id) { return `${value}%`; } } }, legend: { show: false }, bar: { width: { ratio: 0.99 } }, }); console.log(values) var newData = []; var AACount = 0; var tmp = ["0 AA"]; values.shift(); values.forEach((each, i) => { tmp.push(each); if (i > 0 && (i+1) % 5 === 0) { newData.push(tmp); AACount++; tmp = [`${AACount} AA${ (AACount > 1) ? "'s" : "" }`]; } }) newData.push(tmp); console.log(newData) chart2 = c3.generate({ bindto: '#volvPieChart', data: { columns: newData, type: "pie" }, legend: { show: false }, pie: { label: { format: function (value, ratio, id) { return `${id}`; } } } });
}
var types = [`step`, `bar`, `scatter`, `line`, `spline`];
document.getElementById("volvChart").addEventListener("click", function() { console.log(types) chart.transform(types[0]); types.unshift(types.pop())
})
Midas Odds - Script Codes
Midas Odds - Script Codes
Home Page Home
Developer Steven
Username volv
Uploaded July 31, 2022
Rating 3
Size 6,237 Kb
Views 32,384
Do you need developer help for Midas Odds?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Steven (volv) Script Codes
Create amazing video scripts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!