Make jekyll work again, after already doing this work and then blowing away the directory

This commit is contained in:
Neale Pickett 2017-07-12 16:36:39 +00:00
parent eb9411e20e
commit 018488070f
22 changed files with 3354 additions and 36 deletions

View File

@ -1,24 +0,0 @@
<!DOCTYPE html>
<html lang="{{ site.lang | default: "en-US" }}">
<head>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="{{ '/assets/css/dirtbags.css?v=' | append: site.github.build_revision | relative_url }}">
<link rel="icon" type="image/png" href="/assets/images/icon.png">
<title>{{ site.title | default: site.github.repository_name }} by {{ site.github.owner_name }}</title>
</head>
<body>
<h1 id="title">{{ page.title | default: site.title }}</h1>
{{ content }}
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/contest/" title="Forensic Contest">Contest</a></li>
<li><a href="https://github.com/dirtbags" title="Projects on Github">Projects</a></li>
</ul>
</nav>
</body>
</html>

View File

@ -1,3 +1,7 @@
---
title: To-Do List
---
BUGS
====

6
docs/_config.yml Normal file
View File

@ -0,0 +1,6 @@
defaults:
-
scope:
path: ""
values:
layout: "default"

View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="{{ site.lang | default: "en-US" }}">
<head>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="{{ '/assets/css/dirtbags.css?v=' | append: site.github.build_revision | relative_url }}">
<link rel="icon" type="image/png" href="{{ '/assets/images/icon.png' | relative_url }}">
{% if page.scripts %}{% for js_file in page.scripts %}
<script src="{{ js_file }}"></script>
{% endfor %}{% endif %}
<title>{{ site.title | default: site.github.repository_name }} by {{ site.github.owner_name }}</title>
</head>
<body>
<h1 id="title">{{ page.title | default: site.title }}</h1>
{{ content }}
<nav>
<ul>
<li><a href="{{ '/' | relative_url }}">Home</a></li>
<li><a href="{{ '/running' | relative_url }}">Running</a></li>
<li><a href="{{ '/history' | relative_url }}">History</a></li>
<li><a href="{{ '/thanks' | relative_url }}">Thanks</a></li>
<li><a href="https://github.com/dirtbags/tanks" title="Tanks on Github">Source</a></li>
</ul>
</nav>
</body>
</html>

