diff --git a/Documentation/MCD&MLD.drawio.pdf b/Documentation/MCD&MLD.drawio.pdf deleted file mode 100644 index aaa7abff..00000000 Binary files a/Documentation/MCD&MLD.drawio.pdf and /dev/null differ diff --git a/Documentation/MCD&MLD.pdf b/Documentation/MCD&MLD.pdf new file mode 100644 index 00000000..47d9b23f Binary files /dev/null and b/Documentation/MCD&MLD.pdf differ diff --git a/EnigmePython/Multi/ASCII.py b/EnigmePython/Multi/ASCII.py deleted file mode 100644 index 053ed9b3..00000000 --- a/EnigmePython/Multi/ASCII.py +++ /dev/null @@ -1 +0,0 @@ -def ascii() \ No newline at end of file diff --git a/EnigmePython/Multi/genCryptarythme.py b/EnigmePython/Multi/genCryptarythme.py deleted file mode 100644 index e69de29b..00000000 diff --git a/EnigmePython/test.py b/EnigmePython/test.py deleted file mode 100644 index 936058a4..00000000 --- a/EnigmePython/test.py +++ /dev/null @@ -1,23 +0,0 @@ -def cesar(msg, key): - resultStr = "" - key=key%26 - for char in msg: - resultStr = resultStr + chr(ord(char) + key) - return resultStr - -def decrypteCesar(msg, key): - resultStr = "" - key=key%26 - for char in msg: - resultStr = resultStr + chr(ord(char) - key) - return resultStr - - -def culdechouette(val): - tab=[] - for i in range(1,7): - for j in range(i,7): - for k in range(j,7): - if(i+j+k==val): - tab.append([i,j,k]) - return tab \ No newline at end of file diff --git a/WEB/Client.php b/WEB/Client.php deleted file mode 100644 index 74292a8d..00000000 --- a/WEB/Client.php +++ /dev/null @@ -1,47 +0,0 @@ -findUsersInQueue(); - $numberOfPlayer = count($userGroup); - header('Location : ' . $rep . $vues['queue']); - } - } else { - echo "socket_read a échoué : " . socket_strerror(socket_last_error()) . "\n"; - break; - } - } -} \ No newline at end of file diff --git a/WEB/Client/Client.php b/WEB/Client/Client.php deleted file mode 100644 index e941fc42..00000000 --- a/WEB/Client/Client.php +++ /dev/null @@ -1,63 +0,0 @@ -findUsersInQueue(); - // // $numberOfPlayer=count($userGroup); - // header('Location : ' . $rep . $vues['main']); - // break; - // } - // } else { - // echo "socket_read a échoué : " . socket_strerror(socket_last_error()) . "\n"; - // break; - // } - // } - } - } -} \ No newline at end of file diff --git a/WEB/Client/MyTask.php b/WEB/Client/MyTask.php deleted file mode 100644 index 12646f6a..00000000 --- a/WEB/Client/MyTask.php +++ /dev/null @@ -1,73 +0,0 @@ -m_inputs = $inputs; - $this->m_outputs = new Threaded(); // we will store the results in here. - } - - - public function run() - { - foreach ($this->m_inputs as $input) - { - // casting the array to an array is not a mistake - // but actually super important for this to work - // https://github.com/krakjoe/pthreads/issues/813#issuecomment-361955116 - $this->m_outputs[] = (array)array( - 'property1' => $input * 2, - 'property2' => ($input + 2), - ); - } - } - - - # Accessors - public function getResults() { return $this->m_outputs; } -} - - - -function main() -{ - $inputs = range(0,10000); - $numInputsPerTask = 20; - $inputGroups = array_chunk($inputs, $numInputsPerTask); - $numCpus = 4; // I would nomrally dynamically fetch this and sometimes large (e.g. aws C5 instances) - $numTasks = count($inputGroups); - $numThreads = min($numTasks, $numCpus); // don't need to spawn more threads than tasks. - $pool = new Pool($numThreads); - $tasks = array(); // collection to hold all the tasks to get the results from afterwards. - - foreach ($inputGroups as $inputsForTask) - { - $task = new MyTask($inputsForTask); - $tasks[] = $task; - $pool->submit($task); - } - - - while ($pool->collect()); - - # We could submit more stuff here, the Pool is still waiting for work to be submitted. - - $pool->shutdown(); - - # All tasks should have been completed at this point. Get the results! - $results = array(); - foreach ($tasks as $task) - { - $results[] = $task->getResults(); - } - - print "results: " . print_r($results, true); -} - -main(); - diff --git a/WEB/Client/Queing.php b/WEB/Client/Queing.php deleted file mode 100644 index bf325eaa..00000000 --- a/WEB/Client/Queing.php +++ /dev/null @@ -1,69 +0,0 @@ -m_inputs = $inputs; - $this->m_outputs = new Threaded(); // we will store the results in here. - } - - - public function run() - { - global $port, $serverAdress, $rep, $vues, $BUFFER_SIZE; - $userModel = new UserModel(); - // pas d'arrêt d'éxécution du script (No timeout) - set_time_limit(0); - $socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("la socket n'a pas pu être créée ERROR : " . socket_strerror(socket_last_error()) . "\n"); - // connecter la socket à l'adresse ip et au port du serveur - $result = socket_set_block($socket); - if ($result === false) { - echo "socket_set_block a échoué : " . socket_strerror(socket_last_error()) . "\n"; - } else { - echo "socket_set_block a réussi.\n"; - } - $result = socket_connect($socket, $serverAdress, $port) or die("Impossible de se connecter au serveur ERROR : " . socket_strerror(socket_last_error()) . "\n"); - if ($result === false) { - // La connexion de la socket à l'adresse et au port a échoué - echo "socket_connect a échoué : " . socket_strerror(socket_last_error()) . "\n"; - } else { - echo "socket_connect a réussi.\n"; - $request = "Queuing"; - $result = socket_write($socket, $request, strlen($request)); - if ($result === false) { - echo "socket_write a échoué : " . socket_strerror(socket_last_error()) . "\n"; - } else { - echo "socket_write a réussi.\n"; - } - $response = ""; - // while (strcmp($response, "launchGame") != 0) { - $i = 0; - while ($i != 2) { - $response = socket_read($socket, $BUFFER_SIZE); - echo $response; - if ($response != false) { - echo "socket_read a réussi.\n"; - if (strcmp($response, "refreshQueue") == 0) { - $userGroup = $userModel->findUsersInQueue(); - $numberOfPlayer = count($userGroup); - header('Location : ' . $rep . $vues['queue']); - } - } else { - echo "socket_read a échoué : " . socket_strerror(socket_last_error()) . "\n"; - break; - } - sleep(5); - $i++; - } - } - } - - - # Accessors - public function getResults() { return $this->m_outputs; } -} \ No newline at end of file diff --git a/WEB/Config/Config.php b/WEB/Config/Config.php index 8652e8b6..0f00df27 100644 --- a/WEB/Config/Config.php +++ b/WEB/Config/Config.php @@ -47,12 +47,7 @@ $vues['erreur'] = 'View/src/pages/Erreur.php'; $error = ""; // Server -$BUFFER_SIZE = 1024; $serverAdress = "82.165.180.114"; -$port= "3000"; $playerNumberPerGame = 2; -// Modules -$modules = 'node_module/'; - diff --git a/WEB/Config/Connection.php b/WEB/Config/Connection.php index 67c1de0f..a8561e0b 100644 --- a/WEB/Config/Connection.php +++ b/WEB/Config/Connection.php @@ -1,22 +1,4 @@ setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } - -// public function executeQuery(string $query, array $parameters = []) :bool { -// $this->stmt = parent::prepare($query); -// foreach ($parameters as $name => $value) { -// $this->stmt->bindValue($name, $value[0], $value[1]); } -// return $this->stmt->execute(); } -// public function getResults(): array { -// return $this->stmt->fetchall(); -// } -// } - class Connection extends SQLite3 { private $stmt; diff --git a/WEB/Controller/ResoudreGateway.php b/WEB/Controller/ResoudreGateway.php index d80d4723..90665745 100644 --- a/WEB/Controller/ResoudreGateway.php +++ b/WEB/Controller/ResoudreGateway.php @@ -242,11 +242,13 @@ class ResoudreGateway public function getLastEnigmeEnded(string $mailUtilisateur) : int{ $query="SELECT * FROM Resoudre WHERE utilisateur=:utilisateur + AND enMulti=:enMulti AND ended=:ended ORDER BY ended DESC LIMIT 1"; $this->con->executeQuery($query, array( "utilisateur" => array($mailUtilisateur, SQLITE3_TEXT), - "ended" => array(1, SQLITE3_INTEGER))); + "ended" => array(1, SQLITE3_INTEGER), + "enMulti" => array(0, SQLITE3_INTEGER))); $results=$this->con->getResults(); if(empty($results)) { diff --git a/WEB/Model/UserModel.php b/WEB/Model/UserModel.php index 81e53437..27ccaa05 100644 --- a/WEB/Model/UserModel.php +++ b/WEB/Model/UserModel.php @@ -104,7 +104,9 @@ class UserModel public function checkEnigmeIsEnded(string $mailUtilisateur, int $enigmeId) : bool { return $this->resoudre_gateway->checkEnigmeIsEnded($mailUtilisateur,$enigmeId); } - + public function enigmeEnded(string $mailUtilisateur, int $enigmeId){ + $this->resoudre_gateway->enigmeEnded($mailUtilisateur,$enigmeId); + } public function enigmeMultiEnded(string $mailUtilisateur, int $enigmeId){ $idPartie = $_SESSION['idPartie']; $dateDebut = $this->partie_gateway->getDateDebut($idPartie); diff --git a/WEB/server.php b/WEB/server.php deleted file mode 100644 index 9b7749b8..00000000 --- a/WEB/server.php +++ /dev/null @@ -1,123 +0,0 @@ -$function($client, $request); - echo 'response : '.$response." (Serveur)\n"; - // socket_write($client,$response,strlen($response)); - } else { - $response = "Invalid request"; - socket_write($client,$response,strlen($response)); - } - } else { - $response = "Response is false"; - socket_write($client,$response,strlen($response)); - } - } - } -} \ No newline at end of file