botsArena/html/StupidIAconnectFour.php

19 lines
272 B
PHP
Raw Normal View History

2016-05-11 10:33:32 +02:00
<?php
2016-05-11 14:49:38 +02:00
/*
* stupid IA for battle ship
* choose by random a free column
*/
$grid=json_decode($_POST['grid']);
2016-05-11 14:50:31 +02:00
print_r($grid);
2016-05-11 14:49:38 +02:00
$colAvailable=array();
for($i=0;$i<7;$i++){
2016-05-11 14:51:58 +02:00
if($colAvailable[4][$i] == ""){
2016-05-11 14:49:38 +02:00
$colAvailable[]=$i;
}
}
shuffle($colAvailable);
echo $i;
die;