36
docs/_site/TODO.html Normal file
View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/assets/css/dirtbags.css?v=">
<link rel="icon" type="image/png" href="/assets/images/icon.png">
<title> by </title>
</head>
<body>
<h1 id="title">To-Do List</h1>
<h1 id="bugs">BUGS</h1>
<h1 id="requests">Requests</h1>
<ul>
<li>Merge devdsp fixes (https://github.com/devdsp/tanks/commits/master)</li>
<li>Fix leaderboard</li>
<li>Read sensors from “sensors” and not “sensor[0-9]”</li>
</ul>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/running">Running</a></li>
<li><a href="/history">History</a></li>
<li><a href="/thanks">Thanks</a></li>
<li><a href="https://github.com/dirtbags/tanks" title="Tanks on Github">Source</a></li>
</ul>
</nav>
</body>
</html>

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -0,0 +1,310 @@
function dbg(o) {
e = document.getElementById("debug");
e.innerHTML = o;
}
function torgba(color, alpha) {
var r = parseInt(color.substring(1,3), 16);
var g = parseInt(color.substring(3,5), 16);
var b = parseInt(color.substring(5,7), 16);
return "rgba(" + r + "," + g + "," + b + "," + alpha + ")";
}
function Tank(ctx, width, height, color, sensors) {
var craterStroke = torgba(color, 0.5);
var craterFill = torgba(color, 0.2);
var sensorStroke = torgba(color, 0.4);
var maxlen = 0;
this.x = 0;
this.y = 0;
this.rotation = 0;
this.turret = 0;
this.dead = 0;
// Do all the yucky math up front
this.sensors = new Array();
for (i in sensors) {
var s = sensors[i];
if (! s) {
this.sensors[i] = [0,0,0,0];
} else {
// r, angle, width, turret
this.sensors[i] = new Array();
this.sensors[i][0] = s[0];
this.sensors[i][1] = s[1] - s[2]/2;
this.sensors[i][2] = s[1] + s[2]/2;
this.sensors[i][3] = s[3]?1:0;
if (s[0] > maxlen) {
maxlen = s[0];
}
}
}
// Set up our state, for later interleaved draw requests
this.set_state = function(x, y, rotation, turret, flags, sensor_state) {
this.x = x;
this.y = y;
this.rotation = rotation;
this.turret = turret;
if (flags & 1) {
this.fire = 5;
}
this.led = flags & 2;
this.dead = flags & 4;
this.sensor_state = sensor_state;
}
this.draw_crater = function() {
if (!this.dead) {
return;
}
var points = 7;
var angle = Math.PI / points;
ctx.save();
ctx.translate(this.x, this.y);
ctx.rotate(this.rotation);
if (this.fire == 5) {
ctx.save();
ctx.rotate(this.turret);
// one frame of cannon fire
this.draw_cannon();
this.fire = 0;
ctx.restore();
}
ctx.lineWidth = 2;
ctx.strokeStyle = craterStroke;
ctx.fillStyle = craterFill;
ctx.beginPath();
ctx.moveTo(12, 0);
for (i = 0; i < points; i += 1) {
ctx.rotate(angle);
ctx.lineTo(6, 0);
ctx.rotate(angle);
ctx.lineTo(12, 0);
}
ctx.closePath()
ctx.stroke();
ctx.fill();
ctx.restore();
}
this.draw_sensors = function() {
if (this.dead) {
return;
}
ctx.save();
ctx.translate(this.x, this.y);
ctx.rotate(this.rotation);
ctx.lineWidth = 1;
for (i in this.sensors) {
var s = this.sensors[i];
var adj = this.turret * s[3];
if (this.sensor_state & (1 << i)) {
// Sensor is triggered
ctx.strokeStyle = "#000";
} else {
ctx.strokeStyle = sensorStroke;
}
ctx.beginPath();
ctx.moveTo(0, 0);
ctx.arc(0, 0, s[0], s[1] + adj, s[2] + adj, false);
ctx.closePath();
ctx.stroke();
}
ctx.restore();
}
this.draw_tank = function() {
if (this.dead) {
return;
}
ctx.save();
ctx.translate(this.x, this.y);
ctx.rotate(this.rotation);
ctx.fillStyle = color;
ctx.fillRect(-5, -4, 10, 8);
ctx.fillStyle = "#777";
ctx.fillRect(-7, -9, 15, 5);
ctx.fillRect(-7, 4, 15, 5);
ctx.rotate(this.turret);
if (this.fire) {
this.draw_cannon();
this.fire -= 1;
} else {
if (this.led) {
ctx.fillStyle = "#f00";
} else {
ctx.fillStyle = "#000";
}
ctx.fillRect(0, -1, 10, 2);
}
ctx.restore();
}
this.draw_cannon = function() {
ctx.fillStyle = ("rgba(255,255,64," + this.fire/5 + ")");
ctx.fillRect(0, -1, 45, 2);
}
this.draw_wrap_sensors = function() {
var orig_x = this.x;
var orig_y = this.y;
for (x = this.x - width; x < width + maxlen; x += width) {
for (y = this.y - height; y < height + maxlen; y += height) {
if ((-maxlen < x) && (x < width + maxlen) &&
(-maxlen < y) && (y < height + maxlen)) {
this.x = x;
this.y = y;
this.draw_sensors();
}
}
}
this.x = orig_x;
this.y = orig_y;
}
}
var loop_id;
var updateFunc = null;
function togglePlayback() {
if ($("#playing").prop("checked")) {
loop_id = setInterval(updateFunc, 66);
} else {
clearInterval(loop_id);
loop_id = null;
}
$("#pauselabel").toggleClass("ui-icon-play ui-icon-pause");
}
function start(id, game) {
var canvas = document.getElementById(id);
var ctx = canvas.getContext('2d');
canvas.width = game[0][0];
canvas.height = game[0][1];
// game[2] is tank descriptions
var turns = game[2];
// Set up tanks
var tanks = new Array();
for (i in game[1]) {
var desc = game[1][i];
tanks[i] = new Tank(ctx, game[0][0], game[0][1], desc[0], desc[1]);
}
var frame = 0;
var lastframe = 0;
var fps = document.getElementById('fps');
function update_fps() {
fps.innerHTML = (frame - lastframe);
lastframe = frame;
}
function drawFrame(idx) {
canvas.width = canvas.width;
turn = turns[idx];
// Update and draw craters first
for (i in turn) {
t = turn[i];
if (!t) {
// old data, force-kill it
tanks[i].fire = 0;
tanks[i].dead = 5;
} else {
tanks[i].set_state(t[0], t[1], t[2], t[3], t[4], t[5]);
}
tanks[i].draw_crater();
}
// Then sensors
for (i in turn) {
tanks[i].draw_wrap_sensors();
}
// Then tanks
for (i in turn) {
tanks[i].draw_tank()
}
document.getElementById('frameid').innerHTML = idx;
}
function update() {
var idx = frame % (turns.length + 20);
var turn;
frame += 1;
if (idx >= turns.length) {
return;
}
drawFrame(idx);
$('#seekslider').slider('value', idx);
}
function seekToFrame(newidx) {
var idx = frame % (turns.length + 20);
if (idx !== newidx) {
frame = newidx;
drawFrame(newidx);
}
// make sure we're paused
if ($("#playing").prop("checked")) {
$("#playing").prop("checked", false);
togglePlayback();
}
}
updateFunc = update;
loop_id = setInterval(update, 66);
//loop_id = setInterval(update, 400);
if (fps) {
setInterval(update_fps, 1000);
}
if (id === "battlefield") {
$("#game_box").append('<p><input type="checkbox" checked id="playing" onclick="togglePlayback();"><label for="playing"><span class="ui-icon ui-icon-pause" id="pauselabel"></class></label> <span id="frameid">0</span> <span id="seekslider" style="width: 75%; float: right;"></span></p>');
$('#playing').button();
var slider = $('#seekslider');
slider.slider({ max: turns.length-1, slide: function(event, ui) { seekToFrame(ui.value); } });
var spacing = 100 / turns.length;
var deaths = [];
for (i in turns[0]) {
deaths.push(false);
}
var percent = 0;
for (var f = 0; f < turns.length; f++) {
var turn = turns[f];
if (percent < (spacing * f)) {
percent = spacing * f;
}
for (var i = 0; i < turn.length; i++) {
if (deaths[i]) { continue; }
if (!turn[i] || (turn[i][4] & 4)) {
deaths[i] = true;
// http://stackoverflow.com/questions/8648963/add-tick-marks-to-jquery-slider
$('<span class="ui-slider-tick-mark"></span>').css('left', percent + '%').css('background-color', game[1][i][0]).appendTo(slider);
percent++;
break;
}
}
}
}
}

117
docs/_site/history.html Normal file
View File

@ -0,0 +1,117 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/assets/css/dirtbags.css?v=">
<link rel="icon" type="image/png" href="/assets/images/icon.png">
<script src="assets/js/tanks.js"></script>
<script src="assets/js/figures.js"></script>
<title> by </title>
</head>
<body>
<h1 id="title">History</h1>
<p>This is a port of the “Tanks” program written by Paul Ferrell
<a href="&#109;&#097;&#105;&#108;&#116;&#111;:&#112;&#102;&#108;&#097;&#114;&#114;&#064;&#099;&#108;&#097;&#110;&#115;&#112;&#117;&#109;&#046;&#110;&#101;&#116;">&#112;&#102;&#108;&#097;&#114;&#114;&#064;&#099;&#108;&#097;&#110;&#115;&#112;&#117;&#109;&#046;&#110;&#101;&#116;</a> in 2009-2010. Paul created the entire game based
off a brief description I provided him of
<a href="http://tpoindex.github.io/crobots">Crobots</a>
and a vague desire to
“make something fun for high school kids to learn some programming.” We
ran Pauls Tanks as part of a 100-attendee computer security contest in
February of 2010 and by all accounts it was a huge success. It even
made the nightly news.</p>
<p>Pauls version was written in Python and provided a custom language
called “Bullet”, which looked like this:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>&gt;addsensor(50, 0, 5, 1); # 0
&gt;addsensor(100, 90, 150, 1); # 1
&gt;addsensor(100, 270, 150, 1); # 2
&gt;addsensor(100, 0, 359, 0); # 3
# Default movement if nothing is detected
: move(70, 70) . turretccw();
random(2, 3): move(40, 70) . turretccw();
random(1, 3): move(70, 40) . turretccw();
# We found something!!
sense(3): move(0, 0);
sense(1): turretcw();
sense(2): turretccw();
sense(0): fire();
</code></pre>
</div>
<table class="figure">
<caption>"Chashtank" cleans up.</caption>
<tr>
<td>
<canvas id="shortround"></canvas>
<script type="application/javascript">
start("shortround", shortround);
</script>
</td>
</tr>
</table>
<p>Nick Moffitt played with this original version and convinced me (Neale)
that something like Forth would be a better language. I added some code
to accept a scaled-down version of PostScript. The IRC channel we
frequent collectively agreed to give this new language the derisive name
“Forf”, which should ideally be followed by punching someone after it is
spoken aloud. I wrote a Python implementation of Forf, which was slow,
and then Adam Glasgall wrote a C implementation, which was quick.</p>
<p>I decided to take Tanks to Def Con in July 2010, and just for bragging
rights, to have it run on an Asus WL-500gU. This is a $50 device with a
240 MHz MIPS CPU, 16MB RAM, and a 4MB flash disk, along with an
802.11b/g radio, 4-port 10/100 switch, and an additional 10/100 “uplink”
port; its sold as a home wireless router. I had originally intended to
run it off a lantern battery just for fun, but eventually thought better
of it: doing so would be wasteful for no good reason.</p>
<p>Aaron McPhall <a href="&#109;&#097;&#105;&#108;&#116;&#111;:&#097;&#109;&#099;&#112;&#104;&#097;&#108;&#108;&#064;&#109;&#099;&#112;&#104;&#097;&#108;&#108;&#046;&#111;&#114;&#103;">&#097;&#109;&#099;&#112;&#104;&#097;&#108;&#108;&#064;&#109;&#099;&#112;&#104;&#097;&#108;&#108;&#046;&#111;&#114;&#103;</a>, my summer intern at the time, got
OpenWRT and Python onto the box and benchmarked it at about 60 seconds
for a 16-tank game, after he had profiled the code and optimized a lot
of the math. That wasnt bad, it meant we could run a reasonably-sized
game at one turn per minute, which we knew from past experience was
about the right rate. But it required a USB thumb drive to hold Python,
and when we used the Python Forf implementation, the run-time shot up to
several minutes. I began this C port while Adam Glasgall, another fool
on the previously-mentioned IRC channel, started work on a C version of
a Forf interpreter.</p>
<p>This C version with Forf runs about 6 times faster than the Python
version with Bullet, on the WL-500gU. A 1GHz Intel Atom runs a 16-tank
game in about 0.2 seconds.</p>
<h2 id="whats-so-great-about-forf">Whats so great about Forf?</h2>
<p>Nothings great about Forf. Its a crummy language that only does
integer math. For this application its a good choice, for the
following reasons:</p>
<ul>
<li>No library dependencies, not even malloc</li>
<li>Runs in fixed size memory</li>
<li>Not Turing-complete, I think (impossible to make endless loops)</li>
<li>Lends itself to genetic algorithms</li>
</ul>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/running">Running</a></li>
<li><a href="/history">History</a></li>
<li><a href="/thanks">Thanks</a></li>
<li><a href="https://github.com/dirtbags/tanks" title="Tanks on Github">Source</a></li>
</ul>
</nav>
</body>
</html>

70
docs/_site/index.html Normal file
View File

@ -0,0 +1,70 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/assets/css/dirtbags.css?v=">
<link rel="icon" type="image/png" href="/assets/images/icon.png">
<script src="assets/js/tanks.js"></script>
<script src="assets/js/figures.js"></script>
<title> by </title>
</head>
<body>
<h1 id="title">Tanks</h1>
<table class="figure">
<caption>"Ant Lion" nails "Rabbit With Gun".</caption>
<tr><td>
<canvas id="antlion"></canvas>
<script type="application/javascript">
start("antlion", antlion);
</script>
</td></tr>
</table>
<p>Dirtbags Tanks is a game in which you pit your coding abilities
against other hackers. You write a program for your tank, set it out
on the battlefield, and watch how your program fares against tanks
written by other players. Dirtbags Tanks is frequently a component of
<a href="/ctf/">Dirtbags Capture The Flag</a>.</p>
<p>Each tank has a turret-mounted laser, two treads, up to ten sensors,
and a diagnostic LED. Sensors are used to detect when other tanks are
inside a given arc. In the examples on this page, “triggered” sensors
turn black. Most tanks will take some action if a sensor is
triggered, such as changing speed of the treads, turning the turret,
or firing.</p>
<p>Tanks are programmed in Forf, a stack-based language similar to
PostScript.</p>
<h2 id="other-versions">Other Versions</h2>
<p>Everybody loves tanks!
If youve made a port or done something fun with it,
please let me know and Ill link it here!</p>
<ul>
<li><a href="https://github.com/Arctem/nmt_python_labs/tree/master/labs/project">Class Lab</a> at New Mexico Tech, by Russell White</li>
</ul>
<h2 id="author">Author</h2>
<p>Neale Pickett <a href="&#109;&#097;&#105;&#108;&#116;&#111;:&#110;&#101;&#097;&#108;&#101;&#064;&#119;&#111;&#111;&#122;&#108;&#101;&#046;&#111;&#114;&#103;">&#110;&#101;&#097;&#108;&#101;&#064;&#119;&#111;&#111;&#122;&#108;&#101;&#046;&#111;&#114;&#103;</a></p>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/running">Running</a></li>
<li><a href="/history">History</a></li>
<li><a href="/thanks">Thanks</a></li>
<li><a href="https://github.com/dirtbags/tanks" title="Tanks on Github">Source</a></li>
</ul>
</nav>
</body>
</html>

89
docs/_site/running.html Normal file
View File

@ -0,0 +1,89 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/assets/css/dirtbags.css?v=">
<link rel="icon" type="image/png" href="/assets/images/icon.png">
<title> by </title>
</head>
<body>
<h1 id="title">Running Tanks</h1>
<p>Unfortunately, its kind of a mess right now.
I know there are a few forks of this code,
and I would love it if someone proposed a merge to clearly illustrate how to run tanks.</p>
<p>When I spin up a new tanks game,
typically I run something like:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>while sleep 60; do ./round.sh */; done
</code></pre>
</div>
<p>This assumes all your tanks directories are in the same place as <code class="highlighter-rouge">round.sh</code>.</p>
<h2 id="included-programs">Included programs</h2>
<p>I tried to stick with the Unix philosophy of one program per task. I
also tried to avoid doing any string processing in C. The result is a
hodgepodge of C, Bourne shell, and awk, but at least each piece is
fairly simple to audit.</p>
<h3 id="roundsh-tank1-tank2-">round.sh tank1 tank2 …</h3>
<p>Runs a single round, awards points with rank.awk, and creates a new
summary.html with summary.awk. This is the main interface that you want
to run from cron or whatever.</p>
<h3 id="forftanks-tank1-tank2-">forftanks tank1 tank2 …</h3>
<p>A program to run a round of tanks and output a JSON description of the
game. This is what tanks.js uses to render a game graphically.
The object printed contains:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>[[game-width, game-height],
[[tank1-color,
[[sensor1range, sensor1angle, sensor1width, sensor1turret],
...]],
...],
[[
[tank1x, tank1y, tank1angle, tank1sensangle,
tank1flags, tank1sensors],
...],
...]]
</code></pre>
</div>
<p>If file descriptor 3 is open for writes, it also outputs the results of
the round to fd3.</p>
<h3 id="rankawk">rank.awk</h3>
<p>Processes the fd3 output of forftanks to award points and output an
HTML results table.</p>
<h3 id="summaryawk-tank1-tank2">summary.awk tank1 tank2</h3>
<p>Creates summary.html, linking to all rounds and showing overall
standing.</p>
<h3 id="designercgi">designer.cgi</h3>
<p>Accepts form input and writes a tank.</p>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/running">Running</a></li>
<li><a href="/history">History</a></li>
<li><a href="/thanks">Thanks</a></li>
<li><a href="https://github.com/dirtbags/tanks" title="Tanks on Github">Source</a></li>
</ul>
</nav>
</body>
</html>

260
docs/_site/standie.svg Normal file
View File

@ -0,0 +1,260 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="765"
height="990"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
version="1.0"
sodipodi:docname="standie.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective10" />
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective2447" />
<inkscape:perspective
id="perspective2547"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 526.18109 : 1"
sodipodi:type="inkscape:persp3d" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="10000"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.66"
inkscape:cx="545.71983"
inkscape:cy="606.66523"
inkscape:document-units="in"
inkscape:current-layer="layer1"
showgrid="true"
units="in"
inkscape:window-width="1276"
inkscape:window-height="1006"
inkscape:window-x="0"
inkscape:window-y="14"
inkscape:snap-global="false"
borderlayer="false" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="layer4"
inkscape:label="dirtbags"
style="display:none"
transform="translate(-308.19052,44.944851)">
<text
xml:space="preserve"
style="font-size:48px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:condensed;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L Bold Condensed"
x="527.22546"
y="731.11957"
id="text3300"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3302"
x="527.22546"
y="731.11957">dirtbags</tspan></text>
</g>
<g
id="layer2"
inkscape:label="dirtbags.net"
style="display:none"
transform="translate(-308.19052,44.944851)">
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:condensed;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L Bold Condensed"
x="502.14645"
y="731.11957"
id="text3308"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3310"
x="502.14645"
y="731.11957">dirtbags.net</tspan></text>
</g>
<text
sodipodi:linespacing="125%"
id="text3272"
y="894.32263"
x="-229.31424"
style="font-size:85.50655365px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:condensed;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L Bold Condensed"
xml:space="preserve"><tspan
y="894.32263"
x="-229.31424"
id="tspan3274"
sodipodi:role="line" /></text>
<g
id="g2483"
transform="matrix(0,-0.9774231,0.9774231,0,5.9709151,978.27037)">
<path
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3.5999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 175.19167,183.03312 C 99.732022,183.03312 46.463603,265.66131 52.800357,320.35092 C 56.865847,355.43825 78.008194,360.81414 108.70365,417.08914 C 127.30007,451.18262 141.94307,497.65872 117.64249,511.72748 C 93.341942,525.79621 17.896271,564.16873 17.896269,564.16873 L 17.896269,750.91978 L 392.6186,750.91978 C 392.6186,750.91978 396.45354,739.40818 393.89557,715.10762 C 424.77669,716.7579 446.85739,717.6412 479.59505,712.52528 C 525.15994,694.07825 549.93255,679.66041 579.36966,665.22032 C 586.02066,657.5848 597.25139,603.81939 594.6934,580.79784 C 592.17395,558.1228 589.67671,519.32181 578.60346,487.60674 C 578.60523,486.65238 578.5653,485.68637 578.48995,484.71226 C 583.03605,468.05828 584.61872,460.10456 589.58549,443.96246 C 594.70139,427.33576 572.97676,427.32494 578.09266,414.53519 C 583.20858,401.74542 587.02555,410.70345 590.86247,374.89208 C 594.69938,339.08072 580.35658,335.54421 571.67941,322.45083 C 574.54639,311.52442 575.86661,304.97431 559.88904,292.04414 C 552.92295,286.40669 548.09722,283.23692 539.28179,282.73132 C 530.46634,282.22572 518.44848,282.02247 501.82178,280.74349 C 501.9203,280.60593 501.34649,295.16383 501.62962,295.38537 C 501.1379,295.38537 487.00022,274.21015 478.1259,282.12587 C 469.65353,289.68309 487.57316,316.17003 487.57314,315.57621 C 488.13876,315.72398 469.66967,313.89615 468.07386,322.45083 C 466.51084,330.82968 480.49172,333.77589 480.29557,333.97202 C 480.09941,333.38092 467.36345,331.92166 467.8047,342.01817 C 468.28027,352.90038 486.49802,353.60792 486.49804,353.94234 C 477.80286,375.68026 447.51329,446.91776 427.1538,495.09836 C 433.54868,509.16711 491.11623,514.3098 491.11623,514.3098 C 491.11623,514.3098 497.22176,550.95675 482.14901,565.44571 C 461.68536,568.61206 387.11856,559.84576 337.62337,534.76983 C 295.41712,525.81701 274.43981,533.20189 250.64693,528.35656 C 253.43342,502.78719 254.50625,488.71347 254.50625,488.71347 C 254.50625,488.71347 287.76445,483.59435 287.76445,436.27222 C 287.76445,388.95005 308.06176,384.92301 303.08819,359.53996 C 299.0538,338.95007 291.52311,325.95944 307.88395,308.0919 C 320.28738,288.85396 322.27084,259.76896 304.36519,239.30532 C 279.3244,210.68728 250.65133,183.03312 175.19167,183.03312 z M 508.59665,289.73179 C 508.36976,289.94299 516.73247,290.58463 526.13383,291.20742 C 527.15504,298.08777 538.00646,307.78883 544.52232,313.05793 C 543.96514,314.31291 543.39235,315.51947 542.81967,316.7186 L 509.36363,316.1227 C 509.53671,315.72022 508.17637,290.23076 508.59665,289.73179 z M 494.19558,356.2409 C 497.51201,357.87917 503.76241,358.7111 508.5399,359.994 C 502.33706,361.58094 496.89765,361.52792 496.25252,366.66347 C 495.34942,373.85254 510.37662,378.54561 523.65042,382.39909 C 520.09348,383.65623 513.58741,386.65836 513.3008,390.16719 C 512.41608,400.99858 534.84172,405.61532 554.77383,409.55616 C 557.35604,425.88768 560.88468,447.29929 563.79052,464.11035 C 512.71042,459.63287 481.41158,456.69828 449.60023,464.99004 C 463.08015,433.05142 479.50059,390.97818 494.19558,356.2409 z"
id="path3227"
sodipodi:nodetypes="csssccccccsccssscsscczczczcccccccsscscccccccccscscccc" />
<g
transform="matrix(2.1376639,0,0,2.1376639,-775.68918,-222.16264)"
style="display:inline"
inkscape:label="dirtbags rot"
id="layer3">
<text
transform="matrix(0.387016,-0.922073,0.922073,0.387016,0,0)"
sodipodi:linespacing="125%"
id="text3166"
y="615.24457"
x="-90.885483"
style="font-size:34.41987228px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:condensed;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L Bold Condensed"
xml:space="preserve"><tspan
y="615.24457"
x="-90.885483"
id="tspan3168"
sodipodi:role="line">dirtbags</tspan></text>
</g>
<rect
transform="matrix(-0.7070466,-0.707167,0.707167,-0.7070466,0,0)"
y="373.30301"
x="-700.88867"
height="95.298477"
width="6.1200857"
id="rect3375"
style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ba2b2b;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
transform="matrix(-0.8460474,-0.2204554,0.2204554,-0.8460474,1056.4658,666.60214)"
sodipodi:end="3.144758"
sodipodi:start="0"
d="M 522,526 A 140,140 0 1 1 242.0007,525.55685 L 382,526 z"
sodipodi:ry="140"
sodipodi:rx="140"
sodipodi:cy="526"
sodipodi:cx="382"
id="path2593"
style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#2bb6ba;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
sodipodi:type="arc" />
<path
transform="matrix(-0.8460474,-0.2204554,0.2204554,-0.8460474,1056.4658,666.60214)"
sodipodi:type="arc"
style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#2bb6ba;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path2595"
sodipodi:cx="382"
sodipodi:cy="526"
sodipodi:rx="149"
sodipodi:ry="149"
d="M 414.70023,380.63255 A 149,149 0 0 1 492.14396,425.65406 L 382,526 z"
sodipodi:start="4.9336547"
sodipodi:end="5.5443022" />
<path
transform="matrix(-0.8460474,-0.2204554,0.2204554,-0.8460474,1056.4658,666.60214)"
sodipodi:end="4.9362896"
sodipodi:start="4.1338205"
d="M 248.57447,321.7119 A 244,244 0 0 1 436.17643,288.09053 L 382,526 z"
sodipodi:ry="244"
sodipodi:rx="244"
sodipodi:cy="526"
sodipodi:cx="382"
id="path2597"
style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#2bb6ba;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
sodipodi:type="arc" />
<path
transform="matrix(-0.8460474,-0.2204554,0.2204554,-0.8460474,1056.4658,666.60214)"
sodipodi:type="arc"
style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#2bb6ba;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path2599"
sodipodi:cx="382"
sodipodi:cy="526"
sodipodi:rx="244"
sodipodi:ry="244"
d="M 562.30536,361.60421 A 244,244 0 0 1 625.94232,520.69476 L 382,526 z"
sodipodi:start="5.5439091"
sodipodi:end="6.2614408" />
<rect
transform="matrix(-0.9676424,-0.2523255,0.2523255,-0.9676424,0,0)"
y="57.387951"
x="-879.38464"
height="55.677361"
width="44.228729"
id="rect2383"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#2bb6ba;stroke-width:0.96922117px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<rect
transform="matrix(-0.9676424,-0.2523255,0.2523255,-0.9676424,0,0)"
y="40.170197"
x="-835.15601"
height="84.308083"
width="27.064905"
id="rect2385"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.96357071px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<rect
transform="matrix(-0.9676424,-0.2523255,0.2523255,-0.9676424,0,0)"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.96357071px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="rect2387"
width="27.064905"
height="84.308083"
x="-906.44958"
y="40.170197" />
<rect
inkscape:transform-center-y="-20.587678"
inkscape:transform-center-x="-11.779977"
transform="matrix(-0.7129456,-0.7012194,0.7012194,-0.7129456,0,0)"
y="446.83466"
x="-708.03717"
height="57.243172"
width="11.448635"
id="rect3159"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
transform="matrix(-0.8068409,-0.3367557,0.3367557,-0.8068409,964.03209,766.69774)"
d="M 475,391 L 480.97412,428.65667 L 518.98424,425.66578 L 493.26788,453.81509 L 519.30517,481.66781 L 481.26326,479.11275 L 475.72111,516.83541 L 454,485.5 L 421.05176,504.68667 L 432.00788,468.16711 L 396.46425,454.36983 L 431.84742,440.1661 L 420.47347,403.7745 L 453.63944,422.58229 L 475,391 z"
inkscape:randomized="0"
inkscape:rounded="0"
inkscape:flatsided="false"
sodipodi:arg2="-0.90332843"
sodipodi:arg1="-1.3521274"
sodipodi:r2="32.268406"
sodipodi:r1="64.536812"
sodipodi:cy="454"
sodipodi:cx="461"
sodipodi:sides="7"
id="path2591"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#494b0e;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
sodipodi:type="star" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 14 KiB

37
docs/_site/thanks.html Normal file
View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/assets/css/dirtbags.css?v=">
<link rel="icon" type="image/png" href="/assets/images/icon.png">
<title> by </title>
</head>
<body>
<h1 id="title">thanks</h1>
<ul>
<li>Tom Poindexter: Inspiration (Author of CRobots)</li>
<li>Paul Ferrell: Initial implementation</li>
<li>Aaron McPhall: Math optimizations</li>
<li>Nick Moffitt: Suggestion to use FORTH-like language</li>
<li>Adam Glasgall: C Forf prototype</li>
<li>Adam Thomas: Various patches</li>
<li>Various Australians: Creation of some mind-blowing tanks</li>
<li>Alyssa Milburn: JS Tanks, Tank Debugger, many more other helpful contributions</li>
</ul>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/running">Running</a></li>
<li><a href="/history">History</a></li>
<li><a href="/thanks">Thanks</a></li>
<li><a href="https://github.com/dirtbags/tanks" title="Tanks on Github">Source</a></li>
</ul>
</nav>
</body>
</html>

1897
docs/_site/token.svg Normal file

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 118 KiB

View File

@ -0,0 +1,151 @@
/**** document ****/
html {
background: #eed url(/assets/images/grunge.png) repeat-x;
}
body {
font-family: sans-serif;
color: #112;
padding: 10px;
max-width: 700px;
}
/**** heading ****/
#title {
text-transform: lowercase;
font-size: 1.6em;
padding: 3px;
margin: 0 0 1em 2em;
}
#title:before {
color: #999;
letter-spacing: -0.1em;
content: "Dirtbags: ";
}
/*** left side bar ***/
nav h2 {
display: none;
}
nav ul {
list-style: none;
text-align: center;
}
nav li {
display: inline;
}
nav li a {
text-transform: lowercase;
font-size: 0.9em;
}
nav li + li:before {
content: " | ";
}
/**** body ****/
a img {
border: 0px;
}
a {
text-decoration: none;
color: #2a4;
font-weight: bold;
}
a:hover {
color: #ddc;
background: #2a4;
}
h1, h2, h3 {
color: #464;
letter-spacing: -0.05em;
}
.readme {
background-color: #ccc;
margin: 1em;
}
pre {
background-color: #ccc;
border: solid #888 2px;
padding: 0.25em;
}
th {
vertical-align: top;
text-align: center;
}
td {
vertical-align: top;
text-align: right;
}
p {
line-height: 1.4em;
margin-bottom: 20px;
}
hr {
border: 1px solid #444;
}
dt {
white-space: pre;
background-color: #333;
padding: 5px;
border: 2px solid green;
border-bottom: none;
font-weight: bold;
}
dd {
border: 2px solid green;
margin: 0px;
padding: 5px;
background-color: #282828;
}
/**** special cases ****/
.wide {
max-width: inherit;
}
.figure {
margin: 0.5em 1em;
float: right;
font-size: small;
text-align: center;
}
.scoreboard {
background: #222;
}
.scoreboard td {
height: 400px;
}
#battlefield {
border: 2px solid green;
}
.solved {
text-decoration: line-through;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -0,0 +1,5 @@
default_ = [[300, 150, 50],[["#a08080",[[50, 0.00, 0.14, 1],[30, 0.00, 0.87, 0],[50, 0.00, 0.17, 0],[100, 5.50, 1.75, 1],[100, 0.79, 1.75, 1],[60, 3.14, 3.14, 0],]], ["#808080",[[50, 0.00, 0.12, 1],[30, 0.00, 1.57, 0],]],],[[[75,75,3.86,0.96,2,0], [225,75,4.26,0.49,0,0],], [[73,73,3.86,0.65,2,0], [223,72,4.26,0.68,0,0],], [[69,70,3.86,0.33,2,0], [222,70,4.24,0.87,0,0],], [[65,66,3.86,0.02,2,0], [221,67,4.23,1.06,0,0],], [[61,62,3.86,-0.00,2,0], [220,65,4.22,1.27,0,0],], [[56,59,3.86,0.00,2,0], [218,63,4.20,1.48,0,0],], [[52,55,3.86,-0.00,2,0], [217,60,4.19,1.68,0,0],], [[48,51,3.86,-0.00,2,0], [215,58,4.18,1.88,0,0],], [[44,48,3.86,0.00,2,0], [214,55,4.16,2.09,0,0],], [[39,44,3.86,-0.00,2,0], [213,53,4.15,2.30,0,0],], [[35,41,3.77,0.00,2,0], [211,51,4.13,2.51,0,0],], [[31,38,3.68,-0.00,2,0], [209,48,4.12,2.72,0,0],], [[26,36,3.60,-0.00,2,0], [208,46,4.11,2.93,0,0],], [[21,34,3.51,0.00,2,0], [206,44,4.09,3.14,0,0],], [[16,33,3.43,-0.00,2,0], [205,42,4.08,3.35,0,0],], [[11,32,3.34,-0.00,2,0], [203,39,4.06,3.56,0,0],], [[6,31,3.25,0.00,2,8], [201,37,4.05,3.77,0,0],], [[2,31,3.11,-0.31,2,16], [200,35,4.04,3.98,0,0],], [[299,31,3.25,0.00,2,24], [198,33,4.02,4.19,0,0],], [[293,29,3.39,-0.00,2,8], [196,31,4.01,4.40,0,0],], [[289,28,3.39,-0.31,2,24], [194,29,4.00,4.59,0,0],], [[283,27,3.39,-0.31,2,24], [192,27,3.98,4.80,0,0],], [[276,25,3.39,-0.31,2,24], [190,25,3.97,4.99,0,0],], [[269,23,3.39,-0.30,2,24], [189,23,3.95,5.18,0,0],], [[262,21,3.39,-0.28,2,24], [187,21,3.94,5.39,0,0],], [[255,20,3.39,-0.26,2,24], [185,19,3.93,5.59,0,0],], [[249,18,3.39,-0.24,2,24], [183,17,3.91,5.78,0,0],], [[242,16,3.39,-0.23,2,24], [181,15,3.90,5.99,0,0],], [[235,14,3.39,-0.21,3,25], 0,],]];
antlion = [[300, 150, 50],[["#808080",[[50, 0.00, 0.00, 1],[70, 0.00, 0.87, 0],]], ["#ff8844",[[50, 0.00, 0.09, 1],[100, 4.68, 3.09, 1],[100, 1.61, 3.11, 1],[60, 0.00, 2.09, 0],[60, 2.09, 2.09, 0],[60, 4.19, 2.09, 0],[100, 0.00, 0.09, 1],]],],[[[75,75,5.78,2.71,0,0], [225,75,3.28,1.95,0,0],], [[77,73,5.78,3.02,0,0], [225,75,3.28,2.06,0,0],], [[81,71,5.78,3.14,0,0], [225,75,3.28,2.16,0,0],], [[87,68,5.78,3.14,0,0], [225,75,3.28,2.25,0,0],], [[93,64,5.78,3.14,0,0], [225,75,3.28,2.34,0,0],], [[99,61,5.78,3.14,0,0], [225,75,3.28,2.44,0,0],], [[105,57,5.78,3.14,0,0], [225,75,3.28,2.53,0,0],], [[112,54,5.78,3.14,0,0], [225,75,3.28,2.62,0,0],], [[118,51,5.78,3.14,0,0], [225,75,3.28,2.71,0,0],], [[124,47,5.78,3.14,0,0], [225,75,3.28,2.79,0,2],], [[130,44,5.78,3.14,0,0], [225,75,3.28,2.48,0,2],], [[136,40,5.78,3.14,0,0], [225,75,3.28,2.16,0,2],], [[142,37,5.78,3.14,0,0], [225,75,3.28,1.85,0,2],], [[148,34,5.78,3.14,0,0], [225,75,3.28,1.54,0,2],], [[154,30,5.78,3.14,0,0], [225,75,3.28,1.22,0,2],], [[160,28,5.90,3.14,0,0], [225,75,3.28,0.91,0,2],], [[167,25,5.90,3.14,0,0], [225,75,3.28,0.59,0,70],], [[173,23,5.90,3.14,0,0], [225,75,3.28,0.28,0,4],], [[180,20,5.90,3.14,0,0], [225,75,3.28,0.59,0,68],], [[186,17,5.90,3.14,0,0], [225,75,3.28,0.28,0,4],], [[193,15,5.90,3.14,0,0], [225,75,3.28,0.59,0,4],], [[199,12,5.90,3.14,0,0], [225,75,3.28,0.91,0,92],], [[206,10,5.90,3.14,0,0], [222,74,3.24,0.59,0,20],], [[212,7,5.90,3.14,0,0], [218,74,3.15,0.91,0,20],], [[218,4,5.78,3.14,0,0], [212,75,2.96,1.22,0,4],], [[224,1,5.78,3.14,0,0], [208,77,2.77,1.54,0,2],], [[230,147,5.78,3.14,0,0], [207,78,2.65,1.22,0,2],], [[236,144,5.78,3.14,0,0], [207,78,2.65,0.91,0,2],], [[242,140,5.78,3.14,0,0], [207,78,2.65,0.59,0,2],], [[248,137,5.78,3.14,0,0], [207,78,2.65,0.28,0,2],], [[254,134,5.78,3.14,0,0], [207,78,2.65,-0.03,0,2],], [[260,130,5.78,3.14,0,0], [207,78,2.65,-0.35,0,2],], [[267,127,5.78,3.14,0,0], [207,78,2.65,-0.66,0,2],], [[273,123,5.78,3.14,0,0], [207,78,2.65,-0.98,0,2],], [[279,120,5.78,3.14,0,0], [207,78,2.65,-1.29,0,2],], [[285,117,5.78,3.14,0,0], [207,78,2.65,-1.61,0,2],], [[291,113,5.78,3.14,0,0], [207,78,2.65,-1.92,0,2],], [[297,110,5.78,3.14,0,0], [207,78,2.65,-2.23,0,66],], [[3,106,5.78,3.14,0,0], [207,78,2.65,-1.92,0,2],], [[9,103,5.78,3.14,0,0], [207,78,2.65,-2.23,0,2],], [[16,100,5.78,3.14,0,0], [207,78,2.65,-2.55,0,0],], [[22,96,5.78,3.14,0,0], [207,78,2.65,-2.44,0,0],], [[28,93,5.78,3.14,0,0], [207,78,2.65,-2.32,0,0],], [[34,90,5.78,3.14,0,0], [207,78,2.65,-2.20,0,0],], [[40,86,5.78,3.14,0,0], [207,78,2.65,-2.08,0,0],], [[46,84,5.90,3.14,0,0], [207,78,2.65,-1.95,0,0],], [[52,81,5.90,3.14,0,0], [207,78,2.65,-1.85,0,0],], [[59,79,5.90,3.14,0,0], [207,78,2.65,-1.75,0,0],], [[65,76,5.90,3.14,0,0], [207,78,2.65,-1.64,0,0],], [[72,73,5.90,3.14,0,0], [207,78,2.65,-1.54,0,0],], [[78,71,5.90,3.14,0,0], [207,78,2.65,-1.43,0,0],], [[85,68,5.90,3.14,0,0], [207,78,2.65,-1.33,0,0],], [[91,66,5.90,3.14,0,0], [207,78,2.65,-1.20,0,0],], [[98,63,5.90,3.14,0,0], [207,78,2.65,-1.08,0,0],], [[104,60,5.90,3.14,0,0], [207,78,2.65,-0.96,0,4],], [[111,58,5.90,3.14,0,0], [207,78,2.65,-0.65,0,4],], [[117,56,6.03,3.14,0,0], [207,78,2.65,-0.33,0,4],], [[124,54,6.03,3.14,0,0], [207,78,2.65,-0.02,0,4],], [[130,53,6.03,3.14,0,0], [207,78,2.65,0.30,0,4],], [[137,51,6.03,3.14,0,0], [207,78,2.65,0.61,0,4],], [[144,49,6.03,3.14,0,0], [207,78,2.65,0.93,0,70],], [[151,47,6.03,3.14,0,0], [207,78,2.65,0.61,0,28],], [[157,45,6.03,3.14,0,0], [205,79,2.65,0.93,0,28],], [0, [201,81,2.56,1.24,1,85],],]];
shortround = [[300, 300, 50],[["#80f0c0",[[50, 0.00, 0.17, 1],[35, 0.00, 1.57, 0],[100, 0.52, 1.03, 0],[100, 5.76, 1.03, 0],[70, 3.14, 3.14, 0],[100, 1.57, 1.03, 0],[100, 4.71, 1.03, 0],[100, 0.00, 0.09, 1],[55, 0.87, 1.55, 0],[55, 5.41, 1.55, 0],]], ["#ff8844",[[50, 0.00, 0.09, 1],[100, 4.68, 3.09, 1],[100, 1.61, 3.11, 1],[60, 0.00, 2.09, 0],[60, 2.09, 2.09, 0],[60, 4.19, 2.09, 0],[100, 0.00, 0.09, 1],]], ["#ff0033",[[50, 0.00, 0.17, 1],[100, 1.57, 2.62, 1],[100, 4.71, 2.62, 1],]], ["#a08080",[[50, 0.00, 0.14, 1],[30, 0.00, 0.87, 0],[50, 0.00, 0.17, 0],[100, 5.50, 1.75, 1],[100, 0.79, 1.75, 1],[60, 3.14, 3.14, 0],]],],[[[75,75,0.87,0.02,2,0], [225,75,0.24,1.41,0,0], [75,225,5.64,2.15,0,0], [225,225,0.35,-0.00,2,0],], [[76,76,0.87,-0.00,2,0], [225,75,0.24,1.50,0,0], [75,225,5.64,1.83,0,0], [227,225,0.35,0.00,2,0],], [[79,80,0.87,0.00,2,0], [225,75,0.24,1.61,0,0], [75,225,5.64,1.52,0,0], [231,227,0.35,-0.00,2,0],], [[83,85,0.87,-0.00,2,0], [225,75,0.24,1.71,0,0], [75,225,5.64,1.20,0,0], [237,229,0.35,-0.00,2,0],], [[87,90,0.87,-0.00,2,0], [225,75,0.24,1.82,0,0], [75,225,5.64,0.89,0,0], [242,231,0.35,0.00,2,0],], [[91,95,0.87,0.00,2,0], [225,75,0.24,1.92,0,0], [75,225,5.64,0.58,0,0], [247,233,0.35,-0.00,2,0],], [[95,100,0.96,-0.00,2,0], [225,75,0.24,2.02,0,0], [75,225,5.64,0.26,0,0], [252,235,0.35,0.00,2,0],], [[98,105,1.05,-0.00,2,0], [225,75,0.24,2.11,0,0], [75,225,5.64,0.00,0,0], [258,237,0.35,-0.00,2,0],], [[101,111,1.13,0.00,2,0], [225,75,0.24,2.20,0,0], [75,225,5.64,-0.00,0,0], [263,239,0.35,-0.00,2,0],], [[103,116,1.13,-0.00,2,0], [225,75,0.24,2.29,0,0], [75,225,5.64,0.00,0,4], [268,240,0.35,0.00,2,8],], [[105,122,1.22,0.00,2,4], [225,75,0.24,2.37,0,0], [75,225,5.64,-0.31,0,4], [272,242,0.28,-0.31,2,24],], [[106,127,1.38,-0.00,2,4], [225,75,0.24,2.46,0,0], [75,225,5.64,-0.63,0,4], [278,243,0.22,-0.30,2,24],], [[106,131,1.63,-0.00,2,4], [225,75,0.24,2.55,0,0], [75,225,5.64,-0.94,0,6], [285,244,0.22,-0.28,2,24],], [[105,134,1.93,0.00,2,140], [225,75,0.24,2.65,0,0], [75,225,5.64,-1.26,0,6], [292,246,0.22,-0.26,2,8],], [[102,138,2.22,-0.00,2,8], [225,75,0.24,2.74,0,0], [75,225,5.64,-1.57,0,6], [296,247,0.22,-0.58,2,24],], [[99,141,2.32,-0.00,2,8], [225,75,0.24,2.83,0,0], [75,225,5.64,-1.88,0,6], [3,248,0.22,-0.58,2,24],], [[97,144,2.15,0.00,2,8], [225,75,0.24,2.91,0,0], [75,225,5.64,-2.20,0,6], [10,250,0.22,-0.56,2,24],], [[96,148,1.88,-0.00,2,140], [225,75,0.24,3.00,0,0], [75,225,5.64,-2.51,0,6], [17,251,0.22,-0.54,2,24],], [[95,153,1.64,-0.00,2,4], [225,75,0.24,3.09,0,0], [75,225,5.64,-2.83,0,6], [24,253,0.22,-0.54,2,24],], [[95,158,1.64,0.00,2,4], [225,75,0.24,3.18,0,0], [75,225,5.64,-3.14,1,3], 0,], [[94,162,1.82,-0.00,2,140], [225,75,0.24,3.26,0,0], [75,225,5.64,-2.83,0,2], 0,], [[92,168,1.97,0.00,2,652], [225,75,0.24,3.37,0,0], [75,225,5.64,-2.51,0,2], 0,], [[89,175,1.97,-0.00,3,653], [225,75,0.24,3.46,0,0], 0, 0,], [[86,181,1.97,-0.00,0,0], [225,75,0.24,3.54,0,0], 0, 0,], [[84,187,1.97,0.00,0,0], [225,75,0.24,3.63,0,0], 0, 0,], [[81,193,1.97,-0.00,0,0], [225,75,0.24,3.72,0,0], 0, 0,], [[78,198,2.05,-0.00,0,0], [225,75,0.24,3.80,0,0], 0, 0,], [[76,204,2.05,0.00,0,0], [225,75,0.24,3.89,0,0], 0, 0,], [[73,209,2.05,-0.00,0,0], [225,75,0.24,3.98,0,0], 0, 0,], [[70,215,2.05,0.00,0,0], [225,75,0.24,4.08,0,0], 0, 0,], [[67,220,2.05,-0.00,0,0], [225,75,0.24,4.19,0,0], 0, 0,], [[64,226,2.05,-0.00,0,0], [225,75,0.24,4.29,0,0], 0, 0,], [[61,231,2.14,0.00,0,0], [225,75,0.24,4.40,0,0], 0, 0,], [[57,237,2.14,-0.00,0,0], [225,75,0.24,4.49,0,0], 0, 0,], [[54,242,2.14,-0.00,0,0], [225,75,0.24,4.57,0,0], 0, 0,], [[50,247,2.14,0.00,0,0], [225,75,0.24,4.66,0,0], 0, 0,], [[47,252,2.14,-0.00,0,0], [225,75,0.24,4.75,0,0], 0, 0,], [[44,258,2.14,-0.00,0,0], [225,75,0.24,4.83,0,0], 0, 0,], [[40,263,2.14,0.00,0,0], [225,75,0.24,4.92,0,0], 0, 0,], [[37,268,2.14,-0.00,0,0], [225,75,0.24,5.01,0,0], 0, 0,], [[33,274,2.14,0.00,0,0], [225,75,0.24,5.10,0,0], 0, 0,], [[30,279,2.23,-0.00,0,0], [225,75,0.24,5.20,0,0], 0, 0,], [[26,284,2.23,-0.00,2,0], [225,75,0.24,5.31,0,0], 0, 0,], [[22,289,2.23,0.00,2,0], [225,75,0.24,5.39,0,0], 0, 0,], [[18,294,2.23,-0.00,2,0], [225,75,0.24,5.48,0,0], 0, 0,], [[14,299,2.23,-0.00,2,0], [225,75,0.24,5.57,0,0], 0, 0,], [[10,3,2.31,0.00,2,0], [225,75,0.24,5.65,0,0], 0, 0,], [[6,8,2.31,-0.00,2,4], [225,75,0.24,5.74,0,2], 0, 0,], [[2,11,2.42,-0.00,2,140], [225,75,0.24,5.43,0,66], 0, 0,], [[297,15,2.46,0.00,2,140], [225,75,0.24,5.74,0,2], 0, 0,], [[291,20,2.46,-0.00,2,140], [225,75,0.24,5.43,0,66], 0, 0,], [[286,24,2.46,0.00,2,140], [225,75,0.24,5.74,0,2], 0, 0,], [[280,29,2.46,-0.00,2,140], [225,75,0.24,5.43,0,66], 0, 0,], [[275,33,2.46,-0.00,2,140], [225,75,0.24,5.74,0,10], 0, 0,], [[270,37,2.46,0.00,2,908], [222,74,0.24,5.43,0,78], 0, 0,], [[264,42,2.46,-0.00,3,397], 0, 0, 0,],]];

310
docs/assets/js/tanks.js Normal file
View File

@ -0,0 +1,310 @@
function dbg(o) {
e = document.getElementById("debug");
e.innerHTML = o;
}
function torgba(color, alpha) {
var r = parseInt(color.substring(1,3), 16);
var g = parseInt(color.substring(3,5), 16);
var b = parseInt(color.substring(5,7), 16);
return "rgba(" + r + "," + g + "," + b + "," + alpha + ")";
}
function Tank(ctx, width, height, color, sensors) {
var craterStroke = torgba(color, 0.5);
var craterFill = torgba(color, 0.2);
var sensorStroke = torgba(color, 0.4);
var maxlen = 0;
this.x = 0;
this.y = 0;
this.rotation = 0;
this.turret = 0;
this.dead = 0;
// Do all the yucky math up front
this.sensors = new Array();
for (i in sensors) {
var s = sensors[i];
if (! s) {
this.sensors[i] = [0,0,0,0];
} else {
// r, angle, width, turret
this.sensors[i] = new Array();
this.sensors[i][0] = s[0];
this.sensors[i][1] = s[1] - s[2]/2;
this.sensors[i][2] = s[1] + s[2]/2;
this.sensors[i][3] = s[3]?1:0;
if (s[0] > maxlen) {
maxlen = s[0];
}
}
}
// Set up our state, for later interleaved draw requests
this.set_state = function(x, y, rotation, turret, flags, sensor_state) {
this.x = x;
this.y = y;
this.rotation = rotation;
this.turret = turret;
if (flags & 1) {
this.fire = 5;
}
this.led = flags & 2;
this.dead = flags & 4;
this.sensor_state = sensor_state;
}
this.draw_crater = function() {
if (!this.dead) {
return;
}
var points = 7;
var angle = Math.PI / points;
ctx.save();
ctx.translate(this.x, this.y);
ctx.rotate(this.rotation);
if (this.fire == 5) {
ctx.save();
ctx.rotate(this.turret);
// one frame of cannon fire
this.draw_cannon();
this.fire = 0;
ctx.restore();
}
ctx.lineWidth = 2;
ctx.strokeStyle = craterStroke;
ctx.fillStyle = craterFill;
ctx.beginPath();
ctx.moveTo(12, 0);
for (i = 0; i < points; i += 1<