-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChickenAttackerBoardTest.java
2097 lines (1931 loc) · 95.7 KB
/
ChickenAttackerBoardTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package ch.epfl.chacun;
import org.junit.jupiter.api.Test;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.junit.jupiter.api.Assertions.*;
class ChickenAttackerBoardTest {
@Test
void boardTileAtReturnsNullForPositionsOutsideOfBoard() {
var board = Board.EMPTY;
assertNull(board.tileAt(new Pos(-100, -100)));
}
@Test
void boardTileAtWorksWithStartingTile() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var board = Board.EMPTY.withNewTile(t56);
for (int x = -12; x <= 12; x += 1) {
for (int y = -12; y <= 12; y += 1) {
if (x == 0 && y == 0) {
assertEquals(t56, board.tileAt(new Pos(x, y)));
} else {
assertNull(board.tileAt(new Pos(x, y)));
}
}
}
}
@Test
void boardTileWithIdWorksWithTilesOnBoard() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.RED, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.RED, Rotation.NONE, new Pos(1, 0));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withNewTile(t27);
assertEquals(t56, board.tileWithId(56));
assertEquals(t17, board.tileWithId(17));
assertEquals(t27, board.tileWithId(27));
}
@Test
void boardTileWithIdThrowsWithUnplacedTile() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.RED, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.RED, Rotation.NONE, new Pos(1, 0));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withNewTile(t27);
for (int i = 0; i < 95; i += 1) {
if (i == 17 || i == 27 || i == 56) continue;
var tileId = i;
assertThrows(IllegalArgumentException.class, () -> board.tileWithId(tileId));
}
}
@Test
void boardCancelledAnimalsIsImmutable() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.RED, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.RED, Rotation.NONE, new Pos(1, 0));
var cancelledAnimals = Set.of(
new Animal(56_0_0, Animal.Kind.AUROCHS),
new Animal(17_2_0, Animal.Kind.DEER),
new Animal(17_4_0, Animal.Kind.TIGER));
var mutableCancelledAnimals = new HashSet<>(cancelledAnimals);
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withNewTile(t27)
.withMoreCancelledAnimals(mutableCancelledAnimals);
mutableCancelledAnimals.clear();
assertEquals(cancelledAnimals, board.cancelledAnimals());
try {
board.cancelledAnimals().clear();
} catch (UnsupportedOperationException e) {
// nothing to do
}
assertEquals(cancelledAnimals, board.cancelledAnimals());
}
@Test
void boardOccupantsWorksOnSmallExample() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.RED, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.RED, Rotation.NONE, new Pos(1, 0));
var occupant17 = new Occupant(Occupant.Kind.PAWN, 17_0);
var occupant27 = new Occupant(Occupant.Kind.HUT, 27_1);
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withOccupant(occupant17)
.withNewTile(t27)
.withOccupant(occupant27);
assertEquals(Set.of(occupant17, occupant27), board.occupants());
}
@Test
void boardForestAreaWorksOnSmallExample() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.RED, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.RED, Rotation.NONE, new Pos(1, 0));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withNewTile(t27);
var allForests = Stream.of(t17, t27, t56)
.flatMap(t -> t.forestZones().stream())
.collect(Collectors.toSet());
var forest56 = t56.forestZones().iterator().next();
assertEquals(new Area<>(allForests, List.of(), 1), board.forestArea(forest56));
}
@Test
void boardMeadowAreaWorksOnSmallExample() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.RED, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.RED, Rotation.NONE, new Pos(1, 0));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withNewTile(t27);
var aurochsZone = (Zone.Meadow) t56.zoneWithId(56_0);
var aurochAndDeerMeadows = Set.of(
aurochsZone,
(Zone.Meadow) t17.zoneWithId(17_2));
var emptyStartingZone = (Zone.Meadow) t56.zoneWithId(56_2);
var emptyMeadows = Set.of(
emptyStartingZone,
(Zone.Meadow) t17.zoneWithId(17_0));
var area1 = new Area<>(aurochAndDeerMeadows, List.of(), 2);
var area2 = new Area<>(emptyMeadows, List.of(), 3);
assertEquals(area1, board.meadowArea(aurochsZone));
assertEquals(area2, board.meadowArea(emptyStartingZone));
}
@Test
void boardRiverAreaWorksOnSmallExample() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.RED, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.RED, Rotation.NONE, new Pos(1, 0));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withNewTile(t27);
var startingRiver = (Zone.River) t56.zoneWithId(56_3);
var lakeConnectedRivers = Set.of(
startingRiver,
(Zone.River) t17.zoneWithId(17_1));
var area = new Area<>(lakeConnectedRivers, List.of(), 1);
assertEquals(area, board.riverArea(startingRiver));
}
@Test
void boardRiverSystemAreaWorksOnSmallExample() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.RED, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.RED, Rotation.NONE, new Pos(1, 0));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withNewTile(t27);
var startingRiver = (Zone.River) t56.zoneWithId(56_3);
var riverSystemZones = Set.<Zone.Water>of(
startingRiver,
(Zone.River) t17.zoneWithId(17_1),
(Zone.Lake) t56.zoneWithId(56_8));
var area = new Area<>(riverSystemZones, List.of(), 1);
assertEquals(area, board.riverSystemArea(startingRiver));
}
@Test
void boardMeadowAreasWorksOnSmallExample() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.RED, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.RED, Rotation.NONE, new Pos(1, 0));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withNewTile(t27);
var meadows1 = Set.of(
((Zone.Meadow) t17.zoneWithId(17_0)),
((Zone.Meadow) t56.zoneWithId(56_2)));
var area1 = new Area<>(meadows1, List.of(), 3);
var meadows2 = Set.of((Zone.Meadow) t17.zoneWithId(17_4));
var area2 = new Area<>(meadows2, List.of(), 2);
var meadows3 = Set.of(
(Zone.Meadow) t17.zoneWithId(17_2),
(Zone.Meadow) t56.zoneWithId(56_0));
var area3 = new Area<>(meadows3, List.of(), 2);
var meadows4 = Set.of((Zone.Meadow) t27.zoneWithId(27_0));
var area4 = new Area<>(meadows4, List.of(), 3);
var meadows5 = Set.of((Zone.Meadow) t27.zoneWithId(27_2));
var area5 = new Area<>(meadows5, List.of(), 2);
var allMeadowAreas = Set.of(area1, area2, area3, area4, area5);
assertEquals(allMeadowAreas, board.meadowAreas());
}
@Test
void boardRiverSystemAreasWorksOnSmallExample() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t01 = new PlacedTile(allTiles.get(1), null, Rotation.NONE, new Pos(-1, 0));
var t03 = new PlacedTile(allTiles.get(3), null, Rotation.NONE, new Pos(-2, 0));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t01)
.withNewTile(t03);
var waterZones = Set.of(
(Zone.Water) t56.zoneWithId(56_8),
(Zone.Water) t56.zoneWithId(56_3),
(Zone.Water) t01.zoneWithId(1_1),
(Zone.Water) t01.zoneWithId(1_5),
(Zone.Water) t01.zoneWithId(1_8),
(Zone.Water) t03.zoneWithId(3_1),
(Zone.Water) t03.zoneWithId(3_3),
(Zone.Water) t03.zoneWithId(3_5),
(Zone.Water) t03.zoneWithId(3_8));
var riverSystem = new Area<>(waterZones, List.of(), 2);
assertEquals(Set.of(riverSystem), board.riverSystemAreas());
}
@Test
void boardAdjacentMeadowWorksOnGivenExample() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t42 = new PlacedTile(allTiles.get(42), PlayerColor.RED, Rotation.LEFT, new Pos(1, 0));
var t60 = new PlacedTile(allTiles.get(60), PlayerColor.BLUE, Rotation.RIGHT, new Pos(1, -1));
var t49 = new PlacedTile(allTiles.get(49), PlayerColor.GREEN, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.YELLOW, Rotation.NONE, new Pos(-2, 0));
var t62 = new PlacedTile(allTiles.get(62), PlayerColor.PURPLE, Rotation.NONE, new Pos(-2, -1));
var t61 = new PlacedTile(allTiles.get(61), PlayerColor.RED, Rotation.NONE, new Pos(-1, -1));
var t94 = new PlacedTile(allTiles.get(94), PlayerColor.BLUE, Rotation.NONE, new Pos(0, -1));
var meadow56 = (Zone.Meadow) t56.zoneWithId(56_0);
var meadow94 = (Zone.Meadow) t94.zoneWithId(94_1);
var meadow60 = (Zone.Meadow) t60.zoneWithId(60_2);
var meadow49 = (Zone.Meadow) t49.zoneWithId(49_0);
var meadow62 = (Zone.Meadow) t62.zoneWithId(62_0);
var meadow42 = (Zone.Meadow) t42.zoneWithId(42_1);
var meadow61 = (Zone.Meadow) t61.zoneWithId(61_0);
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t42)
.withOccupant(new Occupant(Occupant.Kind.PAWN, meadow42.id()))
.withNewTile(t60)
.withOccupant(new Occupant(Occupant.Kind.PAWN, meadow60.id()))
.withNewTile(t49)
.withNewTile(t27)
.withNewTile(t62)
.withOccupant(new Occupant(Occupant.Kind.PAWN, meadow62.id()))
.withNewTile(t61)
.withNewTile(t94);
var adjacentMeadows = Set.of(meadow60, meadow56, meadow94, meadow49, meadow61);
var occupants = Stream.of(PlayerColor.BLUE, PlayerColor.PURPLE)
.sorted()
.toList();
var actualAdjacentMeadow = board.adjacentMeadow(t94.pos(), meadow94);
assertEquals(adjacentMeadows, actualAdjacentMeadow.zones());
assertEquals(occupants, actualAdjacentMeadow.occupants());
}
@Test
void boardOccupantCountWorks() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t42 = new PlacedTile(allTiles.get(42), PlayerColor.RED, Rotation.LEFT, new Pos(1, 0));
var t60 = new PlacedTile(allTiles.get(60), PlayerColor.BLUE, Rotation.RIGHT, new Pos(1, -1));
var t49 = new PlacedTile(allTiles.get(49), PlayerColor.GREEN, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.YELLOW, Rotation.NONE, new Pos(-2, 0));
var t62 = new PlacedTile(allTiles.get(62), PlayerColor.PURPLE, Rotation.NONE, new Pos(-2, -1));
var t61 = new PlacedTile(allTiles.get(61), PlayerColor.RED, Rotation.NONE, new Pos(-1, -1));
var t94 = new PlacedTile(allTiles.get(94), PlayerColor.BLUE, Rotation.NONE, new Pos(0, -1));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t42)
.withOccupant(new Occupant(Occupant.Kind.PAWN, 42_1))
.withNewTile(t60)
.withOccupant(new Occupant(Occupant.Kind.PAWN, 60_1))
.withNewTile(t49)
.withOccupant(new Occupant(Occupant.Kind.HUT, 49_1))
.withNewTile(t27)
.withOccupant(new Occupant(Occupant.Kind.PAWN, 27_1))
.withNewTile(t62)
.withOccupant(new Occupant(Occupant.Kind.PAWN, 62_0))
.withNewTile(t61)
.withNewTile(t94)
.withOccupant(new Occupant(Occupant.Kind.PAWN, 94_0));
var expectedPawns = Map.of(
PlayerColor.RED, 1,
PlayerColor.BLUE, 2,
PlayerColor.GREEN, 0,
PlayerColor.YELLOW, 1,
PlayerColor.PURPLE, 1);
var expectedHuts = Map.of(
PlayerColor.RED, 0,
PlayerColor.BLUE, 0,
PlayerColor.GREEN, 1,
PlayerColor.YELLOW, 0,
PlayerColor.PURPLE, 0);
expectedPawns.forEach((p, c) ->
assertEquals(c, board.occupantCount(p, Occupant.Kind.PAWN)));
expectedHuts.forEach((p, c) ->
assertEquals(c, board.occupantCount(p, Occupant.Kind.HUT)));
}
@Test
void boardInsertionPositionsWorksWithTilesInTheMiddleOfBoard() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t42 = new PlacedTile(allTiles.get(42), PlayerColor.RED, Rotation.LEFT, new Pos(1, 0));
var t94 = new PlacedTile(allTiles.get(94), PlayerColor.BLUE, Rotation.NONE, new Pos(0, -1));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t42)
.withNewTile(t94);
var expectedInsertionPositions = Set.of(
new Pos(1, 1),
new Pos(0, 1),
new Pos(0, -2),
new Pos(-1, 0),
new Pos(1, -1),
new Pos(2, 0),
new Pos(-1, -1));
assertEquals(expectedInsertionPositions, board.insertionPositions());
}
@Test
void boardInsertionPositionsWorkWithTilesOnBoardSide() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t1 = new PlacedTile(allTiles.get(1), null, Rotation.NONE, new Pos(-1, 0));
var t3 = new PlacedTile(allTiles.get(3), null, Rotation.NONE, new Pos(-2, 0));
var t5 = new PlacedTile(allTiles.get(5), null, Rotation.NONE, new Pos(-3, 0));
var t6 = new PlacedTile(allTiles.get(6), null, Rotation.NONE, new Pos(-4, 0));
var t8 = new PlacedTile(allTiles.get(8), null, Rotation.NONE, new Pos(-5, 0));
var t10 = new PlacedTile(allTiles.get(10), null, Rotation.NONE, new Pos(-6, 0));
var t11 = new PlacedTile(allTiles.get(11), null, Rotation.NONE, new Pos(-7, 0));
var t13 = new PlacedTile(allTiles.get(13), null, Rotation.NONE, new Pos(-8, 0));
var t46 = new PlacedTile(allTiles.get(46), null, Rotation.NONE, new Pos(-9, 0));
var t47 = new PlacedTile(allTiles.get(47), null, Rotation.NONE, new Pos(-10, 0));
var t48 = new PlacedTile(allTiles.get(48), null, Rotation.NONE, new Pos(-11, 0));
var t49 = new PlacedTile(allTiles.get(49), null, Rotation.NONE, new Pos(-12, 0));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t1)
.withNewTile(t3)
.withNewTile(t5)
.withNewTile(t6)
.withNewTile(t8)
.withNewTile(t10)
.withNewTile(t11)
.withNewTile(t13)
.withNewTile(t46)
.withNewTile(t47)
.withNewTile(t48)
.withNewTile(t49);
var expectedInsertionPositions = new HashSet<>(Set.of(new Pos(1, 0)));
for (int x = -12; x <= 0; x += 1)
expectedInsertionPositions.addAll(Set.of(new Pos(x, -1), new Pos(x, 1)));
assertEquals(expectedInsertionPositions, board.insertionPositions());
}
@Test
void boardLastPlacedTileWorks() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t42 = new PlacedTile(allTiles.get(42), PlayerColor.RED, Rotation.LEFT, new Pos(1, 0));
var t94 = new PlacedTile(allTiles.get(94), PlayerColor.BLUE, Rotation.NONE, new Pos(0, -1));
var board = Board.EMPTY;
assertNull(board.lastPlacedTile());
board = board.withNewTile(t56);
assertEquals(t56, board.lastPlacedTile());
board = board.withNewTile(t42);
assertEquals(t42, board.lastPlacedTile());
board = board.withNewTile(t94);
assertEquals(t94, board.lastPlacedTile());
}
@Test
void boardForestsClosedByLastTileWorksWithNoForestClosed() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.RED, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.RED, Rotation.NONE, new Pos(1, 0));
var board = Board.EMPTY.withNewTile(t56);
assertEquals(Set.of(), board.forestsClosedByLastTile());
board = board.withNewTile(t17);
assertEquals(Set.of(), board.forestsClosedByLastTile());
board = board.withNewTile(t27);
assertEquals(Set.of(), board.forestsClosedByLastTile());
}
@Test
void boardForestsClosedByLastTileWorksWithOneClosedForest() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.RED, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.RED, Rotation.NONE, new Pos(1, 0));
var t37 = new PlacedTile(allTiles.get(37), PlayerColor.RED, Rotation.NONE, new Pos(0, 1));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withNewTile(t27)
.withNewTile(t37);
var forest56 = (Zone.Forest) t56.zoneWithId(56_1);
var forest27 = (Zone.Forest) t27.zoneWithId(27_3);
var forest37 = (Zone.Forest) t37.zoneWithId(37_0);
var expectedForest = new Area<>(Set.of(forest56, forest27, forest37), List.of(), 0);
assertEquals(Set.of(expectedForest), board.forestsClosedByLastTile());
}
@Test
void boardForestsClosedByLastTileWorksWithOneComplexClosedForest() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), PlayerColor.RED, Rotation.NONE, new Pos(0,0));
var t1 = new PlacedTile(allTiles.get(1), null, Rotation.NONE, new Pos(-1,0));
var t42 = new PlacedTile(allTiles.get(42), PlayerColor.RED, Rotation.NONE, new Pos(-1,1));
var t47 = new PlacedTile(allTiles.get(47), PlayerColor.RED, Rotation.RIGHT, new Pos(1,0));
var t28 = new PlacedTile(allTiles.get(28), PlayerColor.RED, Rotation.RIGHT, new Pos(1,1));
var t58 = new PlacedTile(allTiles.get(58), PlayerColor.RED, Rotation.NONE, new Pos(0,1));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t1)
.withNewTile(t42)
.withNewTile(t47)
.withNewTile(t28)
.withNewTile(t58);
var forest56 = (Zone.Forest) t56.zoneWithId(56_1);
var forest1 = (Zone.Forest) t1.zoneWithId(1_3);
var forest42 = (Zone.Forest) t42.zoneWithId(42_0);
var forest47 = (Zone.Forest) t47.zoneWithId(47_3);
var forest28 = (Zone.Forest) t28.zoneWithId(28_3);
var forest58 = (Zone.Forest) t58.zoneWithId(58_0);
var forestZones = Set.of(forest56, forest1, forest42, forest47, forest28, forest58);
var expectedForest = new Area<>(forestZones, List.of(), 0);
assertEquals(Set.of(expectedForest), board.forestsClosedByLastTile());
}
@Test
void boardForestsClosedByLastTileWorksWithThreeForests() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), PlayerColor.RED, Rotation.NONE, new Pos(0,0));
var t67 = new PlacedTile(allTiles.get(67), PlayerColor.RED, Rotation.NONE, new Pos(0,1));
var t54 = new PlacedTile(allTiles.get(54), PlayerColor.RED, Rotation.NONE, new Pos(1,1));
var t53 = new PlacedTile(allTiles.get(53), PlayerColor.RED, Rotation.NONE, new Pos(2,1));
var t34 = new PlacedTile(allTiles.get(34), PlayerColor.RED, Rotation.NONE, new Pos(2,0));
var t14 = new PlacedTile(allTiles.get(14), PlayerColor.RED, Rotation.NONE, new Pos(1,0));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t67)
.withNewTile(t54)
.withNewTile(t53)
.withNewTile(t34)
.withNewTile(t14);
var forests1 = Set.of(
(Zone.Forest) t56.zoneWithId(56_1),
(Zone.Forest) t67.zoneWithId(67_0),
(Zone.Forest) t14.zoneWithId(14_5));
var forests2 = Set.of(
(Zone.Forest) t67.zoneWithId(67_1),
(Zone.Forest) t54.zoneWithId(54_0),
(Zone.Forest) t14.zoneWithId(14_4));
var forests3 = Set.of(
(Zone.Forest) t34.zoneWithId(34_3),
(Zone.Forest) t14.zoneWithId(14_3));
var forest1 = new Area<>(forests1, List.of(), 0);
var forest2 = new Area<>(forests2, List.of(), 0);
var forest3 = new Area<>(forests3, List.of(), 0);
assertEquals(Set.of(forest1, forest2, forest3), board.forestsClosedByLastTile());
}
@Test
void boardRiversClosedByLastTileWorksWithNoRiverClosed() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.RED, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.RED, Rotation.NONE, new Pos(1, 0));
var board = Board.EMPTY.withNewTile(t56);
assertEquals(Set.of(), board.riversClosedByLastTile());
board = board.withNewTile(t17);
assertEquals(Set.of(), board.riversClosedByLastTile());
board = board.withNewTile(t27);
assertEquals(Set.of(), board.riversClosedByLastTile());
}
@Test
void boardRiversClosedByLastTileWorksWithOneClosedRiver() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t53 = new PlacedTile(allTiles.get(53), PlayerColor.RED, Rotation.NONE, new Pos(-1, 0));
var t86 = new PlacedTile(allTiles.get(86), PlayerColor.RED, Rotation.NONE, new Pos(-2, 0));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t53)
.withNewTile(t86);
var rivers = Set.of(
(Zone.River) t56.zoneWithId(56_3),
(Zone.River) t53.zoneWithId(53_1),
(Zone.River) t86.zoneWithId(86_3));
var expectedRiver = new Area<>(rivers, List.of(), 0);
assertEquals(Set.of(expectedRiver), board.riversClosedByLastTile());
}
@Test
void boardRiversClosedByLastTileWorksWithOneRiverLoop() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), PlayerColor.RED, Rotation.NONE, new Pos(0,0));
var t61 = new PlacedTile(allTiles.get(61), PlayerColor.RED, Rotation.NONE, new Pos(0,-1));
var t3 = new PlacedTile(allTiles.get(3), PlayerColor.RED, Rotation.NONE, new Pos(-1,0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.RED, Rotation.NONE, new Pos(-2,0));
var t15 = new PlacedTile(allTiles.get(15), PlayerColor.RED, Rotation.NONE, new Pos(-2,-1));
var t16 = new PlacedTile(allTiles.get(16), PlayerColor.RED, Rotation.RIGHT, new Pos(-1,-1));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t61)
.withNewTile(t3)
.withNewTile(t17)
.withNewTile(t15)
.withNewTile(t16);
var rivers = Set.of(
(Zone.River) t3.zoneWithId(3_1),
(Zone.River) t3.zoneWithId(3_5),
(Zone.River) t17.zoneWithId(17_1),
(Zone.River) t15.zoneWithId(15_1),
(Zone.River) t16.zoneWithId(16_1));
var expectedRiver = new Area<>(rivers, List.of(), 0);
assertEquals(Set.of(expectedRiver), board.riversClosedByLastTile());
}
@Test
void boardRiversClosedByLastTileWorksWithFourRivers() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), PlayerColor.RED, Rotation.NONE, new Pos(0,0));
var t44 = new PlacedTile(allTiles.get(44), PlayerColor.RED, Rotation.NONE, new Pos(0,-1));
var t58 = new PlacedTile(allTiles.get(58), PlayerColor.RED, Rotation.NONE, new Pos(-1,-1));
var t60 = new PlacedTile(allTiles.get(60), PlayerColor.RED, Rotation.NONE, new Pos(-2,-1));
var t2 = new PlacedTile(allTiles.get(2), PlayerColor.RED, Rotation.NONE, new Pos(-2,0));
var t42 = new PlacedTile(allTiles.get(42), PlayerColor.RED, Rotation.NONE, new Pos(-2,1));
var t0 = new PlacedTile(allTiles.get(0), PlayerColor.RED, Rotation.NONE, new Pos(-1,1));
var t13 = new PlacedTile(allTiles.get(13), PlayerColor.RED, Rotation.NONE, new Pos(-1,0));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t44)
.withNewTile(t58)
.withNewTile(t60)
.withNewTile(t2)
.withNewTile(t42)
.withNewTile(t0)
.withNewTile(t13);
var rivers1 = Set.of(
(Zone.River) t56.zoneWithId(56_3),
(Zone.River) t13.zoneWithId(13_3));
var rivers2 = Set.of(
(Zone.River) t0.zoneWithId(1),
(Zone.River) t13.zoneWithId(13_5));
var rivers3 = Set.of(
(Zone.River) t2.zoneWithId(2_1),
(Zone.River) t13.zoneWithId(13_7));
var rivers4 = Set.of(
(Zone.River) t58.zoneWithId(58_2),
(Zone.River) t13.zoneWithId(13_1));
var expectedRivers = Set.of(
new Area<>(rivers1, List.of(), 0),
new Area<>(rivers2, List.of(), 0),
new Area<>(rivers3, List.of(), 0),
new Area<>(rivers4, List.of(), 0));
assertEquals(expectedRivers, board.riversClosedByLastTile());
}
@Test
void boardCouldPlaceTileWorksWhenTileCanBePlaced() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var board = Board.EMPTY.withNewTile(t56);
for (var tile : allTiles) {
if (tile.id() == 56) continue;
assertTrue(board.couldPlaceTile(tile));
}
}
@Test
void boardCouldPlaceTileWorksWhenTileCannotBePlaced() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t65 = new PlacedTile(allTiles.get(65), null, Rotation.NONE, new Pos(0, -1));
var t2 = new PlacedTile(allTiles.get(2), null, Rotation.NONE, new Pos(-1, 0));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t65); // block meadow
for (var tileId : List.of(61, 62, 85))
assertFalse(board.couldPlaceTile(allTiles.get(tileId)));
var board2 = Board.EMPTY
.withNewTile(t56)
.withNewTile(t2); // block river
for (var tileId : List.of(13, 17, 83))
assertFalse(board2.couldPlaceTile(allTiles.get(tileId)));
}
@Test
void boardCanAddTileWorksForOutsideOfBordOrOccupiedPositions() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t65 = new PlacedTile(allTiles.get(65), null, Rotation.NONE, new Pos(0, -1));
// t2 is outside of board
var t2 = new PlacedTile(allTiles.get(2), null, Rotation.NONE, new Pos(13, 13));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t65);
assertFalse(board.canAddTile(t56));
assertFalse(board.canAddTile(t65));
assertFalse(board.canAddTile(t2));
}
@Test
void boardCanAddTileWorksForPositionsWithoutNeighbors() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
// t65 and t2 are not next to the t56
var t65 = new PlacedTile(allTiles.get(65), null, Rotation.NONE, new Pos(0, -2));
var t2 = new PlacedTile(allTiles.get(2), null, Rotation.NONE, new Pos(1, 1));
var board = Board.EMPTY
.withNewTile(t56);
assertFalse(board.canAddTile(t65));
assertFalse(board.canAddTile(t2));
}
@Test
void boardCanAddTileWorksForVariousRotations() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t0 = allTiles.get(0);
var board = Board.EMPTY
.withNewTile(t56);
record PosRot(Pos pos, Rotation rotation) {}
var validPositionsAndRotations = Set.of(
new PosRot(new Pos(1, 0), Rotation.NONE),
new PosRot(new Pos(1, 0), Rotation.RIGHT),
new PosRot(new Pos(0, 1), Rotation.RIGHT),
new PosRot(new Pos(0, 1), Rotation.HALF_TURN),
new PosRot(new Pos(-1, 0), Rotation.RIGHT),
new PosRot(new Pos(0, -1), Rotation.RIGHT));
for (var rotation : Rotation.ALL) {
for (var pos : List.of(new Pos(1, 0), new Pos(0, 1), new Pos(-1, 0), new Pos(0, -1))) {
var tile = new PlacedTile(t0, null, rotation, pos);
assertEquals(
validPositionsAndRotations.contains(new PosRot(pos, rotation)),
board.canAddTile(tile));
}
}
}
// No explicit test for `withNewTile`, which is used extensively by other tests
@Test
void boardWithOccupantAddsOccupantToBoardAndPartition() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.BLUE, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.GREEN, Rotation.NONE, new Pos(1, 0));
var occupant17 = new Occupant(Occupant.Kind.PAWN, 17_0);
var occupant27 = new Occupant(Occupant.Kind.PAWN, 27_3);
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withOccupant(occupant17)
.withNewTile(t27)
.withOccupant(occupant27);
var occupiedMeadow = board.meadowArea((Zone.Meadow) t17.zoneWithId(17_0));
assertEquals(List.of(PlayerColor.BLUE), occupiedMeadow.occupants());
assertEquals(occupant17, board.tileWithId(17).occupant());
var occupiedForest = board.forestArea((Zone.Forest) t27.zoneWithId(27_3));
assertEquals(List.of(PlayerColor.GREEN), occupiedForest.occupants());
assertEquals(occupant27, board.tileWithId(27).occupant());
}
@Test
void boardWithoutOccupantRemovesOccupantFromBoardAndPartition() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.BLUE, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.GREEN, Rotation.NONE, new Pos(-2, 0));
var occupant17 = new Occupant(Occupant.Kind.PAWN, 17_3);
var occupant27 = new Occupant(Occupant.Kind.HUT, 27_1);
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withOccupant(occupant17)
.withNewTile(t27)
.withOccupant(occupant27)
.withoutOccupant(occupant17);
var unoccupiedRiver = board.riverArea((Zone.River) t17.zoneWithId(17_3));
assertEquals(List.of(), unoccupiedRiver.occupants());
assertNull(board.tileWithId(17).occupant());
var occupiedRiverSystem = board.riverSystemArea((Zone.River) t17.zoneWithId(17_3));
assertEquals(List.of(PlayerColor.GREEN), occupiedRiverSystem.occupants());
assertEquals(occupant27, board.tileWithId(27).occupant());
}
@Test
void boardWithoutGatherersOrFishersInWorksWithForest() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0,0));
var t1 = new PlacedTile(allTiles.get(1), PlayerColor.RED, Rotation.NONE, new Pos(-1,0));
var t42 = new PlacedTile(allTiles.get(42), PlayerColor.GREEN, Rotation.NONE, new Pos(-1,1));
var t47 = new PlacedTile(allTiles.get(47), PlayerColor.BLUE, Rotation.RIGHT, new Pos(1,0));
var t28 = new PlacedTile(allTiles.get(28), PlayerColor.YELLOW, Rotation.RIGHT, new Pos(1,1));
var t58 = new PlacedTile(allTiles.get(58), PlayerColor.PURPLE, Rotation.NONE, new Pos(0,1));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t1)
.withOccupant(new Occupant(Occupant.Kind.PAWN, 1_3)) // gatherer
.withNewTile(t42)
.withOccupant(new Occupant(Occupant.Kind.PAWN, 42_1)) // hunter
.withNewTile(t47)
.withOccupant(new Occupant(Occupant.Kind.PAWN, 47_3)) // gatherer
.withNewTile(t28)
.withOccupant(new Occupant(Occupant.Kind.PAWN, 28_3)) // gatherer
.withNewTile(t58);
var forest56 = (Zone.Forest) t56.zoneWithId(56_1);
var meadow42 = (Zone.Meadow) t42.zoneWithId(42_1);
var occupiedForest = board.forestArea(forest56);
assertEquals(
List.of(PlayerColor.RED, PlayerColor.BLUE, PlayerColor.YELLOW),
occupiedForest.occupants());
assertEquals(List.of(PlayerColor.GREEN), board.meadowArea(meadow42).occupants());
var board1 = board.withoutGatherersOrFishersIn(Set.of(occupiedForest), Set.of());
assertEquals(List.of(), board1.forestArea(forest56).occupants());
assertEquals(List.of(PlayerColor.GREEN), board1.meadowArea(meadow42).occupants());
}
@Test
void boardWithMoreCancelledAnimalsWorks() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.BLUE, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.GREEN, Rotation.NONE, new Pos(1, 0));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withNewTile(t27);
var animalsToCancel = List.of(
new Animal(17_4_0, Animal.Kind.TIGER),
new Animal(56_0_0, Animal.Kind.AUROCHS),
new Animal(27_2_0, Animal.Kind.DEER),
new Animal(17_2_0, Animal.Kind.DEER));
for (int i = 0; i < animalsToCancel.size(); i += 1) {
assertEquals(Set.copyOf(animalsToCancel.subList(0, i)), board.cancelledAnimals());
board = board.withMoreCancelledAnimals(Set.of(animalsToCancel.get(i)));
}
assertEquals(Set.copyOf(animalsToCancel), board.cancelledAnimals());
}
@Test
void boardEqualsComparesByStructure() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.BLUE, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.GREEN, Rotation.NONE, new Pos(1, 0));
var board1 = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withNewTile(t27);
var board2 = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withNewTile(t27);
assertEquals(board1, board2);
}
@Test
void boardEqualsComparesAllComponents() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.BLUE, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.GREEN, Rotation.NONE, new Pos(1, 0));
var board = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17);
assertNotEquals(board, board.withNewTile(t27));
assertNotEquals(board, board.withOccupant(new Occupant(Occupant.Kind.PAWN, 17_0)));
assertNotEquals(board, board.withMoreCancelledAnimals(Set.of(new Animal(17_4_0, Animal.Kind.TIGER))));
var board1 = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withNewTile(t27);
var board2 = Board.EMPTY
.withNewTile(t56)
.withNewTile(t27)
.withNewTile(t17);
assertNotEquals(board1, board2);
}
@Test
void boardHashcodeHashedByStructure() {
var allTiles = allTiles();
var t56 = new PlacedTile(allTiles.get(56), null, Rotation.NONE, new Pos(0, 0));
var t17 = new PlacedTile(allTiles.get(17), PlayerColor.BLUE, Rotation.NONE, new Pos(-1, 0));
var t27 = new PlacedTile(allTiles.get(27), PlayerColor.GREEN, Rotation.NONE, new Pos(1, 0));
var board1 = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withNewTile(t27);
var board2 = Board.EMPTY
.withNewTile(t56)
.withNewTile(t17)
.withNewTile(t27);
assertEquals(board1.hashCode(), board2.hashCode());
}
//<editor-fold desc="Tiles">
private static List<Tile> allTiles() {
ArrayList<Tile> tiles = new ArrayList<>();
{ // Tile 0
var l1 = new Zone.Lake(/*0_*/8, 2, null);
var z0 = new Zone.Meadow(/*0_*/0, List.of(), null);
var z1 = new Zone.River(/*0_*/1, 0, l1);
var z2 = new Zone.Meadow(/*0_*/2, List.of(), null);
var z3 = new Zone.Forest(/*0_*/3, Zone.Forest.Kind.PLAIN);
var z4 = new Zone.Forest(/*0_*/4, Zone.Forest.Kind.PLAIN);
var sN = new TileSide.River(z0, z1, z2);
var sE = new TileSide.Meadow(z2);
var sS = new TileSide.Forest(z3);
var sW = new TileSide.Forest(z4);
tiles.add(new Tile(0, Tile.Kind.NORMAL, sN, sE, sS, sW));
}
{ // Tile 1
var l1 = new Zone.Lake(1_8, 3, null);
var z0 = new Zone.Meadow(1_0, List.of(), null);
var z1 = new Zone.River(1_1, 0, l1);
var z2 = new Zone.Meadow(1_2, List.of(), null);
var z3 = new Zone.Forest(1_3, Zone.Forest.Kind.PLAIN);
var z4 = new Zone.Meadow(1_4, List.of(), null);
var z5 = new Zone.River(1_5, 0, l1);
var sN = new TileSide.Meadow(z0);
var sE = new TileSide.River(z0, z1, z2);
var sS = new TileSide.Forest(z3);
var sW = new TileSide.River(z4, z5, z0);
tiles.add(new Tile(1, Tile.Kind.NORMAL, sN, sE, sS, sW));
}
{ // Tile 2
var l1 = new Zone.Lake(2_8, 1, null);
var z0 = new Zone.Meadow(2_0, List.of(), null);
var z1 = new Zone.River(2_1, 0, l1);
var z2 = new Zone.Meadow(2_2, List.of(), null);
var z3 = new Zone.Forest(2_3, Zone.Forest.Kind.WITH_MENHIR);
var sN = new TileSide.Meadow(z0);
var sE = new TileSide.River(z0, z1, z2);
var sS = new TileSide.Forest(z3);
var sW = new TileSide.Forest(z3);
tiles.add(new Tile(2, Tile.Kind.NORMAL, sN, sE, sS, sW));
}
{ // Tile 3
var l1 = new Zone.Lake(3_8, 1, null);
var z0 = new Zone.Meadow(3_0, List.of(), null);
var z1 = new Zone.River(3_1, 0, l1);
var z2 = new Zone.Meadow(3_2, List.of(), null);
var z3 = new Zone.River(3_3, 0, l1);
var z4 = new Zone.Meadow(3_4, List.of(), null);
var z5 = new Zone.River(3_5, 0, l1);
var sN = new TileSide.River(z0, z1, z2);