diff --git a/game/quarry_rush/map/collectable/collectable_generator.py b/game/quarry_rush/map/collectable/collectable_generator.py index 08e17a09..1942bbd4 100644 --- a/game/quarry_rush/map/collectable/collectable_generator.py +++ b/game/quarry_rush/map/collectable/collectable_generator.py @@ -8,7 +8,7 @@ class CollectableGenerator: __board_size = 14 # This includes the borders. Field is 12x12 - __ore_count = 100 + __ore_count = 75 def __init__(self, seed: int = rand.randint(0, 8675309)): with open('game/quarry_rush/map/collectable/collectable_weights.json') as f: diff --git a/game/quarry_rush/map/collectable/collectable_weights.json b/game/quarry_rush/map/collectable/collectable_weights.json index 41f74317..c9ebf452 100644 --- a/game/quarry_rush/map/collectable/collectable_weights.json +++ b/game/quarry_rush/map/collectable/collectable_weights.json @@ -18,194 +18,194 @@ ], [ 0.0, - 1.0, - 1.0, - 1.0, + 0.4980392156862745, + 0.4980392156862745, + 0.4980392156862745, 0.0, 0.0, 0.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, + 0.8980392156862745, + 0.8980392156862745, + 0.8980392156862745, + 0.8, + 0.8, 0.0, 0.0 ], [ 0.0, - 1.0, - 1.0, - 1.0, + 0.4980392156862745, + 0.4980392156862745, + 0.4980392156862745, 0.0, 0.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, + 0.8980392156862745, + 0.8980392156862745, + 0.8980392156862745, + 0.8, + 0.8, + 0.8, + 0.6980392156862745, 0.0 ], [ 0.0, - 1.0, - 1.0, + 0.4980392156862745, + 0.4980392156862745, 0.0, 0.0, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, + 0.8980392156862745, + 0.8980392156862745, + 0.8980392156862745, + 0.8980392156862745, 0.0, - 1.0, - 1.0, - 1.0, + 0.8, + 0.6980392156862745, + 0.6980392156862745, 0.0 ], [ + 0.0, + 0.4980392156862745, + 0.4980392156862745, 0.0, 1.0, 1.0, - 0.0, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.0, - 0.0, 1.0, 1.0, + 1.0, + 0.0, + 0.0, + 0.6980392156862745, + 0.6980392156862745, 0.0 ], [ + 0.0, + 0.6, + 0.6, 0.0, 1.0, 1.0, - 0.0, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.0, 1.0, 1.0, + 1.0, + 1.0, + 0.0, + 0.6, + 0.6, 0.0 ], [ + 0.0, + 0.6, + 0.6, 0.0, 1.0, 1.0, - 0.0, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.0, 1.0, 1.0, + 1.0, + 1.0, + 0.0, + 0.6, + 0.6, 0.0 ], [ + 0.0, + 0.6, + 0.6, 0.0, 1.0, 1.0, - 0.0, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.0, 1.0, 1.0, + 1.0, + 1.0, + 0.0, + 0.6, + 0.6, 0.0 ], [ + 0.0, + 0.6, + 0.6, 0.0, 1.0, 1.0, - 0.0, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.0, 1.0, 1.0, + 1.0, + 1.0, + 0.0, + 0.6, + 0.6, 0.0 ], [ 0.0, - 1.0, - 1.0, - 0.0, + 0.6980392156862745, + 0.6980392156862745, 0.0, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, 0.0, 1.0, 1.0, + 1.0, + 1.0, + 1.0, + 0.0, + 0.4980392156862745, + 0.4980392156862745, 0.0 ], [ 0.0, - 1.0, - 1.0, - 1.0, + 0.6980392156862745, + 0.6980392156862745, + 0.8, 0.0, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, - 0.43162393162393164, + 0.8980392156862745, + 0.8980392156862745, + 0.8980392156862745, + 0.8980392156862745, 0.0, 0.0, - 1.0, - 1.0, + 0.4980392156862745, + 0.4980392156862745, 0.0 ], [ 0.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, + 0.6980392156862745, + 0.8, + 0.8, + 0.8, + 0.8980392156862745, + 0.8980392156862745, + 0.8980392156862745, 0.0, 0.0, - 1.0, - 1.0, - 1.0, + 0.4980392156862745, + 0.4980392156862745, + 0.4980392156862745, 0.0 ], [ 0.0, 0.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, + 0.8, + 0.8, + 0.8980392156862745, + 0.8980392156862745, + 0.8980392156862745, 0.0, 0.0, 0.0, - 1.0, - 1.0, - 1.0, + 0.4980392156862745, + 0.4980392156862745, + 0.4980392156862745, 0.0 ], [ @@ -250,11 +250,11 @@ 0.0, 0.0, 0.0, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, + 0.6225490196078431, + 0.6225490196078431, + 0.37254901960784315, + 0.37254901960784315, + 0.37254901960784315, 0.0, 0.0 ], @@ -265,13 +265,13 @@ 0.0, 0.0, 0.0, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, + 0.6225490196078431, + 0.6225490196078431, + 0.6225490196078431, + 0.37254901960784315, + 0.37254901960784315, + 0.37254901960784315, + 0.25, 0.0 ], [ @@ -280,14 +280,14 @@ 0.0, 0.0, 0.0, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, + 0.6225490196078431, + 0.6225490196078431, + 0.6225490196078431, + 0.6225490196078431, 0.0, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, + 0.37254901960784315, + 0.25, + 0.25, 0.0 ], [ @@ -295,37 +295,37 @@ 0.0, 0.0, 0.0, + 0.8725490196078431, 1.0, 1.0, 1.0, - 1.0, - 1.0, - 0.0, - 0.0, + 0.8725490196078431, 0.0, 0.0, + 0.25, + 0.25, 0.0 ], [ 0.0, + 0.12254901960784313, + 0.12254901960784313, 0.0, - 0.0, - 0.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, + 0.8725490196078431, 0.0, - 0.0, - 0.0, + 0.25, + 0.25, 0.0 ], [ 0.0, - 0.0, - 0.0, + 0.12254901960784313, + 0.12254901960784313, 0.0, 1.0, 1.0, @@ -334,14 +334,14 @@ 1.0, 1.0, 0.0, - 0.0, - 0.0, + 0.12254901960784313, + 0.12254901960784313, 0.0 ], [ 0.0, - 0.0, - 0.0, + 0.12254901960784313, + 0.12254901960784313, 0.0, 1.0, 1.0, @@ -350,37 +350,37 @@ 1.0, 1.0, 0.0, - 0.0, - 0.0, + 0.12254901960784313, + 0.12254901960784313, 0.0 ], [ 0.0, + 0.25, + 0.25, 0.0, - 0.0, - 0.0, - 1.0, + 0.8725490196078431, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, - 0.0, - 0.0, + 0.12254901960784313, + 0.12254901960784313, 0.0 ], [ 0.0, + 0.25, + 0.25, 0.0, 0.0, - 0.0, - 0.0, - 1.0, - 1.0, + 0.8725490196078431, 1.0, 1.0, 1.0, + 0.8725490196078431, 0.0, 0.0, 0.0, @@ -388,14 +388,14 @@ ], [ 0.0, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, + 0.25, + 0.25, + 0.37254901960784315, 0.0, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, + 0.6225490196078431, + 0.6225490196078431, + 0.6225490196078431, + 0.6225490196078431, 0.0, 0.0, 0.0, @@ -404,13 +404,13 @@ ], [ 0.0, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, + 0.25, + 0.37254901960784315, + 0.37254901960784315, + 0.37254901960784315, + 0.6225490196078431, + 0.6225490196078431, + 0.6225490196078431, 0.0, 0.0, 0.0, @@ -421,11 +421,11 @@ [ 0.0, 0.0, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, - 0.22222222222222224, + 0.37254901960784315, + 0.37254901960784315, + 0.37254901960784315, + 0.6225490196078431, + 0.6225490196078431, 0.0, 0.0, 0.0, @@ -470,88 +470,88 @@ ], [ 0.0, - 1.0, - 1.0, - 1.0, + 0.25, + 0.25, + 0.12254901960784313, 0.0, 0.0, 0.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, + 0.8725490196078431, + 0.8725490196078431, + 0.75, + 0.75, + 0.75, 0.0, 0.0 ], [ 0.0, - 1.0, - 1.0, - 1.0, + 0.25, + 0.25, + 0.12254901960784313, 0.0, 0.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, + 0.8725490196078431, + 0.8725490196078431, + 0.8725490196078431, + 0.75, + 0.75, + 0.75, + 0.75, 0.0 ], [ 0.0, - 1.0, - 1.0, + 0.37254901960784315, + 0.37254901960784315, 0.0, 0.0, - 1.0, - 1.0, - 1.0, - 1.0, + 0.8725490196078431, + 0.8725490196078431, + 0.8725490196078431, + 0.8725490196078431, 0.0, - 1.0, - 1.0, - 1.0, + 0.75, + 0.75, + 0.75, 0.0 ], [ 0.0, - 1.0, - 1.0, + 0.5, + 0.5, 0.0, + 0.8725490196078431, 1.0, 1.0, 1.0, - 1.0, - 1.0, + 0.8725490196078431, 0.0, 0.0, - 1.0, - 1.0, + 0.75, + 0.75, 0.0 ], [ 0.0, - 1.0, - 1.0, + 0.5, + 0.5, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, + 0.8725490196078431, 0.0, - 1.0, - 1.0, + 0.75, + 0.75, 0.0 ], [ 0.0, - 1.0, - 1.0, + 0.6225490196078431, + 0.6225490196078431, 0.0, 1.0, 1.0, @@ -560,14 +560,14 @@ 1.0, 1.0, 0.0, - 1.0, - 1.0, + 0.6225490196078431, + 0.6225490196078431, 0.0 ], [ 0.0, - 1.0, - 1.0, + 0.6225490196078431, + 0.6225490196078431, 0.0, 1.0, 1.0, @@ -576,88 +576,88 @@ 1.0, 1.0, 0.0, - 1.0, - 1.0, + 0.6225490196078431, + 0.6225490196078431, 0.0 ], [ 0.0, - 1.0, - 1.0, + 0.75, + 0.75, 0.0, - 1.0, + 0.8725490196078431, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, - 1.0, - 1.0, + 0.5, + 0.5, 0.0 ], [ 0.0, - 1.0, - 1.0, + 0.75, + 0.75, 0.0, 0.0, + 0.8725490196078431, 1.0, 1.0, 1.0, - 1.0, - 1.0, + 0.8725490196078431, 0.0, - 1.0, - 1.0, + 0.5, + 0.5, 0.0 ], [ 0.0, - 1.0, - 1.0, - 1.0, + 0.75, + 0.75, + 0.75, 0.0, - 1.0, - 1.0, - 1.0, - 1.0, + 0.8725490196078431, + 0.8725490196078431, + 0.8725490196078431, + 0.8725490196078431, 0.0, 0.0, - 1.0, - 1.0, + 0.37254901960784315, + 0.37254901960784315, 0.0 ], [ 0.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, + 0.75, + 0.75, + 0.75, + 0.75, + 0.8725490196078431, + 0.8725490196078431, + 0.8725490196078431, 0.0, 0.0, - 1.0, - 1.0, - 1.0, + 0.12254901960784313, + 0.25, + 0.25, 0.0 ], [ 0.0, 0.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, + 0.75, + 0.75, + 0.75, + 0.8725490196078431, + 0.8725490196078431, 0.0, 0.0, 0.0, - 1.0, - 1.0, - 1.0, + 0.12254901960784313, + 0.25, + 0.25, 0.0 ], [ diff --git a/game/test_suite/tests/test_map_generator.py b/game/test_suite/tests/test_map_generator.py index 708ce1d3..bd1dda0d 100644 --- a/game/test_suite/tests/test_map_generator.py +++ b/game/test_suite/tests/test_map_generator.py @@ -55,125 +55,25 @@ def test_map_generation(self) -> None: (Vector(x=9, y=12),): [TuringStation(), ], (Vector(x=4, y=1),): [ChurchStation(), ], (Vector(9, 12),): [Avatar(), ], - (Vector(4, 1),): [Avatar(), ], - (Vector(x=1, y=1),): [OreOccupiableStation(), ], - (Vector(x=2, y=1),): [OreOccupiableStation(), ], - (Vector(x=3, y=1),): [OreOccupiableStation(), ], - (Vector(x=7, y=1),): [OreOccupiableStation(), ], - (Vector(x=8, y=1),): [OreOccupiableStation(), ], - (Vector(x=9, y=1),): [OreOccupiableStation(), ], - (Vector(x=10, y=1),): [OreOccupiableStation(), ], - (Vector(x=11, y=1),): [OreOccupiableStation(), ], - (Vector(x=1, y=2),): [OreOccupiableStation(), ], - (Vector(x=2, y=2),): [OreOccupiableStation(), ], - (Vector(x=3, y=2),): [OreOccupiableStation(), ], - (Vector(x=6, y=2),): [OreOccupiableStation(), ], - (Vector(x=7, y=2),): [OreOccupiableStation(), ], - (Vector(x=8, y=2),): [OreOccupiableStation(), ], - (Vector(x=9, y=2),): [OreOccupiableStation(), ], - (Vector(x=10, y=2),): [OreOccupiableStation(), ], - (Vector(x=11, y=2),): [OreOccupiableStation(), ], - (Vector(x=12, y=2),): [OreOccupiableStation(), ], - (Vector(x=1, y=3),): [OreOccupiableStation(), ], - (Vector(x=2, y=3),): [OreOccupiableStation(), ], - (Vector(x=5, y=3),): [OreOccupiableStation(), ], - (Vector(x=6, y=3),): [OreOccupiableStation(), ], - (Vector(x=7, y=3),): [OreOccupiableStation(), ], - (Vector(x=8, y=3),): [OreOccupiableStation(), ], - (Vector(x=10, y=3),): [OreOccupiableStation(), ], - (Vector(x=11, y=3),): [OreOccupiableStation(), ], - (Vector(x=12, y=3),): [OreOccupiableStation(), ], - (Vector(x=1, y=4),): [OreOccupiableStation(), ], - (Vector(x=2, y=4),): [OreOccupiableStation(), ], - (Vector(x=4, y=4),): [OreOccupiableStation(), ], - (Vector(x=5, y=4),): [OreOccupiableStation(), ], - (Vector(x=6, y=4),): [OreOccupiableStation(), ], - (Vector(x=8, y=4),): [OreOccupiableStation(), ], - (Vector(x=11, y=4),): [OreOccupiableStation(), ], - (Vector(x=12, y=4),): [OreOccupiableStation(), ], - (Vector(x=1, y=5),): [OreOccupiableStation(), ], - (Vector(x=2, y=5),): [OreOccupiableStation(), ], - (Vector(x=4, y=5),): [OreOccupiableStation(), ], - (Vector(x=5, y=5),): [OreOccupiableStation(), ], - (Vector(x=6, y=5),): [OreOccupiableStation(), ], - (Vector(x=7, y=5),): [OreOccupiableStation(), ], - (Vector(x=8, y=5),): [OreOccupiableStation(), ], - (Vector(x=9, y=5),): [OreOccupiableStation(), ], - (Vector(x=11, y=5),): [OreOccupiableStation(), ], - (Vector(x=12, y=5),): [OreOccupiableStation(), ], - (Vector(x=1, y=6),): [OreOccupiableStation(), ], - (Vector(x=2, y=6),): [OreOccupiableStation(), ], - (Vector(x=4, y=6),): [OreOccupiableStation(), ], - (Vector(x=5, y=6),): [OreOccupiableStation(), ], - (Vector(x=6, y=6),): [OreOccupiableStation(), ], - (Vector(x=7, y=6),): [OreOccupiableStation(), ], - (Vector(x=8, y=6),): [OreOccupiableStation(), ], - (Vector(x=9, y=6),): [OreOccupiableStation(), ], - (Vector(x=11, y=6),): [OreOccupiableStation(), ], - (Vector(x=12, y=6),): [OreOccupiableStation(), ], - (Vector(x=1, y=7),): [OreOccupiableStation(), ], - (Vector(x=2, y=7),): [OreOccupiableStation(), ], - (Vector(x=4, y=7),): [OreOccupiableStation(), ], - (Vector(x=5, y=7),): [OreOccupiableStation(), ], - (Vector(x=7, y=7),): [OreOccupiableStation(), ], - (Vector(x=8, y=7),): [OreOccupiableStation(), ], - (Vector(x=9, y=7),): [OreOccupiableStation(), ], - (Vector(x=11, y=7),): [OreOccupiableStation(), ], - (Vector(x=12, y=7),): [OreOccupiableStation(), ], - (Vector(x=1, y=8),): [OreOccupiableStation(), ], - (Vector(x=2, y=8),): [OreOccupiableStation(), ], - (Vector(x=5, y=8),): [OreOccupiableStation(), ], - (Vector(x=9, y=8),): [OreOccupiableStation(), ], - (Vector(x=11, y=8),): [OreOccupiableStation(), ], - (Vector(x=12, y=8),): [OreOccupiableStation(), ], - (Vector(x=1, y=9),): [OreOccupiableStation(), ], - (Vector(x=2, y=9),): [OreOccupiableStation(), ], - (Vector(x=5, y=9),): [OreOccupiableStation(), ], - (Vector(x=6, y=9),): [OreOccupiableStation(), ], - (Vector(x=7, y=9),): [OreOccupiableStation(), ], - (Vector(x=9, y=9),): [OreOccupiableStation(), ], - (Vector(x=11, y=9),): [OreOccupiableStation(), ], - (Vector(x=12, y=9),): [OreOccupiableStation(), ], - (Vector(x=1, y=10),): [OreOccupiableStation(), ], - (Vector(x=2, y=10),): [OreOccupiableStation(), ], - (Vector(x=8, y=10),): [OreOccupiableStation(), ], - (Vector(x=11, y=10),): [OreOccupiableStation(), ], - (Vector(x=12, y=10),): [OreOccupiableStation(), ], - (Vector(x=1, y=11),): [OreOccupiableStation(), ], - (Vector(x=2, y=11),): [OreOccupiableStation(), ], - (Vector(x=3, y=11),): [OreOccupiableStation(), ], - (Vector(x=4, y=11),): [OreOccupiableStation(), ], - (Vector(x=5, y=11),): [OreOccupiableStation(), ], - (Vector(x=6, y=11),): [OreOccupiableStation(), ], - (Vector(x=7, y=11),): [OreOccupiableStation(), ], - (Vector(x=11, y=11),): [OreOccupiableStation(), ], - (Vector(x=12, y=11),): [OreOccupiableStation(), ], - (Vector(x=2, y=12),): [OreOccupiableStation(), ], - (Vector(x=3, y=12),): [OreOccupiableStation(), ], - (Vector(x=4, y=12),): [OreOccupiableStation(), ], - (Vector(x=5, y=12),): [OreOccupiableStation(), ], - (Vector(x=6, y=12),): [OreOccupiableStation(), ], - (Vector(x=10, y=12),): [OreOccupiableStation(), ], - (Vector(x=11, y=12),): [OreOccupiableStation(), ], - (Vector(x=12, y=12),): [OreOccupiableStation(), ], + (Vector(4, 1),): [Avatar(), ] } # Get the actual result by calling the method actual: dict[tuple[Vector], list[GameObject]] = self.map_generator.generate() - - # compare all values within the dict to see if they match - for (x, y), (i, j) in zip(expected.items(), actual.items()): + # compare all values within the dict to see if they match (ignoring ORE_OCCUPIABLE_STATIONs) + for (x, y), (i, j) in zip(expected.items(), dict(filter(lambda pair : pair[1][0].object_type != ObjectType.ORE_OCCUPIABLE_STATION, actual.items())).items()): for ake, bke in zip(x, i): self.assertEqual(ake.x, bke.x) self.assertEqual(ake.y, bke.y) for av, bv in zip(y, j): self.assertEqual(av.object_type, bv.object_type) + # check if there are exactly 75 ORE_OCCUPIABLE_STATIONS count = 0 for key in actual.keys(): if [z.object_type for z in actual[key]].__contains__(ObjectType.ORE_OCCUPIABLE_STATION): count += 1 - self.assertEqual(count, 100) + self.assertEqual(count, 75)