Tron down to 100X100, My CPU is happy

pull/98/head
Gnieark 8 years ago
parent aa48d68c2a
commit 8355a75c99

@ -1,7 +1,7 @@
<?php
class Coords{
private static $min = 0;
private static $max = 999;
private static $max = 99;
public $x;
public $y;

@ -232,8 +232,8 @@ class TronGame
foreach($botsInfos as $bot){
//find a random start position
do{
$x = rand(1,999);
$y = rand(1,999);
$x = rand(1,99);
$y = rand(1,99);
}while(in_array($x.",".$y,$positions));
$positions[] = $x.",".$y;

@ -34,8 +34,8 @@
<p>The game ends when there are less than two snakes left</p>
<h3>Grid</h3>
<ul>
<li>width: 1000 cells</li>
<li>Height: 1000 cells</li>
<li>width: 100 cells</li>
<li>Height: 100 cells</li>
</ul>
<h3>Communications between the arena and the bots</h3>

@ -34,8 +34,8 @@
<p>Le jeu prend fin lorsqu'il reste moins de deux serpents.</p>
<h3>La grille</h3>
<ul>
<li>largeur: 1000 cases</li>
<li>hauteur: 1000 cases</li>
<li>largeur: 100 cases</li>
<li>hauteur: 100 cases</li>
</ul>
<h3>Communications entre l'arène et les bots</h3>

@ -90,7 +90,7 @@ function drawMap(map){
for (var botId in map){
if(typeof(map[botId]['x']) != 'undefined'){ //don't draw deads bots
//draw the point
var rect=createElemNS('rect',{'x':map[botId]['x'],'y':map[botId]['y'],'width':'2','height':'2','style':'fill:' + botsColor[botId] + ';'});
var rect=createElemNS('rect',{'x':map[botId]['x'],'y':map[botId]['y'],'width':'1','height':'1','style':'fill:' + botsColor[botId] + ';'});
document.getElementById('map').appendChild(rect);
}
}
@ -159,7 +159,7 @@ function tron(xd_check){
document.getElementById('fightResult').removeChild(document.getElementById('fightResult').firstChild);
}
// draw border;
var svg = createElemNS('svg',{'id':'map','width':'500','height':'500','viewBox':'0 0 1000 1000'});
var svg = createElemNS('svg',{'id':'map','width':'500','height':'500','viewBox':'0 0 100 100'});
var rect=createElemNS('rect',{'x':'0','y':'0','width':'1000','height':'1000','style':'stroke:#000000; fill:none;'});
svg.appendChild(rect);
document.getElementById("fightResult").appendChild(svg);

Loading…
Cancel
Save