botsArena/html/StupidIAconnectFour.php

22 lines
286 B
PHP

<?php
/*
* stupid IA for battle ship
* choose by random a free column
*/
print_r($_POST);
/*
$grid=json_decode($_POST['grid']);
$colAvailable=array();
for($i=0;$i<7;$i++){
if($grid[5][$i] == ""){
$colAvailable[]=$i;
}
}
shuffle($colAvailable);
echo $colAvailable[0];
die;
*/