Add shell script to run a round

This commit is contained in:
Neale Pickett 2010-07-14 16:39:06 -06:00
parent 499aeb9455
commit ac4e3b5157
1 changed files with 46 additions and 0 deletions

46
round.sh Executable file
View File

@ -0,0 +1,46 @@
#! /bin/sh
if [ -f next-round ]; then
next=$(cat next-round)
else
next=0
fi
expr $next + 1 > next-round
fn=$(printf "round-%04d.html" $next)
echo -n "Running round $next... "
cat <<EOF > $fn
<!DOCTYPE html>
<html>
<head>
<title>Tanks Round $next</title>
<script type="application/javascript" src="tanks.js"></script>
<style type="text/css">
body {
background-color: #444444;
color: white;
}
</style>
<script type="application/javascript">
function go() {
start(
// Start JSON data
EOF
./run-tanks players/* >> $fn
cat <<EOF >> $fn
// end JSON data
);
}
window.onload = go;
</script>
</head>
<body>
<div id="game_box"><canvas id="battlefield"></canvas></div>
<p><span id="fps">0</span> fps</p>
</body>
</html>
EOF
echo "done."