From ab279a9a3a61a87f15e9da2439f6aba2c450c0bc Mon Sep 17 00:00:00 2001
From: Vany Ingenzi <ingenzi@intel17.info.ucl.ac.be>
Date: Mon, 13 Dec 2021 22:10:19 +0100
Subject: [PATCH] Fixed some bugs in the code

---
 Main.oz                    | 15 +++++++--------
 Player020HiderAndSeeker.oz |  4 ++--
 Player020Hunter.oz         |  4 ++--
 Player020Random.oz         |  1 -
 4 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/Main.oz b/Main.oz
index 374cea9..782f742 100644
--- a/Main.oz
+++ b/Main.oz
@@ -17,7 +17,7 @@ define
         of nil#nil then nil
         [] (Player|OtherPlayers)#(Color|OtherColors) then 
             player( 
-                    port:{PlayerManager.playerGenerator Player Color id(id:AccID color:Color name:Player)}
+                    port:{PlayerManager.playerGenerator Player Color AccID}
                     nbSurface: 0 %% All the players start underwater
                   )|{InitPlayers OtherPlayers OtherColors AccID+1}
         end
@@ -37,7 +37,7 @@ define
 
     fun {WeHaveAWinner Players Acc}
         case Players of nil then Acc==1
-        []Player|Others then Resp in
+        [] Player|Others then Resp in
             {Send Player.port isDead(Resp)}
             if Resp==true then 
                 {WeHaveAWinner Others Acc}
@@ -346,14 +346,13 @@ define
         end
     end
 in
-    %%1. 
+    %% Build the GUI Window 
     {Send GUI_PORT buildWindow}
 
-    %%2. Create Port for Every Player
+    %% Create Port for Every Player
     PlayersList={InitPlayers Input.players Input.colors 1}
 
-    %%3. Ask Init Point and tell players to dive
-    
+    %% Ask Init Point and tell players to dive
     {VisitList  PlayersList
                 proc{$ Player} 
                     ID Pos 
@@ -363,7 +362,7 @@ in
                     {Send Player.port dive}
                 end}
 
-    %%4. Launch the game 
+    %% Launch the game 
     if Input.isTurnByTurn then 
         {TurnByTurn PlayersList 1}
         {System.show '----'}
@@ -371,6 +370,6 @@ in
         {List.forAll PlayersList proc{$ Player} thread {Simultaneous Player PlayersList} end end}
     end
 
-    %%5. Termination 
+    %% Termination 
     {List.forAll PlayersList proc{$ Player} {Send Player.port nil} end }
 end
diff --git a/Player020HiderAndSeeker.oz b/Player020HiderAndSeeker.oz
index b1f8a42..6aae259 100644
--- a/Player020HiderAndSeeker.oz
+++ b/Player020HiderAndSeeker.oz
@@ -495,13 +495,13 @@ define
     in
         {NewPort Stream Port}
         thread
-            {AliveTreatStream Stream '#'(   id:ID
+            {AliveTreatStream Stream '#'(   id:id(id:ID color:Color name:player020hunter)
                                             life:Input.maxDamage
                                             pos:pt(x:0 y:0)
                                             chargingItems:[ {GetNewChargeFireItem drone} {GetNewChargeFireItem missile} {GetNewChargeFireItem missile} ]
                                             chargedItems:nil
                                             targets:nil
-                                            enemies:{InitEnemies ID.id Input.nbPlayer nil}
+                                            enemies:{InitEnemies ID Input.nbPlayer nil}
                                             history:nil
                                             droneLogs:nil
                                             absHistory:nil)}
diff --git a/Player020Hunter.oz b/Player020Hunter.oz
index d216344..89a666b 100644
--- a/Player020Hunter.oz
+++ b/Player020Hunter.oz
@@ -420,14 +420,14 @@ define
     in
         {NewPort Stream Port}
         thread
-            {AliveTreatStream Stream '#'(   id:ID
+            {AliveTreatStream Stream '#'(   id:id(id:ID color:Color name:player020hunter)
                                             life:Input.maxDamage
                                             pos:pt(x:0 y:0)
                                             chargingItems:{InitChargingItemsMissile Input.nbPlayer nil}
                                             chargedItems:nil
                                             placedMines:nil
                                             targets:nil
-                                            enemies:{InitEnemies ID.id Input.nbPlayer nil}
+                                            enemies:{InitEnemies ID Input.nbPlayer nil}
                                             history:nil)}
         end
         Port
diff --git a/Player020Random.oz b/Player020Random.oz
index 2d8e049..99482a3 100644
--- a/Player020Random.oz
+++ b/Player020Random.oz
@@ -352,7 +352,6 @@ define
     in
         {NewPort Stream Port}
         thread
-            {AliveTreatStream Stream '#'(   id:ID
                                             life:Input.maxDamage
                                             pos:pt(x:0 y:0)
                                             chargingItems:[ {GetNewChargeFireItem mine} {GetNewChargeFireItem missile}
-- 
GitLab