From a4fa5ccb44bcf121a36b4882a87f14e50afad888 Mon Sep 17 00:00:00 2001 From: Vany Ingenzi <ingenzi@intel19.info.ucl.ac.be> Date: Wed, 15 Dec 2021 17:05:08 +0100 Subject: [PATCH] Finished Mine and Missile Distncesc --- Input.oz | 4 ++-- Player020Random.oz | 24 ++++++++---------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Input.oz b/Input.oz index 1844ce4..cd04000 100644 --- a/Input.oz +++ b/Input.oz @@ -87,7 +87,7 @@ define fun{GenerateRow Length Acc} if Length==0 then Acc - elseif ({OS.rand} mod 4) \= 0 then + elseif ({OS.rand} mod 3) \= 0 then {GenerateRow Length-1 0|Acc} else {GenerateRow Length-1 1|Acc} @@ -127,7 +127,7 @@ in %%%% Life %%%% - MaxDamage = 4 + MaxDamage = 8 %%%% Number of load for each item %%%% diff --git a/Player020Random.oz b/Player020Random.oz index b850ea4..d0d9678 100644 --- a/Player020Random.oz +++ b/Player020Random.oz @@ -64,7 +64,7 @@ define [] H|T andthen {P H} then Rest={List.append {List.reverse Acc} T} H - else + [] H|T then {Aux T H|Acc} end end @@ -204,27 +204,18 @@ define of nil then ID=State.id KindFire=null State - elseif {OS.rand} mod 2 == 0 then ToFire={GetRandomElement State.chargedItems} in + [] ToFire|T then ID=State.id KindFire=ToFire - {System.show 'here KindFire='#KindFire} case KindFire of mine(1:Position) then - {System.show 'mine'} Position={RandomValidMinePos State.pos} - {System.show 'mine KindFire='#KindFire} - {NewRec {NewRec State chargedItems {List.subtract State.chargedItems ToFire}} placedMines ToFire|State.placedMines} + {NewRec {NewRec State chargedItems T} placedMines ToFire|State.placedMines} [] missile(1:Position) then - {System.show 'missile'} Position={RandomValidMissilePos State.pos} - {System.show 'missike KindFire='#KindFire} - {NewRec State chargedItems {List.subtract State.chargedItems ToFire}} + {NewRec State chargedItems T} else - {System.show 'else KindFire='#KindFire} - {NewRec State chargedItems {List.subtract State.chargedItems ToFire}} + {NewRec State chargedItems T} end - else - ID=State.id KindFire=null - State end end @@ -276,7 +267,7 @@ define proc{DeadTreatStream Stream State} case Stream - of nil|T then skip + of nil|T then skip [] initPosition(ID Pos)|T then ID=null {DeadTreatStream T State} @@ -439,7 +430,8 @@ define {AliveTreatStream Stream '#'( id:id(id:ID color:Color name:player020hunter) life:Input.maxDamage pos:pt(x:0 y:0) - chargingItems:[ {GetNewChargeFireItem mine} {GetNewChargeFireItem missile} ] + chargingItems:[ {GetNewChargeFireItem mine} {GetNewChargeFireItem missile} + {GetNewChargeFireItem sonar} {GetNewChargeFireItem drone} ] chargedItems:nil placedMines:nil history:nil)} -- GitLab