225 lines
8.6 KiB
HTML
225 lines
8.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>Riskless</title>
|
|
|
|
<link href="{{ url_for('static', filename='css/style.css') }}" rel="stylesheet">
|
|
|
|
<script src="https://cdn.socket.io/4.5.4/socket.io.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
|
|
<script src="{{ url_for('static', filename='js/modules/interface/main.js') }}" type="module"></script>
|
|
<script src="{{ url_for('static', filename='js/modules/crypto/main.js') }}" type="module"></script>
|
|
</head>
|
|
<body>
|
|
<div id="modal" class="hidden modal">
|
|
<div class="modal-content">
|
|
<div>
|
|
<label>
|
|
Amount
|
|
<input type="number" class="amount">
|
|
</label>
|
|
</div>
|
|
<div>
|
|
<label>
|
|
Target
|
|
<select class="target"></select>
|
|
</label>
|
|
</div>
|
|
<div class="button-row">
|
|
<button class="submit-modal">Submit</button>
|
|
<button class="cancel-modal">Cancel</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="defense-modal" class="hidden modal">
|
|
<div class="modal-content">
|
|
<div>
|
|
<h2>Defending region <span class="region-tag">R</span></h2>
|
|
<label>
|
|
Defense amount
|
|
<input type="number" class="amount">
|
|
</label>
|
|
</div>
|
|
<button class="submit-modal">Submit</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="players-div">
|
|
<strong>Players</strong>
|
|
<ul id="playerList">
|
|
</ul>
|
|
<button id="shuffleColors">Shuffle colours</button>
|
|
</div>
|
|
|
|
<div id="remaining-reinforcements">
|
|
</div>
|
|
|
|
<div id="info">
|
|
</div>
|
|
|
|
<div id="map">
|
|
<svg id="map-back" viewBox="-520 -520 1000 1000" width="1000" height="1000">
|
|
<line x1="0" y1="0" x2="160" y2="0" stroke="black"></line>
|
|
<line x1="160" y1="0" x2="260" y2="0" stroke="black"></line>
|
|
<line x1="160" y1="0" x2="220" y2="-200" stroke="black"></line>
|
|
<line x1="280" y1="0" x2="220" y2="-200" stroke="black"></line>
|
|
<line x1="220" y1="-200" x2="380" y2="-200" stroke="black"></line>
|
|
<line x1="220" y1="-200" x2="-40" y2="-140" stroke="black"></line>
|
|
<line x1="0" y1="0" x2="-40" y2="-140" stroke="black"></line>
|
|
<line x1="0" y1="0" x2="-40" y2="140" stroke="black"></line>
|
|
<line x1="-280" y1="80" x2="-40" y2="140" stroke="black"></line>
|
|
<line x1="-280" y1="-80" x2="-40" y2="-140" stroke="black"></line>
|
|
<line x1="-280" y1="80" x2="-180" y2="0" stroke="black"></line>
|
|
<line x1="-280" y1="-80" x2="-180" y2="0" stroke="black"></line>
|
|
<line x1="-180" y1="0" x2="-40" y2="140" stroke="black"></line>
|
|
<path d="M -280 80 Q -360 0 -280 -80" stroke="black" fill="transparent"></path>
|
|
</svg>
|
|
<div class="node east" data-name="A" style="left: 280px;">
|
|
<div class="strength"></div>
|
|
<div class="label">A</div>
|
|
<div class="actions">
|
|
<button class="claim">Claim</button>
|
|
<button class="reinforce">Reinf.</button>
|
|
<button class="attack">Attack</button>
|
|
<button class="fortify">Fortify</button>
|
|
</div>
|
|
</div>
|
|
<div class="node east" data-name="B" style="left: 160px;">
|
|
<div class="strength"></div>
|
|
<div class="label">B</div>
|
|
<div class="actions">
|
|
<button class="claim">Claim</button>
|
|
<button class="reinforce">Reinf.</button>
|
|
<button class="attack">Attack</button>
|
|
<button class="fortify">Fortify</button>
|
|
</div>
|
|
</div>
|
|
<div class="node east" data-name="C" style="left: 220px; top: -200px;">
|
|
<div class="strength"></div>
|
|
<div class="label">C</div>
|
|
<div class="actions">
|
|
<button class="claim">Claim</button>
|
|
<button class="reinforce">Reinf.</button>
|
|
<button class="attack">Attack</button>
|
|
<button class="fortify">Fortify</button>
|
|
</div>
|
|
</div>
|
|
<div class="node east" data-name="D" style="left: 380px; top: -200px;">
|
|
<div class="strength"></div>
|
|
<div class="label">D</div>
|
|
<div class="actions">
|
|
<button class="claim">Claim</button>
|
|
<button class="reinforce">Reinf.</button>
|
|
<button class="attack">Attack</button>
|
|
<button class="fortify">Fortify</button>
|
|
</div>
|
|
</div>
|
|
<div class="node west" data-name="E" style="left: -40px; top: 140px;">
|
|
<div class="strength"></div>
|
|
<div class="label">E</div>
|
|
<div class="actions">
|
|
<button class="claim">Claim</button>
|
|
<button class="reinforce">Reinf.</button>
|
|
<button class="attack">Attack</button>
|
|
<button class="fortify">Fortify</button>
|
|
</div>
|
|
</div>
|
|
<div class="node west" data-name="F" style="left: -40px; top: -140px;">
|
|
<div class="strength"></div>
|
|
<div class="label">F</div>
|
|
<div class="actions">
|
|
<button class="claim">Claim</button>
|
|
<button class="reinforce">Reinf.</button>
|
|
<button class="attack">Attack</button>
|
|
<button class="fortify">Fortify</button>
|
|
</div>
|
|
</div>
|
|
<div class="node west" data-name="G" style="left: -280px; top: -80px;">
|
|
<div class="strength"></div>
|
|
<div class="label">G</div>
|
|
<div class="actions">
|
|
<button class="claim">Claim</button>
|
|
<button class="reinforce">Reinf.</button>
|
|
<button class="attack">Attack</button>
|
|
<button class="fortify">Fortify</button>
|
|
</div>
|
|
</div>
|
|
<div class="node west" data-name="H" style="left: -280px; top: 80px;">
|
|
<div class="strength"></div>
|
|
<div class="label">H</div>
|
|
<div class="actions">
|
|
<button class="claim">Claim</button>
|
|
<button class="reinforce">Reinf.</button>
|
|
<button class="attack">Attack</button>
|
|
<button class="fortify">Fortify</button>
|
|
</div>
|
|
</div>
|
|
<div class="node west" data-name="I" style="left: -180px;">
|
|
<div class="strength"></div>
|
|
<div class="label">I</div>
|
|
<div class="actions">
|
|
<button class="claim">Claim</button>
|
|
<button class="reinforce">Reinf.</button>
|
|
<button class="attack">Attack</button>
|
|
<button class="fortify">Fortify</button>
|
|
</div>
|
|
</div>
|
|
<div class="node east" data-name="J" style="">
|
|
<div class="strength"></div>
|
|
<div class="label">J</div>
|
|
<div class="actions">
|
|
<button class="claim">Claim</button>
|
|
<button class="reinforce">Reinf.</button>
|
|
<button class="attack">Attack</button>
|
|
<button class="fortify">Fortify</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="ready">
|
|
<button id="ready-button">Not ready</button>
|
|
<button id="end-turn" class="hidden">End Turn</button>
|
|
</div>
|
|
|
|
<!-- Benchmarking script -->
|
|
<script>
|
|
function RSABench() {
|
|
console.log("Warming up")
|
|
|
|
for (let i = 0n; i < 100n; i++) {
|
|
window.rsa.pubKey.encrypt(i);
|
|
}
|
|
|
|
console.log("Benching")
|
|
|
|
performance.mark("rsa-start")
|
|
for (let i = 0n; i < 250n; i++) {
|
|
window.rsa.pubKey.encrypt(i);
|
|
}
|
|
performance.mark("rsa-end")
|
|
|
|
console.log(`Bench done. Duration: ${performance.measure("rsa-duration", "rsa-start", "rsa-end").duration}`)
|
|
}
|
|
|
|
function PaillierBench() {
|
|
console.log("Warming up")
|
|
|
|
for (let i = 0n; i < 100n; i++) {
|
|
window.paillier.pubKey.encrypt(i);
|
|
}
|
|
|
|
console.log("Benching")
|
|
|
|
performance.mark("paillier-start")
|
|
for (let i = 0n; i < 250n; i++) {
|
|
window.paillier.pubKey.encrypt(i);
|
|
}
|
|
performance.mark("paillier-end")
|
|
|
|
console.log(`Bench done. Duration: ${performance.measure("paillier-duration", "paillier-start", "paillier-end").duration}`)
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|