parent
a7e6a152f7
commit
c06c60efa7
@ -1,12 +1,22 @@
|
||||
<?php
|
||||
include_once "EnigmeFactory.php";
|
||||
include_once "../Model/Partie.php";
|
||||
class PartieFactory{
|
||||
public static function create($results)
|
||||
public static function createPartie($idMax,$resultsEnigme) : Partie
|
||||
{
|
||||
$tabPartie=array();
|
||||
foreach($results as $row)
|
||||
$tempsResolutionPartie=0;
|
||||
$tabEnigme=array();
|
||||
$tabIndex=range(0,strlen($resultsEnigme)-1);
|
||||
$randomNumber=0;
|
||||
while($tempsResolutionPartie <= 30)
|
||||
{
|
||||
$tabPartie= new Partie($row['id']);
|
||||
$randomNumber=$tabIndex[array_rand($tabIndex)];
|
||||
$tabEnigme=EnigmeFactory::create($resultsEnigme[$randomNumber]);
|
||||
$TempsResolutionPartie+=$resultsEnigme[$randomNumber]['tempsDeResolution'];
|
||||
unset($tabIndex[$randomNumber]);
|
||||
}
|
||||
return $tabPartie;
|
||||
$partie=new Partie($idMax,$resultsEnigme);
|
||||
return $partie;
|
||||
}
|
||||
//public static function createListePartie()
|
||||
}
|
Loading…
Reference in new issue