package Ġtest ĊĊ Ċ import Ġg gi . No Action Ċ import Ġground War .* Ċ import Ġground War . fog Of War . Historic Visibility Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . Assertions .* Ċ import Ġorg . junit . jupiter . api . Before All Ċ import Ġorg . junit . jupiter . api . BeforeEach Ċ import Ġkotlin . test .* Ċ Ċ private Ġval Ġcity Creation Params Ġ= ĠEvent Game Params ( seed Ġ= Ġ 3 , Ġmin Connections Ġ= Ġ 2 , Ġauto Connect Ġ= Ġ 3 0 0 , Ġmax Distance Ġ= Ġ 1 0 0 0 , ĊĠĠĠĠĠĠĠ Ġfog Of War Ġ= Ġtrue , Ġfog Memory Ġ= Ġint ArrayOf ( 1 0 0 , Ġ 2 0 0 ), Ġmin Ass ault Factor Ġ= Ġdouble ArrayOf ( 0 . 0 , Ġ 0 . 0 ), ĊĠĠĠĠĠĠĠ Ġfog Strength Ass umption Ġ= Ġdouble ArrayOf ( 1 . 0 , Ġ 2 . 0 )) Ċ private Ġvar Ġfog gy World : ĠWorld Ġ= ĠWorld ( params Ġ= Ġcity Creation Params ) Ċ internal Ġval Ġno Visibility Ġ= ĠH istoric Visibility ( empty Map ()) Ċ Ċ class ĠF og Tests Ġ{ ĊĊĠĠĠ Ġ@ BeforeEach ĊĠĠĠ Ġfun Ġinit () Ġ{ ĊĠĠĠĠĠĠĠ Ġfog gy World Ġ= ĠWorld ( params Ġ= Ġcity Creation Params ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/* ĊĠĠĠ Ġpop = Force ( size = 0 . 0 , Ġfat ig ue = 0 . 0 , Ġtime Stamp = 0 ), Ġowner = Neutral , Ġname = 0 , Ġfort = false ) ĊĠĠĠ Ġpop = Force ( size = 0 . 0 , Ġfat ig ue = 0 . 0 , Ġtime Stamp = 0 ), Ġowner = Neutral , Ġname = 1 , Ġfort = false ) ĊĠĠĠ Ġpop = Force ( size = 0 . 0 , Ġfat ig ue = 0 . 0 , Ġtime Stamp = 0 ), Ġowner = Neutral , Ġname = 2 , Ġfort = false ) ĊĠĠĠ Ġpop = Force ( size = 1 0 0 . 0 , Ġfat ig ue = 0 . 0 , Ġtime Stamp = 0 ), Ġowner = Red , Ġname = 3 , Ġfort = true ) ĊĠĠĠ Ġpop = Force ( size = 1 0 0 . 0 , Ġfat ig ue = 0 . 0 , Ġtime Stamp = 0 ), Ġowner = Blue , Ġname = 4 , Ġfort = false ) ĊĠĠĠ Ġpop = Force ( size = 0 . 0 , Ġfat ig ue = 0 . 0 , Ġtime Stamp = 0 ), Ġowner = Neutral , Ġname = 5 , Ġfort = false ) ĊĠĠĠ Ġpop = Force ( size = 0 . 0 , Ġfat ig ue = 0 . 0 , Ġtime Stamp = 0 ), Ġowner = Neutral , Ġname = 6 , Ġfort = false ) ĊĠĠĠ Ġpop = Force ( size = 0 . 0 , Ġfat ig ue = 0 . 0 , Ġtime Stamp = 0 ), Ġowner = Neutral , Ġname = 7 , Ġfort = false ) ĊĠĠĠ Ġpop = Force ( size = 0 . 0 , Ġfat ig ue = 0 . 0 , Ġtime Stamp = 0 ), Ġowner = Neutral , Ġname = 8 , Ġfort = false ) ĊĊĠĠĠ ĠRoute ( from City = 0 , Ġto City = 2 , Ġlength = 2 7 5 . 8 4 5 5 5 7 8 0 8 1 5 0 8 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 0 , Ġto City = 3 , Ġlength = 2 4 9 . 3 1 3 8 4 4 8 5 8 4 2 7 2 2 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 1 , Ġto City = 2 , Ġlength = 1 9 8 . 4 7 4 2 8 6 8 4 2 2 8 3 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 1 , Ġto City = 5 , Ġlength = 2 8 7 . 7 7 4 7 1 5 1 1 0 7 4 6 9 7 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 1 , Ġto City = 4 , Ġlength = 4 6 6 . 1 8 4 3 5 7 7 7 0 0 1 1 4 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 1 , Ġto City = 3 , Ġlength = 3 2 2 . 6 3 1 6 4 8 5 9 3 7 6 3 4 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 2 , Ġto City = 0 , Ġlength = 2 7 5 . 8 4 5 5 5 7 8 0 8 1 5 0 8 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 2 , Ġto City = 1 , Ġlength = 1 9 8 . 4 7 4 2 8 6 8 4 2 2 8 3 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 2 , Ġto City = 5 , Ġlength = 9 8 . 3 9 4 7 0 4 5 1 8 1 0 0 9 8 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 2 , Ġto City = 6 , Ġlength = 2 7 8 . 0 5 6 8 4 3 6 2 5 1 8 8 4 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 3 , Ġto City = 0 , Ġlength = 2 4 9 . 3 1 3 8 4 4 8 5 8 4 2 7 2 2 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 3 , Ġto City = 1 , Ġlength = 3 2 2 . 6 3 1 6 4 8 5 9 3 7 6 3 4 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 4 , Ġto City = 7 , Ġlength = 9 3 . 3 0 0 1 0 1 4 1 6 6 8 3 2 8 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 4 , Ġto City = 8 , Ġlength = 1 4 6 . 0 3 6 1 2 9 4 5 5 9 7 8 7 7 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 4 , Ġto City = 1 , Ġlength = 4 6 6 . 1 8 4 3 5 7 7 7 0 0 1 1 4 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 5 , Ġto City = 1 , Ġlength = 2 8 7 . 7 7 4 7 1 5 1 1 0 7 4 6 9 7 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 5 , Ġto City = 2 , Ġlength = 9 8 . 3 9 4 7 0 4 5 1 8 1 0 0 9 8 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 5 , Ġto City = 6 , Ġlength = 1 9 6 . 7 0 5 6 1 6 3 0 7 5 2 6 5 8 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 6 , Ġto City = 2 , Ġlength = 2 7 8 . 0 5 6 8 4 3 6 2 5 1 8 8 4 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 6 , Ġto City = 5 , Ġlength = 1 9 6 . 7 0 5 6 1 6 3 0 7 5 2 6 5 8 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 7 , Ġto City = 4 , Ġlength = 9 3 . 3 0 0 1 0 1 4 1 6 6 8 3 2 8 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 7 , Ġto City = 8 , Ġlength = 1 3 8 . 4 2 9 4 3 3 9 0 1 3 8 0 5 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 8 , Ġto City = 4 , Ġlength = 1 4 6 . 0 3 6 1 2 9 4 5 5 9 7 8 7 7 , Ġterrain Difficulty = 1 . 0 ) ĊĠĠĠ ĠRoute ( from City = 8 , Ġto City = 7 , Ġlength = 1 3 8 . 4 2 9 4 3 3 9 0 1 3 8 0 5 , Ġterrain Difficulty = 1 . 0 ) Ċ */ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġall C ities Are Visible () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġblue City : ĠInt Ġ= Ġfog gy World . cities . with Index (). filter Ġ{ Ġ(_, Ġc ) Ġ-> Ġc . owner Ġ== ĠPlayer Id . Blue Ġ}. map Ġ{ Ġ( i , Ġ_) Ġ-> Ġi Ġ}. first () ĊĠĠĠĠĠĠĠ Ġval Ġne ighbours Ġ= Ġfog gy World . all Routes From City . get OrDefault ( blue City , Ġempty List ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. map ( Route :: to City ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. toSet () ĊĠĠĠĠĠĠĠ Ġval Ġnon Ne ighbours Ġ= Ġfog gy World . cities . indices . toSet () Ġ- Ġne ighbours Ġ- Ġblue City ĊĠĠĠĠĠĠĠ ĠassertFalse ( non Ne ighbours . isEmpty ()) ĊĠĠĠĠĠĠĠ Ġassert ( fog gy World . check Visible ( blue City , ĠPlayer Id . Blue )) ĊĠĠĠĠĠĠĠ Ġassert ( non Ne ighbours . none Ġ{ Ġi Ġ-> Ġfog gy World . check Visible ( i , ĠPlayer Id . Blue ) Ġ}) ĊĠĠĠĠĠĠĠ Ġassert ( ne ighbours . all Ġ{ Ġi Ġ-> Ġfog gy World . check Visible ( i , ĠPlayer Id . Blue ) Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtransit Visibility From Destination City () Ġ{ ĊĠĠĠĠĠĠĠ Ġwith ( fog gy World ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġblue City Ġ= Ġcities . with Index (). filter Ġ{ Ġ(_, Ġc ) Ġ-> Ġc . owner Ġ== ĠPlayer Id . Blue Ġ}. map Ġ{ Ġ( i , Ġ_) Ġ-> Ġi Ġ}. first () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġred City Ġ= Ġcities . with Index (). filter Ġ{ Ġ(_, Ġc ) Ġ-> Ġc . owner Ġ== ĠPlayer Id . Red Ġ}. map Ġ{ Ġ( i , Ġ_) Ġ-> Ġi Ġ}. first () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġblue To Neutral Ġ= Ġroutes . filter Ġ{ Ġr Ġ-> Ġr . from City Ġ== Ġblue City Ġ&& Ġcities [ r . to City ]. owner Ġ== ĠPlayer Id . Neutral Ġ}. first () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġred To Neutral Ġ= Ġroutes . filter Ġ{ Ġr Ġ-> Ġr . from City Ġ== Ġred City Ġ&& Ġcities [ r . to City ]. owner Ġ== ĠPlayer Id . Neutral Ġ}. first () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġblue _ nb Ġ= ĠTrans it ( Force ( 1 . 0 ), Ġblue To Neutral . to City , Ġblue City , ĠPlayer Id . Blue , Ġ 0 , Ġ 1 0 0 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġred _ nr Ġ= ĠTrans it ( Force ( 1 . 0 ), Ġred To Neutral . to City , Ġred City , ĠPlayer Id . Red , Ġ 0 , Ġ 1 0 0 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Transit ( blue _ nb ); Ġadd Transit ( red _ nr ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( check Visible ( blue _ nb , ĠPlayer Id . Blue , Ġno Visibility )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert (! check Visible ( red _ nr , ĠPlayer Id . Blue , Ġno Visibility )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert (! check Visible ( blue _ nb , ĠPlayer Id . Red , Ġno Visibility )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( check Visible ( red _ nr , ĠPlayer Id . Red , Ġno Visibility )) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġfog Copy Red Ġ= Ġfog gy World . deep CopyWith Fog ( Player Id . Red ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġfog Copy Blue Ġ= Ġfog gy World . deep CopyWith Fog ( Player Id . Blue ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( fog Copy Blue . current Trans its . size , Ġ 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( fog Copy Blue . current Trans its . contains ( blue _ nb )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( fog Copy Red . current Trans its . size , Ġ 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( fog Copy Red . current Trans its . contains ( red _ nr )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtransit Visibility From Source City () Ġ{ ĊĠĠĠĠĠĠĠ Ġwith ( fog gy World ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġblue City Ġ= Ġcities . with Index (). filter Ġ{ Ġ(_, Ġc ) Ġ-> Ġc . owner Ġ== ĠPlayer Id . Blue Ġ}. map Ġ{ Ġ( i , Ġ_) Ġ-> Ġi Ġ}. first () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġred City Ġ= Ġcities . with Index (). filter Ġ{ Ġ(_, Ġc ) Ġ-> Ġc . owner Ġ== ĠPlayer Id . Red Ġ}. map Ġ{ Ġ( i , Ġ_) Ġ-> Ġi Ġ}. first () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġblue To Neutral Ġ= Ġroutes . filter Ġ{ Ġr Ġ-> Ġr . from City Ġ== Ġblue City Ġ&& Ġcities [ r . to City ]. owner Ġ== ĠPlayer Id . Neutral Ġ}. first () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġred To Neutral Ġ= Ġroutes . filter Ġ{ Ġr Ġ-> Ġr . from City Ġ== Ġred City Ġ&& Ġcities [ r . to City ]. owner Ġ== ĠPlayer Id . Neutral Ġ}. first () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġblue _ bn Ġ= ĠTrans it ( Force ( 1 . 0 ), Ġblue City , Ġblue To Neutral . to City , ĠPlayer Id . Blue , Ġ 0 , Ġ 1 0 0 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġred _ rn Ġ= ĠTrans it ( Force ( 1 . 0 ), Ġred City , Ġred To Neutral . to City , ĠPlayer Id . Red , Ġ 0 , Ġ 1 0 0 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Transit ( blue _ bn ); Ġadd Transit ( red _ rn ); ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( check Visible ( blue _ bn , ĠPlayer Id . Blue , Ġno Visibility )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert (! check Visible ( red _ rn , ĠPlayer Id . Blue , Ġno Visibility )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert (! check Visible ( blue _ bn , ĠPlayer Id . Red , Ġno Visibility )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( check Visible ( red _ rn , ĠPlayer Id . Red , Ġno Visibility )) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġfog Copy Red Ġ= Ġfog gy World . deep CopyWith Fog ( Player Id . Red ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġfog Copy Blue Ġ= Ġfog gy World . deep CopyWith Fog ( Player Id . Blue ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( fog Copy Blue . current Trans its . size , Ġ 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( fog Copy Blue . current Trans its . contains ( blue _ bn )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( fog Copy Red . current Trans its . size , Ġ 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( fog Copy Red . current Trans its . contains ( red _ rn )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtransit Visibility To Other Player At Destination () Ġ{ ĊĠĠĠĠĠĠĠ Ġwith ( fog gy World ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġblue City Ġ= Ġcities . with Index (). filter Ġ{ Ġ(_, Ġc ) Ġ-> Ġc . owner Ġ== ĠPlayer Id . Blue Ġ}. map Ġ{ Ġ( i , Ġ_) Ġ-> Ġi Ġ}. first () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġblue To Red Ġ= Ġroutes . filter Ġ{ Ġr Ġ-> Ġr . from City Ġ== Ġblue City Ġ&& Ġcities [ r . to City ]. owner Ġ== ĠPlayer Id . Neutral Ġ}. first () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcities [ blue To Red . to City ]. owner Ġ= ĠPlayer Id . Red ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġblue _ br Ġ= ĠTrans it ( Force ( 1 . 0 ), Ġblue City , Ġblue To Red . to City , ĠPlayer Id . Blue , Ġ 0 , Ġ 1 0 0 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Transit ( blue _ br ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( check Visible ( blue _ br , ĠPlayer Id . Blue , Ġno Visibility )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( check Visible ( blue _ br , ĠPlayer Id . Red , Ġno Visibility )) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġfog Copy Red Ġ= Ġfog gy World . deep CopyWith Fog ( Player Id . Red ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġfog Copy Blue Ġ= Ġfog gy World . deep CopyWith Fog ( Player Id . Blue ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( fog Copy Blue . current Trans its . size , Ġ 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( fog Copy Red . current Trans its . size , Ġ 1 ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtransit Visibility On Same Route () Ġ{ ĊĠĠĠĠĠĠĠ Ġwith ( fog gy World ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġblue City Ġ= Ġcities . with Index (). filter Ġ{ Ġ(_, Ġc ) Ġ-> Ġc . owner Ġ== ĠPlayer Id . Blue Ġ}. map Ġ{ Ġ( i , Ġ_) Ġ-> Ġi Ġ}. first () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġblue To Neutral Ġ= Ġroutes . filter Ġ{ Ġr Ġ-> Ġr . from City Ġ== Ġblue City Ġ&& Ġcities [ r . to City ]. owner Ġ== ĠPlayer Id . Neutral Ġ}. first () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġblue _ bn Ġ= ĠTrans it ( Force ( 1 . 0 ), Ġblue City , Ġblue To Neutral . to City , ĠPlayer Id . Blue , Ġ 0 , Ġ 1 0 0 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġred _ bn Ġ= ĠTrans it ( Force ( 1 . 0 ), Ġblue City , Ġblue To Neutral . to City , ĠPlayer Id . Red , Ġ 0 , Ġ 1 0 0 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġblue _ nb Ġ= ĠTrans it ( Force ( 1 . 0 ), Ġblue To Neutral . to City , Ġblue City , ĠPlayer Id . Blue , Ġ 0 , Ġ 1 0 0 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġred _ nb Ġ= ĠTrans it ( Force ( 1 . 0 ), Ġblue To Neutral . to City , Ġblue City , ĠPlayer Id . Red , Ġ 0 , Ġ 1 0 0 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd Transit ( blue _ bn ); Ġadd Transit ( blue _ nb ); Ġadd Transit ( red _ bn ); Ġadd Transit ( red _ nb ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// Ġthese Ġare Ġall Ġvisible Ġbecause ĠTrans its Ġcan Ġsee Ġeach Ġother Ġon Ġthe Ġsame Ġroute ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( check Visible ( blue _ bn , ĠPlayer Id . Blue , Ġno Visibility )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( check Visible ( blue _ nb , ĠPlayer Id . Blue , Ġno Visibility )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( check Visible ( red _ bn , ĠPlayer Id . Blue , Ġno Visibility )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( check Visible ( red _ nb , ĠPlayer Id . Blue , Ġno Visibility )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( check Visible ( blue _ bn , ĠPlayer Id . Red , Ġno Visibility )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( check Visible ( blue _ nb , ĠPlayer Id . Red , Ġno Visibility )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( check Visible ( red _ bn , ĠPlayer Id . Red , Ġno Visibility )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert ( check Visible ( red _ nb , ĠPlayer Id . Red , Ġno Visibility )) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġfog Copy Red Ġ= Ġfog gy World . deep CopyWith Fog ( Player Id . Red ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġfog Copy Blue Ġ= Ġfog gy World . deep CopyWith Fog ( Player Id . Blue ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( fog Copy Blue . current Trans its . size , Ġ 4 ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( fog Copy Red . current Trans its . size , Ġ 4 ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Fog With No For ces () Ġ{ ĊĠĠĠĠĠĠĠ Ġfog gy World . cities . forEach Ġ{ Ġc Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġc . owner Ġ= ĠPlayer Id . Blue ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġfog Copy Red Ġ= Ġfog gy World . deep CopyWith Fog ( Player Id . Red ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( fog Copy Red . cities . all Ġ{ Ġit . owner Ġ== ĠPlayer Id . Fog Ġ&& Ġit . pop . size Ġ== Ġcity Creation Params . fog Strength Ass umption [ 1 ] Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Fog On Game Copy () Ġ{ ĊĠĠĠĠĠĠĠ Ġfog gy World . cities . forEach Ġ{ Ġc Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġc . owner Ġ= ĠPlayer Id . Blue ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠLand Combat Game ( fog gy World ) ĊĠĠĠĠĠĠĠ Ġval Ġgame Copy Ġ= Ġgame . copy ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( game Copy . world . cities . all Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġit . owner Ġ== ĠPlayer Id . Fog Ġ&& Ġit . pop . size Ġ== Ġcity Creation Params . fog Strength Ass umption [ 1 ] ĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠĠĠĠĠ Ġval Ġgame Copy 2 Ġ= Ġgame Copy . copy () ĊĠĠĠĠĠĠĠ ĠassertTrue ( game Copy 2 . world . cities . all Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġit . owner Ġ== ĠPlayer Id . Fog Ġ&& Ġit . pop . size Ġ== Ġcity Creation Params . fog Strength Ass umption [ 1 ] ĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Fog On City Copy () Ġ{ ĊĠĠĠĠĠĠĠ Ġfog gy World . cities [ 0 ]. owner Ġ= ĠPlayer Id . Red ĊĠĠĠĠĠĠĠ Ġval Ġfull Copy Ġ= Ġfog gy World . deep Copy () ĊĠĠĠĠĠĠĠ Ġval Ġfog Copy Red Ġ= Ġfog gy World . deep CopyWith Fog ( Player Id . Red ) ĊĠĠĠĠĠĠĠ Ġval Ġfog Copy Blue Ġ= Ġfog gy World . deep CopyWith Fog ( Player Id . Blue ) ĊĠĠĠĠĠĠĠ Ġval Ġcheck Ġ= ĠBoolean Array ( 4 ) Ġ{ Ġfalse Ġ} ĊĠĠĠĠĠĠĠ Ġfog gy World . cities . with Index () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. forEach Ġ{ Ġ( i , Ġc ) Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwhen Ġ( c . owner ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPlayer Id . Blue Ġ-> Ġassert ( fog Copy Blue . cities [ i ] Ġ== Ġfull Copy . cities [ i ]) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPlayer Id . Red Ġ-> Ġassert ( fog Copy Red . cities [ i ] Ġ== Ġfull Copy . cities [ i ]) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> ĠUnit ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwhen Ġ( Pair ( full Copy . check Visible ( i , ĠPlayer Id . Red ), Ġfull Copy . check Visible ( i , ĠPlayer Id . Blue ))) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair ( false , Ġfalse ) Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( fog Copy Blue . cities [ i ]. owner , ĠPlayer Id . Fog ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( fog Copy Red . cities [ i ]. owner , ĠPlayer Id . Fog ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcheck [ 0 ] Ġ= Ġtrue ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair ( true , Ġtrue ) Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( fog Copy Blue . cities [ i ]. owner , Ġc . owner ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( fog Copy Red . cities [ i ]. owner , Ġc . owner ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcheck [ 1 ] Ġ= Ġtrue ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair ( true , Ġfalse ) Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( fog Copy Blue . cities [ i ]. owner , ĠPlayer Id . Fog ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( fog Copy Red . cities [ i ]. owner , Ġc . owner ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcheck [ 2 ] Ġ= Ġtrue ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair ( false , Ġtrue ) Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( fog Copy Blue . cities [ i ]. owner , Ġc . owner ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( fog Copy Red . cities [ i ]. owner , ĠPlayer Id . Fog ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcheck [ 3 ] Ġ= Ġtrue ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġassert ( check . all Ġ{ Ġit Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġroll Forward DoesNot Include In visible In vas ion () Ġ{ ĊĠĠĠĠĠĠĠ Ġfog gy World . cities [ 8 ]. owner Ġ= ĠPlayer Id . Blue ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠLand Combat Game ( fog gy World ) ĊĠĠĠĠĠĠĠ Ġ// ĠWe Ġshould Ġnow Ġhave Ġcities Ġ 4 Ġand Ġ 8 Ġas ĠBlue , Ġand Ġ 3 Ġas ĠRed ĊĠĠĠĠĠĠĠ Ġ// ĠIf ĠRed Ġinv ades Ġ 1 Ġ( which Ġis Ġvisible Ġto Ġ 8 ), Ġthen ĠBlue 's Ġprojection Ġwill Ġnot Ġsee Ġthe Ġresult ĊĠĠĠĠĠĠĠ ĠLaunch Exp edition ( Player Id . Red , Ġ 3 , Ġ 1 , Ġ 1 . 0 , Ġ 1 0 ). apply ( game ) ĊĠĠĠĠĠĠĠ Ġval Ġblue Version Ġ= Ġgame . copy ( 0 ) ĊĠĠĠĠĠĠĠ Ġblue Version . next ( 5 0 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Version . world . cities [ 1 ]. owner , ĠPlayer Id . Neutral ) ĊĠĠĠĠĠĠĠ Ġval Ġred Version Ġ= Ġgame . copy ( 1 ) ĊĠĠĠĠĠĠĠ Ġred Version . next ( 5 0 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Version . world . cities [ 1 ]. owner , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ Ġval Ġmaster Version Ġ= Ġgame . copy (). next ( 5 0 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( master Version . world . cities [ 1 ]. owner , ĠPlayer Id . Red ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcopy With Perspective Clear s Out In visible Future Actions In Queue () Ġ{ ĊĠĠĠĠĠĠĠ Ġ// Ġwe Ġwant Ġone Ġevent Ġof Ġeach Ġtype ĊĠĠĠĠĠĠĠ Ġ// Ġ 4 Ġis ĠBlue , Ġ 3 Ġis ĠRed ĊĠĠĠĠĠĠĠ Ġ// Ġ 1 Ġis Ġvisible Ġto Ġboth Ġ 3 Ġand Ġ 4 ĊĠĠĠĠĠĠĠ Ġfog gy World . cities [ 8 ]. owner Ġ= ĠPlayer Id . Blue ĊĠĠĠĠĠĠĠ Ġfog gy World . cities [ 8 ]. pop Ġ= ĠForce ( 5 . 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠLand Combat Game ( fog gy World ) ĊĠĠĠĠĠĠĠ Ġ// ĠĠĠĠĠ Ġgame . event Queue . add ( Event ( 1 0 , ĠMake Decision ( 1 ))) Ġ Ġ// ĠR ĊĠĠĠĠĠĠĠ Ġ// ĠĠĠĠĠ Ġgame . event Queue . add ( Event ( 1 0 , ĠMake Decision ( 0 ))) Ġ// ĠB ĊĠĠĠĠĠĠĠ ĠassertFalse ( game . world . check Visible ( 6 , ĠPlayer Id . Blue )) ĊĠĠĠĠĠĠĠ Ġgame . event Queue . add ( Event ( 1 0 , ĠCity In flux ( Player Id . Red , ĠForce ( 1 0 . 0 ), Ġ 6 ))) Ġ// ĠR ĊĠĠĠĠĠĠĠ Ġgame . event Queue . add ( Event ( 1 0 , ĠCity In flux ( Player Id . Red , ĠForce ( 1 0 . 0 ), Ġ 1 , Ġ 3 ))) Ġ// ĠRB ĊĠĠĠĠĠĠĠ Ġgame . event Queue . add ( Event ( 1 0 , ĠCity In flux ( Player Id . Blue , ĠForce ( 1 0 . 0 ), Ġ 1 , Ġ 4 ))) Ġ// ĠRB ĊĠĠĠĠĠĠĠ Ġgame . event Queue . add ( Event ( 1 0 , ĠCity In flux ( Player Id . Blue , ĠForce ( 1 0 . 0 ), Ġ 2 , Ġ 4 ))) Ġ// ĠB ĊĠĠĠĠĠĠĠ Ġgame . event Queue . add ( Event ( 1 0 , ĠTrans it Start ( Transit ( Force ( 1 0 . 0 ), Ġ 4 , Ġ 2 , ĠPlayer Id . Blue , Ġ 1 1 , Ġ 2 0 )))) Ġ// ĠB ĊĠĠĠĠĠĠĠ Ġgame . world . add Transit ( Transit ( Force ( 4 . 0 ), Ġ 4 , Ġ 2 , ĠPlayer Id . Blue , Ġ 1 0 , Ġ 2 0 )) ĊĠĠĠĠĠĠĠ Ġgame . event Queue . add ( Event ( 2 0 , ĠTrans it End ( Player Id . Blue , Ġ 4 , Ġ 2 , Ġ 2 0 ))) Ġ// ĠB ĊĠĠĠĠĠĠĠ Ġgame . world . add Transit ( Transit ( Force ( 4 . 0 ), Ġ 4 , Ġ 1 , ĠPlayer Id . Blue , Ġ 1 0 , Ġ 2 0 )) ĊĠĠĠĠĠĠĠ Ġgame . event Queue . add ( Event ( 2 0 , ĠTrans it End ( Player Id . Blue , Ġ 4 , Ġ 1 , Ġ 2 0 ))) Ġ// ĠB ĊĠĠĠĠĠĠĠ Ġgame . world . add Transit ( Transit ( Force ( 2 . 0 ), Ġ 1 , Ġ 3 , ĠPlayer Id . Blue , Ġ 1 0 , Ġ 2 0 )) ĊĠĠĠĠĠĠĠ Ġgame . event Queue . add ( Event ( 2 0 , ĠTrans it End ( Player Id . Blue , Ġ 1 , Ġ 3 , Ġ 2 0 ))) Ġ// ĠRB ĊĠĠĠĠĠĠĠ Ġval Ġblue Force Ġ= ĠTrans it ( Force ( 5 . 0 ), Ġ 1 , Ġ 3 , ĠPlayer Id . Blue , Ġ 1 0 , Ġ 2 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġred Force Ġ= ĠTrans it ( Force ( 2 . 0 ), Ġ 3 , Ġ 1 , ĠPlayer Id . Red , Ġ 1 0 , Ġ 2 0 ) ĊĠĠĠĠĠĠĠ Ġgame . world . add Transit ( blue Force ); Ġgame . world . add Transit ( red Force ) ĊĠĠĠĠĠĠĠ Ġgame . event Queue . add ( Event ( 1 1 , ĠBattle ( blue Force , Ġred Force ))) Ġ// ĠRB ĊĠĠĠĠĠĠĠ Ġgame . event Queue . add ( Event ( 2 0 , ĠNo Action ( 1 , Ġ 5 ))) Ġ Ġ// ĠR ĊĠĠĠĠĠĠĠ Ġgame . event Queue . add ( Event ( 2 0 , ĠNo Action ( 0 , Ġ 5 ))) Ġ// ĠB ĊĠĠĠĠĠĠĠ Ġgame . event Queue . add ( Event ( 1 3 , ĠLaunch Exp edition ( Player Id . Red , Ġ 3 , Ġ 1 , Ġ 1 . 0 , Ġ 1 0 ))) Ġ// ĠR ĊĠĠĠĠĠĠĠ Ġgame . event Queue . add ( Event ( 1 3 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 8 , Ġ 1 , Ġ 1 . 0 , Ġ 1 0 ))) Ġ// ĠB ĊĊĠĠĠĠĠĠĠ Ġval Ġblue Version Ġ= Ġgame . copy ( 0 ). next ( 5 ) ĊĠĠĠĠĠĠĠ Ġval Ġred Version Ġ= Ġgame . copy ( 1 ). next ( 5 ) ĊĠĠĠĠĠĠĠ Ġval Ġmaster Version Ġ= Ġgame . copy (). next ( 5 ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( master Version . event Queue . size , Ġ 1 3 ) ĊĊĠĠĠĠĠĠĠ Ġ// ĠĠĠĠĠ Ġassert ( red Version . event Queue . contains ( Event ( 5 , ĠMake Decision ( 1 )))) ĊĠĠĠĠĠĠĠ Ġassert ( red Version . event Queue . contains ( Event ( 1 0 , ĠCity In flux ( Player Id . Red , ĠForce ( 1 0 . 0 ), Ġ 6 )))) ĊĠĠĠĠĠĠĠ Ġassert ( red Version . event Queue . contains ( Event ( 1 0 , ĠCity In flux ( Player Id . Red , ĠForce ( 1 0 . 0 ), Ġ 1 , Ġ 3 )))) ĊĠĠĠĠĠĠĠ Ġassert ( red Version . event Queue . contains ( Event ( 2 0 , ĠTrans it End ( Player Id . Blue , Ġ 1 , Ġ 3 , Ġ 2 0 )))) ĊĠĠĠĠĠĠĠ Ġassert ( red Version . event Queue . contains ( Event ( 1 1 , ĠBattle ( blue Force , Ġred Force )))) Ġ// ĠRB ĊĠĠĠĠĠĠĠ Ġassert ( red Version . event Queue . contains ( Event ( 2 0 , ĠNo Action ( 1 , Ġ 5 )))) Ġ Ġ// ĠR ĊĠĠĠĠĠĠĠ Ġassert ( red Version . event Queue . contains ( Event ( 1 3 , ĠLaunch Exp edition ( Player Id . Red , Ġ 3 , Ġ 1 , Ġ 1 . 0 , Ġ 1 0 )))) Ġ// ĠR ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Version . event Queue . size , Ġ 6 ) ĊĊĠĠĠĠĠĠĠ Ġ// ĠĠĠ Ġassert ( blue Version . event Queue . contains ( Event ( 5 , ĠMake Decision ( 0 )))) Ġ// ĠB ĊĠĠĠĠĠĠĠ Ġassert ( blue Version . event Queue . contains ( Event ( 1 0 , ĠCity In flux ( Player Id . Red , ĠForce ( 1 0 . 0 ), Ġ 1 , Ġ 3 )))) Ġ// ĠRB ĊĠĠĠĠĠĠĠ Ġassert ( blue Version . event Queue . contains ( Event ( 1 0 , ĠCity In flux ( Player Id . Blue , ĠForce ( 1 0 . 0 ), Ġ 1 , Ġ 4 )))) Ġ// ĠRB ĊĠĠĠĠĠĠĠ Ġassert ( blue Version . event Queue . contains ( Event ( 1 0 , ĠCity In flux ( Player Id . Blue , ĠForce ( 1 0 . 0 ), Ġ 2 , Ġ 4 )))) Ġ// ĠB ĊĠĠĠĠĠĠĠ Ġassert ( blue Version . event Queue . contains ( Event ( 1 0 , ĠTrans it Start ( Transit ( Force ( 1 0 . 0 ), Ġ 4 , Ġ 2 , ĠPlayer Id . Blue , Ġ 1 1 , Ġ 2 0 ))))) Ġ// ĠB ĊĠĠĠĠĠĠĠ Ġassert ( blue Version . event Queue . contains ( Event ( 2 0 , ĠTrans it End ( Player Id . Blue , Ġ 4 , Ġ 2 , Ġ 2 0 )))) Ġ// ĠB ĊĠĠĠĠĠĠĠ Ġassert ( blue Version . event Queue . contains ( Event ( 2 0 , ĠTrans it End ( Player Id . Blue , Ġ 4 , Ġ 1 , Ġ 2 0 )))) Ġ// ĠRB ĊĠĠĠĠĠĠĠ Ġassert ( blue Version . event Queue . contains ( Event ( 1 1 , ĠBattle ( blue Force , Ġred Force )))) Ġ// ĠRB ĊĠĠĠĠĠĠĠ Ġassert ( blue Version . event Queue . contains ( Event ( 2 0 , ĠNo Action ( 0 , Ġ 5 )))) Ġ// ĠB ĊĠĠĠĠĠĠĠ Ġassert ( blue Version . event Queue . contains ( Event ( 1 3 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 8 , Ġ 1 , Ġ 1 . 0 , Ġ 1 0 )))) Ġ// ĠB ĊĠĠĠĠĠĠĠ Ġassert ( blue Version . event Queue . contains ( Event ( 2 0 , ĠTrans it End ( Player Id . Blue , Ġ 1 , Ġ 3 , Ġ 2 0 )))) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Version . event Queue . size , Ġ 1 0 ) ĊĠĠĠ Ġ} Ċ } Ċ Ċ class ĠH istoric Visibility Tests Ġ{ ĊĊĠĠĠ Ġ@ BeforeEach ĊĠĠĠ Ġfun Ġinit () Ġ{ ĊĠĠĠĠĠĠĠ Ġfog gy World Ġ= ĠWorld ( params Ġ= Ġcity Creation Params ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġh istoric Visibility Updates After City Con quer ed () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠLand Combat Game ( fog gy World ) ĊĠĠĠĠĠĠĠ Ġval Ġgame Copy Ġ= Ġgame . copy () ĊĠĠĠĠĠĠĠ Ġgame Copy . next ( 2 ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( game Copy . visibility Models [ Player Id . Red ]?. isEmpty () Ġ?: Ġfalse ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( game Copy . visibility Models [ Player Id . Blue ]?. isEmpty () Ġ?: Ġfalse ) ĊĊĠĠĠĠĠĠĠ ĠCity In flux ( Player Id . Red , ĠForce ( 5 . 0 ), Ġ 7 , Ġ- 1 ). apply ( game Copy ) ĊĠĠĠĠĠĠĠ Ġ( 0 .. 8 ). forEach Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . visibility Models [ Player Id . Red ]?. last Visible ( it ), Ġ- 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . visibility Models [ Player Id . Blue ]?. last Visible ( it ), Ġ- 1 ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġgame Copy . next ( 3 ) ĊĠĠĠĠĠĠĠ ĠCity In flux ( Player Id . Blue , ĠForce ( 2 0 . 0 ), Ġ 7 , Ġ- 1 ). apply ( game Copy ) ĊĠĠĠĠĠĠĠ Ġval Ġpop After Battle Ġ= Ġgame Copy . world . cities [ 7 ]. pop . size ĊĠĠĠĠĠĠĠ Ġ( 0 .. 8 ). forEach Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . visibility Models [ Player Id . Blue ]?. last Visible ( it ), Ġ- 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . visibility Models [ Player Id . Red ]?. last Visible ( it ), Ġif Ġ( it Ġin ĠlistOf ( 4 , Ġ 7 , Ġ 8 )) Ġ 5 Ġelse Ġ- 1 ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . visibility Models [ Player Id . Blue ]?. last Known Force ( it ) Ġ?: Ġ 0 . 0 0 , Ġ 0 . 0 0 , Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . visibility Models [ Player Id . Red ]?. last Known Force ( it ) Ġ?: Ġ 0 . 0 0 , Ġwhen Ġ( it ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ 4 Ġ-> Ġ 1 0 0 . 0 ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ 7 Ġ-> Ġpop After Battle ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġ 0 . 0 0 ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}, Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġh istoric Visibility Updates After Battle On Arc () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠLand Combat Game ( fog gy World ) ĊĠĠĠĠĠĠĠ Ġval Ġgame Copy Ġ= Ġgame . copy () ĊĠĠĠĠĠĠĠ Ġgame Copy . next ( 2 ) ĊĊĠĠĠĠĠĠĠ ĠCity In flux ( Player Id . Red , ĠForce ( 5 . 0 ), Ġ 7 , Ġ- 1 ). apply ( game Copy ) ĊĠĠĠĠĠĠĠ ĠCity In flux ( Player Id . Blue , ĠForce ( 1 5 . 0 ), Ġ 8 , Ġ- 1 ). apply ( game Copy ) ĊĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 3 , ĠLaunch Exp edition ( Player Id . Red , Ġ 7 , Ġ 8 , Ġ 1 . 0 , Ġ 0 )) ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 3 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 4 , Ġ 7 , Ġ 0 . 1 , Ġ 0 )) ĊĠĠĠĠĠĠĠ Ġ// Ġ 4 Ġ-> Ġ 7 Ġwill Ġar rive Ġbefore Ġ 7 Ġ-> Ġ 8 Ġ( 1 3 Ġticks Ġto Ġget Ġfrom Ġ 7 Ġto Ġ 8 ; Ġ 9 Ġto Ġget Ġfrom Ġ 4 Ġto Ġ 7 ) ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 1 3 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 8 , Ġ 7 , Ġ 0 . 5 , Ġ 0 )) ĊĠĠĠĠĠĠĠ Ġ// Ġbattle Ġshould Ġtake Ġplace Ġon Ġtick Ġ 1 4 ĊĊĠĠĠĠĠĠĠ Ġgame Copy . next ( 1 5 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . event Queue . history . first Ġ{ Ġit . action Ġis ĠBattle Ġ}. tick , Ġ 1 4 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . world . cities [ 7 ]. owner , ĠPlayer Id . Blue ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . world . cities [ 8 ]. owner , ĠPlayer Id . Blue ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . visibility Models [ Player Id . Red ]?. last Visible ( 7 ), Ġ 1 4 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . visibility Models [ Player Id . Red ]?. last Visible ( 8 ), Ġ 1 4 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . visibility Models [ Player Id . Red ]?. last Known Force ( 7 ) Ġ?: Ġ 0 . 0 0 , Ġ 1 0 . 0 , Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . visibility Models [ Player Id . Red ]?. last Known Force ( 8 ) Ġ?: Ġ 0 . 0 0 , Ġ 7 . 5 , Ġ 0 . 0 0 1 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġh istoric Visibility Maint ained Correct ly After State Copy () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠLand Combat Game ( fog gy World ) ĊĠĠĠĠĠĠĠ Ġval Ġgame Copy Ġ= Ġgame . copy () ĊĠĠĠĠĠĠĠ Ġgame Copy . next ( 2 ) ĊĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 6 , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 3 , ĠPlayer Id . Blue ) ĊĊĠĠĠĠĠĠĠ Ġval Ġgame Copy Copy Ġ= Ġgame Copy . copy () ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy Copy . visibility Models [ Player Id . Blue ], ĠH istoric Visibility ( map Of ( 3 Ġto ĠPair ( 2 , Ġ 1 0 0 . 0 )))) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy Copy . visibility Models [ Player Id . Red ], ĠH istoric Visibility ( map Of ( 6 Ġto ĠPair ( 2 , Ġ 0 . 0 )))) ĊĠĠĠĠĠĠĠ Ġval Ġgame Copy Blue Ġ= Ġgame Copy . copy ( 0 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy Blue . visibility Models [ Player Id . Blue ], ĠH istoric Visibility ( map Of ( 3 Ġto ĠPair ( 2 , Ġ 1 0 0 . 0 )))) ĊĠĠĠĠĠĠĠ ĠassertTrue ( game Copy Blue . visibility Models [ Player Id . Red ]?. isEmpty () Ġ?: Ġfalse ) ĊĠĠĠĠĠĠĠ Ġval Ġgame Copy Red Ġ= Ġgame Copy . copy ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( game Copy Red . visibility Models [ Player Id . Blue ]?. isEmpty () Ġ?: Ġfalse ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy Red . visibility Models [ Player Id . Red ], ĠH istoric Visibility ( map Of ( 6 Ġto ĠPair ( 2 , Ġ 0 . 0 )))) ĊĊĠĠĠĠĠĠĠ Ġ// ĠTODO : ĠBl ank ing Ġout Ġopponent s Ġvisibility Ġis Ġnot Ġentirely Ġaccurate , Ġas Ġwe Ġwill Ġoften Ġknow Ġwhen Ġthey Ġlast Ġsaw Ġus ! ĊĠĠĠĠĠĠĠ Ġ// ĠTODO : ĠSo Ġdepending Ġon Ġhow Ġfar Ġwe Ġnest Ġour Ġopponent Ġmodel Ġwe Ġmay Ġwish Ġto Ġkeep Ġthis ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġh istoric Visibility Clean ed Up During San ity Checks () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠLand Combat Game ( fog gy World ) ĊĠĠĠĠĠĠĠ Ġval Ġgame Copy Ġ= Ġgame . copy () ĊĠĠĠĠĠĠĠ Ġgame Copy . next ( 2 ) ĊĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 1 , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 6 , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 3 , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 1 , ĠPlayer Id . Blue ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 6 , ĠPlayer Id . Blue ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 3 , ĠPlayer Id . Blue ) ĊĊĠĠĠĠĠĠĠ Ġgame Copy . next ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . visibility Models [ Player Id . Blue ], ĠH istoric Visibility ( map Of ( 1 Ġto ĠPair ( 2 , Ġ 0 . 0 ), Ġ 6 Ġto ĠPair ( 2 , Ġ 0 . 0 ), Ġ 3 Ġto ĠPair ( 2 , Ġ 1 0 0 . 0 )))) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . visibility Models [ Player Id . Red ], ĠH istoric Visibility ( map Of ( 1 Ġto ĠPair ( 2 , Ġ 0 . 0 ), Ġ 6 Ġto ĠPair ( 2 , Ġ 0 . 0 )))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcity Population Rem ains Visible () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠLand Combat Game ( fog gy World ) ĊĠĠĠĠĠĠĠ Ġval Ġgame Copy Ġ= Ġgame . copy () ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 6 , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 4 , ĠPlayer Id . Red ) ĊĊĠĠĠĠĠĠĠ Ġval Ġblue Copy Ġ= Ġgame Copy . copy ( 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġred Copy Ġ= Ġgame Copy . copy ( 1 ) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( city Creation Params . fog Strength Ass umption . all Ġ{ Ġit Ġ> Ġ 0 . 0 0 Ġ}) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . world . cities [ 6 ]. pop . size , Ġcity Creation Params . fog Strength Ass umption [ 0 ]) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . world . cities [ 3 ]. pop . size , Ġcity Creation Params . fog Strength Ass umption [ 0 ]) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . world . cities [ 1 ]. pop . size , Ġ 0 . 0 0 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . cities [ 6 ]. pop . size , Ġ 0 . 0 0 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . cities [ 3 ]. pop . size , Ġ 1 0 0 . 0 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . cities [ 4 ]. pop . size , Ġ 1 0 0 . 0 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . cities [ 1 ]. pop . size , Ġ 0 . 0 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtransit Rem ains Visible After Copy If Seen () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠLand Combat Game ( fog gy World ) ĊĠĠĠĠĠĠĠ Ġval Ġgame Copy Ġ= Ġgame . copy () ĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġadd Ġtrans its Ġon Ġ 4 -> 1 , Ġ 4 -> Ġ 7 , Ġ 4 -> Ġ 8 ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 0 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 4 , Ġ 1 , Ġ 0 . 1 , Ġ 0 )) ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 0 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 4 , Ġ 7 , Ġ 0 . 1 , Ġ 0 )) ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 0 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 4 , Ġ 8 , Ġ 0 . 1 , Ġ 0 )) ĊĠĠĠĠĠĠĠ Ġgame Copy . next ( 2 ) ĊĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 6 , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 4 , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 1 , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 7 , ĠPlayer Id . Red ) ĊĊĠĠĠĠĠĠĠ Ġgame Copy . next ( 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġred Copy Ġ= Ġgame Copy . copy ( 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġblue Copy Ġ= Ġgame Copy . copy ( 0 ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . world . current Trans its . size , Ġ 3 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . current Trans its . size , Ġ 2 ) Ġ// Ġcan 't Ġsee Ġthe Ġ 4 -> 8 Ġone ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . current Trans its . filter Ġ{ Ġit . to City Ġ== Ġ 1 Ġ&& Ġit . player Id Ġ== ĠPlayer Id . Blue Ġ&& Ġit . force . size Ġ== Ġ 1 0 . 0 Ġ}. size , Ġ 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . current Trans its . filter Ġ{ Ġit . to City Ġ== Ġ 7 Ġ&& Ġit . player Id Ġ== ĠPlayer Id . Blue Ġ&& Ġit . force . size Ġ== Ġ 1 0 . 0 Ġ}. size , Ġ 1 ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . event Queue . filter Ġ{ Ġit . action Ġis ĠTrans it End Ġ}. size , Ġ 3 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . event Queue . filter Ġ{ Ġit . action Ġis ĠTrans it End Ġ}. size , Ġ 2 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtrans its Not Visible If La unched After Visibility App lies () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠLand Combat Game ( fog gy World ) ĊĠĠĠĠĠĠĠ Ġval Ġgame Copy Ġ= Ġgame . copy () ĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġadd Ġtrans its Ġon Ġ 4 -> 1 , Ġ 4 -> Ġ 7 , Ġ 4 -> Ġ 8 ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 0 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 4 , Ġ 1 , Ġ 0 . 1 , Ġ 0 )) ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 5 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 4 , Ġ 7 , Ġ 0 . 1 , Ġ 0 )) ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 1 0 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 4 , Ġ 8 , Ġ 0 . 1 , Ġ 0 )) ĊĊĠĠĠĠĠĠĠ Ġgame Copy . next ( 2 ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 6 , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 4 , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 1 , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 7 , ĠPlayer Id . Red ) ĊĊĠĠĠĠĠĠĠ Ġgame Copy . next ( 1 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġred Copy Ġ= Ġgame Copy . copy ( 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġblue Copy Ġ= Ġgame Copy . copy ( 0 ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . world . current Trans its . size , Ġ 3 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . current Trans its . size , Ġ 1 ) Ġ// Ġcan Ġonly Ġsee Ġthe Ġ 4 Ġ-> Ġ 1 Ġone ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . current Trans its . filter Ġ{ Ġit . to City Ġ== Ġ 1 Ġ&& Ġit . player Id Ġ== ĠPlayer Id . Blue Ġ&& Ġit . force . size Ġ== Ġ 1 0 . 0 Ġ}. size , Ġ 1 ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . event Queue . filter Ġ{ Ġit . action Ġis ĠTrans it End Ġ}. size , Ġ 3 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . event Queue . filter Ġ{ Ġit . action Ġis ĠTrans it End Ġ}. size , Ġ 1 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġb att les Are Visible If Both Affected Trans its Are Visible () Ġ{ ĊĠĠĠĠĠĠĠ Ġ// Ġmind Ġyou Ġ- Ġwith Ġtwo Ġplayers ĠB att les Ġwill Ġalways Ġbe Ġvisible ! ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠLand Combat Game ( fog gy World ) ĊĠĠĠĠĠĠĠ Ġval Ġgame Copy Ġ= Ġgame . copy () ĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġadd Ġtrans its Ġon Ġ 4 -> 1 , Ġ 4 -> Ġ 7 , Ġ 4 -> Ġ 8 ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 0 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 4 , Ġ 1 , Ġ 0 . 2 , Ġ 0 )) Ġ// Ġtakes Ġ 4 6 Ġticks Ġto Ġar rive ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 5 0 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 1 , Ġ 3 , Ġ 0 . 5 , Ġ 0 )) ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 5 0 , ĠLaunch Exp edition ( Player Id . Red , Ġ 3 , Ġ 1 , Ġ 0 . 5 , Ġ 0 )) Ġ// Ġwill Ġan nih il ate Ġthe ĠBlue Ġplayer ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 5 5 , ĠCity In flux ( Player Id . Red , ĠForce Ġ( 2 0 . 0 ), Ġ 1 , Ġ- 1 )) ĊĠĠĠĠĠĠĠ Ġgame Copy . next ( 5 7 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . event Queue . filter Ġ{ Ġit . action Ġis ĠBattle Ġ}. size , Ġ 1 Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġred Copy Ġ= Ġgame Copy . copy ( 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġblue Copy Ġ= Ġgame Copy . copy ( 0 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . event Queue . filter Ġ{ Ġit . action Ġis ĠBattle Ġ}. size , Ġ 1 Ġ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . event Queue . filter Ġ{ Ġit . action Ġis ĠBattle Ġ}. size , Ġ 1 Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġsemi IntegrationTest Of He uristic Visibility () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠLand Combat Game ( fog gy World ) ĊĠĠĠĠĠĠĠ Ġval Ġgame Copy Ġ= Ġgame . copy () ĊĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 0 , ĠLaunch Exp edition ( Player Id . Red , Ġ 3 , Ġ 1 , Ġ 0 . 2 , Ġ 0 )) Ġ// Ġtakes Ġ 3 1 Ġticks Ġto Ġar rive ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 3 2 , ĠLaunch Exp edition ( Player Id . Red , Ġ 1 , Ġ 2 , Ġ 0 . 2 , Ġ 0 )) Ġ// Ġtakes Ġ 1 9 Ġticks ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 3 2 , ĠLaunch Exp edition ( Player Id . Red , Ġ 3 , Ġ 0 , Ġ 0 . 2 , Ġ 0 )) Ġ// Ġtakes Ġ 2 4 Ġticks ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 0 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 4 , Ġ 1 , Ġ 0 . 9 , Ġ 0 )) Ġ// Ġtakes Ġ 4 6 ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 4 7 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 1 , Ġ 2 , Ġ 0 . 5 , Ġ 0 )) Ġ// Ġtakes Ġ 1 9 ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 5 7 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 1 , Ġ 2 , Ġ 0 . 5 , Ġ 0 )) ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 6 7 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 1 , Ġ 2 , Ġ 0 . 5 , Ġ 0 )) ĊĠĠĠĠĠĠĠ Ġgame Copy . plan Event ( 5 0 , ĠLaunch Exp edition ( Player Id . Blue , Ġ 4 , Ġ 7 , Ġ 0 . 5 , Ġ 0 )) Ġ// Ġtakes Ġ 9 ĊĊĠĠĠĠĠĠĠ Ġgame Copy . next ( 7 0 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . world . current Trans its . size , Ġ 2 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . event Queue . filter Ġ{ Ġit . action Ġis ĠTrans it End Ġ}. size , Ġ 2 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . world . cities [ 0 ]. owner , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . world . cities [ 0 ]. pop . size , Ġ 1 6 . 0 , Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . world . cities [ 4 ]. owner , ĠPlayer Id . Blue ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( game Copy . world . cities [ 4 ]. pop . size , Ġ 5 . 0 , Ġ 0 . 0 0 1 ) ĊĊĠĠĠĠĠĠĠ Ġval Ġred Copy Ġ= Ġgame Copy . copy ( 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġblue Copy Ġ= Ġgame Copy . copy ( 0 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . current Trans its . size , Ġ 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . event Queue . filter Ġ{ Ġit . action Ġis ĠTrans it End Ġ}. size , Ġ 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . cities [ 0 ]. owner , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . cities [ 0 ]. pop . size , Ġ 1 6 . 0 , Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . cities [ 4 ]. owner , ĠPlayer Id . Blue ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . cities [ 4 ]. pop . size , Ġ 1 0 . 0 , Ġ 0 . 0 0 1 ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . world . current Trans its . size , Ġ 2 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . event Queue . filter Ġ{ Ġit . action Ġis ĠTrans it End Ġ}. size , Ġ 2 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . world . cities [ 0 ]. owner , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . world . cities [ 0 ]. pop . size , Ġ 1 6 . 0 , Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . world . cities [ 4 ]. owner , ĠPlayer Id . Blue ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . world . cities [ 4 ]. pop . size , Ġ 5 . 0 , Ġ 0 . 0 0 1 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġvisibility Information Is Forgot ten After Threshold () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠLand Combat Game ( fog gy World ) ĊĠĠĠĠĠĠĠ Ġval Ġgame Copy Ġ= Ġgame . copy () ĊĊĠĠĠĠĠĠĠ Ġgame Copy . next ( 2 ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 6 , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 4 , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 1 , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 7 , ĠPlayer Id . Red ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 6 , ĠPlayer Id . Blue ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 4 , ĠPlayer Id . Blue ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 1 , ĠPlayer Id . Blue ) ĊĠĠĠĠĠĠĠ Ġgame Copy . update Visibility ( 7 , ĠPlayer Id . Blue ) ĊĊĠĠĠĠĠĠĠ Ġgame Copy . next ( 1 0 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġred Copy Ġ= Ġgame Copy . copy ( 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġblue Copy Ġ= Ġgame Copy . copy ( 0 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . cities [ 1 ]. pop . size , Ġ 0 . 0 0 , Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . cities [ 4 ]. pop . size , Ġ 1 0 0 . 0 0 , Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . cities [ 6 ]. pop . size , Ġ 0 . 0 , Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy . world . cities [ 7 ]. pop . size , Ġ 0 . 0 , Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . world . cities [ 1 ]. pop . size , Ġ 0 . 0 , Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . world . cities [ 4 ]. pop . size , Ġ 1 0 0 . 0 , Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . world . cities [ 6 ]. pop . size , Ġcity Creation Params . fog Strength Ass umption [ 0 ], Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy . world . cities [ 7 ]. pop . size , Ġ 0 . 0 0 , Ġ 0 . 0 0 1 ) ĊĊĠĠĠĠĠĠĠ Ġgame Copy . next ( 1 0 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġred Copy 2 Ġ= Ġgame Copy . copy ( 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġblue Copy 2 Ġ= Ġgame Copy . copy ( 0 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy 2 . world . cities [ 1 ]. pop . size , Ġ 0 . 0 0 , Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy 2 . world . cities [ 4 ]. pop . size , Ġcity Creation Params . fog Strength Ass umption [ 1 ], Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy 2 . world . cities [ 6 ]. pop . size , Ġcity Creation Params . fog Strength Ass umption [ 1 ], Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( red Copy 2 . world . cities [ 7 ]. pop . size , Ġcity Creation Params . fog Strength Ass umption [ 1 ], Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy 2 . world . cities [ 1 ]. pop . size , Ġ 0 . 0 , Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy 2 . world . cities [ 4 ]. pop . size , Ġ 1 0 0 . 0 , Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy 2 . world . cities [ 6 ]. pop . size , Ġcity Creation Params . fog Strength Ass umption [ 0 ], Ġ 0 . 0 0 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( blue Copy 2 . world . cities [ 7 ]. pop . size , Ġ 0 . 0 0 , Ġ 0 . 0 0 1 ) ĊĠĠĠ Ġ} Ċ Ċ }