diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.gitmodules b/.gitmodules old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/countBattles.txt b/countBattles.txt old mode 100644 new mode 100755 index f84ccb2..5b208ae --- a/countBattles.txt +++ b/countBattles.txt @@ -1 +1 @@ -1617 \ No newline at end of file +1622 \ No newline at end of file diff --git a/html/.htaccess b/html/.htaccess old mode 100644 new mode 100755 diff --git a/html/imgs/Arenes-Nimes.jpg b/html/imgs/Arenes-Nimes.jpg old mode 100644 new mode 100755 diff --git a/html/imgs/Bronze_Medal.svg b/html/imgs/Bronze_Medal.svg old mode 100644 new mode 100755 diff --git a/html/imgs/Emoji_u1f4a9.svg b/html/imgs/Emoji_u1f4a9.svg old mode 100644 new mode 100755 diff --git a/html/imgs/Gold_Medal.svg b/html/imgs/Gold_Medal.svg old mode 100644 new mode 100755 diff --git a/html/imgs/Silver_Medal.svg b/html/imgs/Silver_Medal.svg old mode 100644 new mode 100755 diff --git a/html/index.php b/html/index.php old mode 100644 new mode 100755 diff --git a/html/log.txt b/html/log.txt old mode 100644 new mode 100755 diff --git a/html/principe.gif b/html/principe.gif old mode 100644 new mode 100755 diff --git a/html/style.css b/html/style.css old mode 100644 new mode 100755 diff --git a/html/testBotScripts/connectfour.html b/html/testBotScripts/connectfour.html old mode 100644 new mode 100755 diff --git a/html/testBotScripts/index.html b/html/testBotScripts/index.html old mode 100644 new mode 100755 diff --git a/html/testBotScripts/tictactoe.html b/html/testBotScripts/tictactoe.html old mode 100644 new mode 100755 diff --git a/install.sql b/install.sql old mode 100644 new mode 100755 diff --git a/lang/en.php b/lang/en.php old mode 100644 new mode 100755 diff --git a/lang/fr.php b/lang/fr.php old mode 100644 new mode 100755 diff --git a/src/about.html b/src/about.html old mode 100644 new mode 100755 diff --git a/src/aboutBot.php b/src/aboutBot.php old mode 100644 new mode 100755 diff --git a/src/act.php b/src/act.php old mode 100644 new mode 100755 diff --git a/src/addBot.php b/src/addBot.php old mode 100644 new mode 100755 diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php old mode 100644 new mode 100755 diff --git a/src/arenas/Battleship/doc-en.html b/src/arenas/Battleship/doc-en.html old mode 100644 new mode 100755 diff --git a/src/arenas/Battleship/doc-fr.html b/src/arenas/Battleship/doc-fr.html old mode 100644 new mode 100755 diff --git a/src/arenas/Battleship/functions.php b/src/arenas/Battleship/functions.php old mode 100644 new mode 100755 diff --git a/src/arenas/Battleship/js.js b/src/arenas/Battleship/js.js old mode 100644 new mode 100755 diff --git a/src/arenas/Battleship/public.php b/src/arenas/Battleship/public.php old mode 100644 new mode 100755 diff --git a/src/arenas/Battleship/style.css b/src/arenas/Battleship/style.css old mode 100644 new mode 100755 diff --git a/src/arenas/Battleship/testBot.html b/src/arenas/Battleship/testBot.html old mode 100644 new mode 100755 diff --git a/src/arenas/connectFour/act.php b/src/arenas/connectFour/act.php old mode 100644 new mode 100755 diff --git a/src/arenas/connectFour/doc-en.html b/src/arenas/connectFour/doc-en.html old mode 100644 new mode 100755 diff --git a/src/arenas/connectFour/doc-fr.html b/src/arenas/connectFour/doc-fr.html old mode 100644 new mode 100755 diff --git a/src/arenas/connectFour/functions.php b/src/arenas/connectFour/functions.php old mode 100644 new mode 100755 diff --git a/src/arenas/connectFour/js.js b/src/arenas/connectFour/js.js old mode 100644 new mode 100755 diff --git a/src/arenas/connectFour/public.php b/src/arenas/connectFour/public.php old mode 100644 new mode 100755 diff --git a/src/arenas/connectFour/style.css b/src/arenas/connectFour/style.css old mode 100644 new mode 100755 diff --git a/src/arenas/tictactoe/act.php b/src/arenas/tictactoe/act.php old mode 100644 new mode 100755 diff --git a/src/arenas/tictactoe/doc-en.html b/src/arenas/tictactoe/doc-en.html old mode 100644 new mode 100755 diff --git a/src/arenas/tictactoe/doc-fr.html b/src/arenas/tictactoe/doc-fr.html old mode 100644 new mode 100755 diff --git a/src/arenas/tictactoe/doc.html b/src/arenas/tictactoe/doc.html old mode 100644 new mode 100755 diff --git a/src/arenas/tictactoe/functions.php b/src/arenas/tictactoe/functions.php old mode 100644 new mode 100755 diff --git a/src/arenas/tictactoe/js.js b/src/arenas/tictactoe/js.js old mode 100644 new mode 100755 diff --git a/src/arenas/tictactoe/public.php b/src/arenas/tictactoe/public.php old mode 100644 new mode 100755 diff --git a/src/arenas/tictactoe/style.css b/src/arenas/tictactoe/style.css old mode 100644 new mode 100755 diff --git a/src/arenas/tictactoe/testBot.html b/src/arenas/tictactoe/testBot.html old mode 100644 new mode 100755 diff --git a/src/arenas/tron/Coords.php b/src/arenas/tron/Coords.php old mode 100644 new mode 100755 diff --git a/src/arenas/tron/Direction.php b/src/arenas/tron/Direction.php old mode 100644 new mode 100755 diff --git a/src/arenas/tron/Trail.php b/src/arenas/tron/Trail.php old mode 100644 new mode 100755 index 8150eb2..195a692 --- a/src/arenas/tron/Trail.php +++ b/src/arenas/tron/Trail.php @@ -36,6 +36,7 @@ class Trail { public function __toString(){ return json_encode($this->getTrailAsArray()); } + public function getTrailAsArray(){ $arr = array(); foreach($this->trail as $coord) { diff --git a/src/arenas/tron/TronGame.php b/src/arenas/tron/TronGame.php old mode 100644 new mode 100755 index 86c210d..f790989 --- a/src/arenas/tron/TronGame.php +++ b/src/arenas/tron/TronGame.php @@ -77,6 +77,14 @@ class TronGame } return $trailsArr; } + public function get_lasts_trails(){ + //return only the lasts coords for each tail + $trailsArr = array(); + foreach($this->bots as $bot){ + $trailsArr[] = $bot->trail->last(); + } + return $trailsArr; + } public function new_lap(){ // for all alive bots $logs = ""; @@ -133,7 +141,7 @@ class TronGame } } - return $this->get_trails(); + return $this->get_lasts_trails(); } diff --git a/src/arenas/tron/TronPlayer.php b/src/arenas/tron/TronPlayer.php old mode 100644 new mode 100755 diff --git a/src/arenas/tron/act.php b/src/arenas/tron/act.php old mode 100644 new mode 100755 index 5cc1d81..c8dcde0 --- a/src/arenas/tron/act.php +++ b/src/arenas/tron/act.php @@ -44,7 +44,7 @@ switch ($_POST['act']){ 'status' => $game->get_continue(), 'logs' => $logs, 'gameId' => $game->gameId, - 'botsPosition' => $game->get_trails() + 'botsPosition' => $game->get_lasts_trails() )); $_SESSION['game'] = serialize($game); diff --git a/src/arenas/tron/doc-en.html b/src/arenas/tron/doc-en.html old mode 100644 new mode 100755 diff --git a/src/arenas/tron/doc-fr.html b/src/arenas/tron/doc-fr.html old mode 100644 new mode 100755 diff --git a/src/arenas/tron/functions.php b/src/arenas/tron/functions.php old mode 100644 new mode 100755 diff --git a/src/arenas/tron/js.js b/src/arenas/tron/js.js old mode 100644 new mode 100755 index 1223cbf..969d8e3 --- a/src/arenas/tron/js.js +++ b/src/arenas/tron/js.js @@ -12,6 +12,7 @@ function addLog(message){ divLogs.scrollTop = divLogs.scrollHeight; } +/* function growTails(newPointsByPlayer){ var botsColor = ['cyan','darkmagenta','darkred','darkslategrey','deeppink','dodgerblue','goldenrod','grey','indigo','lightgreen','mediumslateblue','midnightblue']; @@ -28,6 +29,7 @@ function growTails(newPointsByPlayer){ } } } +*/ function createElemNS(type,attributes){ //same as createElem but with ns for svg file var elem=document.createElementNS("http://www.w3.org/2000/svg",type); @@ -85,7 +87,7 @@ function applyInitMessage(req,xd_check){ } addLog(ret['logs']); if(ret['status'] == true){ - growTails(ret['botsPosition']); + drawMap(ret['botsPosition']); play(ret['gameId'],xd_check); } @@ -103,12 +105,18 @@ function drawMap(map){ var botsColor = ['cyan','darkmagenta','darkred','darkslategrey','deeppink','dodgerblue','goldenrod','grey','indigo','lightgreen','mediumslateblue','midnightblue']; for (var botId in map){ + //draw the point + var rect=createElemNS('rect',{'x':map[botId]['x'],'y':map[botId]['y'],'width':'2','height':'2','style':'fill:' + botsColor[botId] + ';'}); + document.getElementById('map').appendChild(rect); + /* for(var coordsI in map[botId]){ coords = map[botId][coordsI]; //draw the point var rect=createElemNS('rect',{'x':coords[0],'y':coords[1],'width':'2','height':'2','style':'fill:' + botsColor[botId] + ';'}); + document.getElementById('map').appendChild(rect); } + */ } } @@ -126,9 +134,12 @@ function play(gameId,xd_check){ drawMap(reponse['lap']); if(reponse['continue'] == '1'){ play(gameId,xd_check); + }else{ + alert ('game ended'); } }else{ + alert('erreur' + req.status); } } diff --git a/src/arenas/tron/public.php b/src/arenas/tron/public.php old mode 100644 new mode 100755 diff --git a/src/arenas/tron/style.css b/src/arenas/tron/style.css old mode 100644 new mode 100755 diff --git a/src/arenas/tron/test/CoordsTest.php b/src/arenas/tron/test/CoordsTest.php old mode 100644 new mode 100755 diff --git a/src/arenas/tron/test/DirectionTest.php b/src/arenas/tron/test/DirectionTest.php old mode 100644 new mode 100755 diff --git a/src/arenas/tron/test/TrailTest.php b/src/arenas/tron/test/TrailTest.php old mode 100644 new mode 100755 diff --git a/src/arenas_lists.php b/src/arenas_lists.php old mode 100644 new mode 100755 diff --git a/src/config.php.empty b/src/config.php.empty old mode 100644 new mode 100755 diff --git a/src/editBot.php b/src/editBot.php old mode 100644 new mode 100755 diff --git a/src/functions.php b/src/functions.php old mode 100644 new mode 100755 diff --git a/src/home.php b/src/home.php old mode 100644 new mode 100755 diff --git a/src/legals.html b/src/legals.html old mode 100644 new mode 100755 diff --git a/src/scores.php b/src/scores.php old mode 100644 new mode 100755 diff --git a/src/validateEditBot.php b/src/validateEditBot.php old mode 100644 new mode 100755