mirror of
https://github.com/Aviortheking/Langton-s-Ant.git
synced 2025-04-22 18:42:09 +00:00
49 lines
1.3 KiB
HTML
49 lines
1.3 KiB
HTML
<html dir="ltr" lang="en-US">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<link rel="stylesheet" href="resource://activity-stream/css/activity-stream.css">
|
|
<style>
|
|
table, th, td {
|
|
border: 1px solid black;
|
|
padding: 15px;
|
|
|
|
}
|
|
.ant {
|
|
background: red !important;
|
|
}
|
|
.black {
|
|
background: black;
|
|
}
|
|
.hidden {
|
|
visibility: hidden;
|
|
}
|
|
</style>
|
|
|
|
</head>
|
|
<body>
|
|
<div class="prgm">
|
|
<input value="250" class="geninput"/>
|
|
<button onclick="gen()">Generate</button>
|
|
</div>
|
|
<button class="hidden" onclick="moving()" style="position: fixed;top: 0;">Move</button>
|
|
<input style="position: fixed;bottom: 0;" class="moves hidden"/>
|
|
</body>
|
|
<script type="text/javascript" src="prgm.js"></script>
|
|
<script>
|
|
function moving() {
|
|
for (var i = document.getElementsByClassName("moves")[0].value - 1; i >= 0; i--) {
|
|
Prgm.Ant.move();
|
|
}
|
|
}
|
|
|
|
function gen() {
|
|
Prgm.setElement("AntProgram");
|
|
document.getElementsByClassName("hidden")[0].classList.remove("hidden")
|
|
document.getElementsByClassName("hidden")[0].classList.remove("hidden")
|
|
square = document.getElementsByClassName("geninput")[0].value;
|
|
Prgm.init(document.getElementsByClassName("prgm")[0], square);
|
|
Prgm.Ant.setAt(Math.trunc(square/2), Math.trunc(square/2));
|
|
|
|
}
|
|
</script>
|
|
</html> |