-
Notifications
You must be signed in to change notification settings - Fork 0
/
Strategy.java
689 lines (609 loc) · 27.6 KB
/
Strategy.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
package strategy;
import model.*;
import java.util.*;
import static model.Constants.*;
public class Strategy {
private static List<Point> availableMoves = new ArrayList<>(3);
private static List<Point> line = new ArrayList<>();
private static Result best = new Result();
private static HashMap<IdentityHashMap<Point, Integer>, Double> fillCash;
public static String findMove(World world, Random random) {
return randomSearch(world, random).name().toLowerCase();
}
private static Direction randomSearch(World world, Random random) {
fillCash = new HashMap<>();
long start = System.currentTimeMillis();
prepareEnemies(world);
double minEnemyLineDistance = getMinEnemyLineDistance(world.opponents, world.me.line.keySet());
findSawDangerPoints(world);
refreshBest(world, best, minEnemyLineDistance);
int n = 0;
int lastChange = 0;
int timeLimit = Process.timeLeft / (world.remainingTicks + 20);
while ((System.currentTimeMillis() - start < timeLimit || n < 100) && n - lastChange < CHANGE_CUT) {
Result result = tryBranch(world, random, minEnemyLineDistance);
if (result.score > best.score) {
best = result;
lastChange = n;
}
n++;
}
Process.timeLeft -= System.currentTimeMillis() - start;
Process.debug += String.format("n: %d; lastChange: %d; cash: %d; score: %.2f; track: %d; med: %.2f; bfs: %s; timeLeft: %d, %s",
n, lastChange, fillCash.size(), best.score, best.track.size(), minEnemyLineDistance, best.addSearch,
Process.timeLeft / Math.max(1, world.remainingTicks), printTrack(world.me.position, best.track));
return world.me.position.directionTo(best.track.get(0));
}
private static String printTrack(Point position, List<Point> track) {
String res = "";
Point point = position;
for (Point next : track) {
res += point.directionTo(next).name().substring(0, 1).toLowerCase();
point = next;
}
return res;
}
private static List<Point> findPath(Player player, World world, Point target) {
List<Point> result = new ArrayList<>();
boolean[][] visited = new boolean[world.height][world.width];
IdentityHashMap<Point, Point> edgeTo = new IdentityHashMap<>();
Point edge = player.position;
ArrayDeque<Point> queue = new ArrayDeque<>();
queue.add(edge);
visited[edge.y][edge.x] = true;
Direction headDirection = player.direction;
while (!queue.isEmpty()) {
Point point = queue.removeFirst();
Point from = edgeTo.get(point);
if (from != null) {
headDirection = from.directionTo(point);
}
for (Direction direction : Direction.nextDirections(headDirection)) {
Point next = point.move(direction);
if (next == null || visited[next.y][next.x] || player.line.containsKey(next)) {
continue;
}
edgeTo.put(next, point);
queue.add(next);
visited[next.y][next.x] = true;
if (target == next) {
do {
result.add(next);
next = edgeTo.get(next);
} while (next != null && next != edge);
Collections.reverse(result);
return result;
}
}
}
return result;
}
private static void prepareEnemies(World world) {
for (Player player : world.opponents) {
fillDistances(world, player);
fillCaptures(world, player);
}
}
private static void fillCaptures(World world, Player player) {
for (Point point : player.territory.keySet()) {
if (player.getDistance(point) > 10 || player.getDistance(point) == 0) {
continue;
}
List<Point> path = findPath(player, world, point);
if (path.size() < player.minCaptureTime) {
player.minCaptureTime = path.size();
}
Point prevBase = path.size() == 1 ? player.position : path.get(path.size() - 2);
if (!player.territory.containsKey(prevBase)) {
//нужны только пути, конечная точка которых пришла с чужой территории
player.paths.add(path);
path.forEach(player::putLine);
List<Bonus> bonuses = new ArrayList<>();
calcFill(world, player, bonuses);
if (path.size() <= 5 && bonuses.stream().anyMatch(b -> b.type == Bonus.Type.NITRO)) {
Bonus bonus = new Bonus();
bonus.type = Bonus.Type.NITRO;
bonus.time = 50;
player.bonuses.add(bonus);
}
player.captures.add(new IdentityHashMap<>(player.currentPlanedCapture));
player.currentPlanedCapture.clear();
fillCash.clear();
path.forEach(p->player.line.remove(p));
}
}
}
private static void fillDistances(World world, Player player) {
boolean[][] visited = new boolean[world.height][world.width];
Point edge = player.position;
IdentityHashMap<Point, Point> edgeTo = new IdentityHashMap<>();
ArrayDeque<Point> queue = new ArrayDeque<>();
ArrayDeque<Point> nextQueue = new ArrayDeque<>();
queue.add(edge);
visited[edge.y][edge.x] = true;
int distance = 0;
Direction headDirection = player.direction;
while (!queue.isEmpty()) {
Point point = queue.removeFirst();
Point from = edgeTo.get(point);
player.distances.put(point, distance);
if (from != null) {
headDirection = from.directionTo(point);
}
for (Direction direction : Direction.nextDirections(headDirection)) {
Point next = point.move(direction);
if (next == null || visited[next.y][next.x] || player.line.containsKey(next)) {
continue;
}
nextQueue.add(next);
visited[next.y][next.x] = true;
edgeTo.put(next, point);
}
if (queue.isEmpty()) {
queue.addAll(nextQueue);
nextQueue.clear();
distance ++;
}
}
}
private static void refreshBest(World world, Result best, double minEnemyDistance) {
if (best.track.size() < 3) {
best.score = -Double.MAX_VALUE;
best.track.clear();
return;
}
best.track.remove(0);
line.clear();
Player me = world.me;
Point start = me.position;
Direction startDirection = me.direction;
for (Point point : best.track) {
if (!me.territory.containsKey(point)) {
line.add(point);
me.putLine(point);
}
}
me.direction = best.track.get(best.track.size() - 2).directionTo(best.track.get(best.track.size() - 1));
if (getAvailableMoves(world).size() > 0) {
me.position = best.track.get(best.track.size() - 1);
} else {
me.position = null;
}
best.score = calcScore(world, best.track, minEnemyDistance);
rollback(world, line, start, startDirection);
}
private static double getMinEnemyLineDistance(List<Player> opponents, Iterable<Point> line) {
double minEnemyLineDistance = 500;
for (Player enemy : opponents) {
Bonus bonus = enemy.bonuses.stream().filter(b -> b.type != Bonus.Type.SAW).findAny().orElse(null);
for (Point point : line) {
double distance = getTimeToPoint(enemy, bonus, point);
if (distance < minEnemyLineDistance) {
minEnemyLineDistance = distance;
}
}
}
return minEnemyLineDistance;
}
private static double getTimeToPoint(Player player, Bonus speedBonus, Point point) {
double distance = (player.minCaptureTime <= 2 ? player.position.distanceTo(point) : player.getDistance(point))
+ player.addTime;
distance = updateTimeWithBonus(speedBonus, distance);
return distance;
}
private static double updateTimeWithBonus(Bonus speedBonus, double distance) {
if (speedBonus != null) {
double k = speedBonus.type == Bonus.Type.SLOW ? Constants.SLOW : Constants.NITRO;
distance = Math.min(distance, speedBonus.time) * k + Math.max(0, distance - speedBonus.time);
}
return distance;
}
private static Result tryBranch(World world, Random random, double enemyDistance) {
Result result = new Result();
line.clear();
Player me = world.me;
me.currentPlanedCapture.clear();
Point start = me.position;
Direction startDirection = me.direction;
int len = 0;
boolean outOfTerritory = !me.territory.containsKey(me.position);
double score = 0;
while (len <= MAX_LEN && len < world.remainingTicks && me.position != null && (!me.territory.containsKey(me.position) || !outOfTerritory)) {
Point nextInSameDir = me.direction == null ? null : me.position.move(me.direction);
List<Point> moves = getAvailableMoves(world);
Point move = null;
if (moves.size() > 0) {
//Если разрешено движение вперед, то с вероятностью 1/2 выбираем его
if (nextInSameDir != null && !me.line.containsKey(nextInSameDir) && random.nextInt(2) < 1) {
move = nextInSameDir;
} else {
//иначе выбираем случайное движение из всех возможных, в том числе и вперед
int index = random.nextInt(moves.size());
move = moves.get(index);
}
me.direction = me.position.directionTo(move);
result.track.add(move);
if (!me.territory.containsKey(move)) {
me.line.put(move, 1);
line.add(move);
}
if (!outOfTerritory && !me.territory.containsKey(move)) {
outOfTerritory = true;
}
}
me.position = move;
len++;
}
if (world.me.position != null && !world.me.territory.containsKey(world.me.position)) {
List<Point> trackToBase = findShortestPathToBase(world, world.me, result.track.size());
for (int i = 0; i < trackToBase.size(); i++) {
Point next = trackToBase.get(i);
if (!world.me.territory.containsKey(next)) {
world.me.putLine(next);
line.add(next);
} else {
world.me.direction = i == 0 ? world.me.position.directionTo(next) : trackToBase.get(i - 1).directionTo(next);
world.me.position = next;
}
result.track.add(next);
}
result.addSearch = true;
}
score += calcScore(world, result.track, enemyDistance);
rollback(world, line, start, startDirection);
result.score = score;
return result;
}
private static int outOfCapture(World world, Player player, IdentityHashMap<Point, Integer> capture, boolean toBase) {
boolean[][] visited = new boolean[world.height][world.width];
IdentityHashMap<Point, Point> edgeTo = new IdentityHashMap<>();
Point edge = player.position;
ArrayDeque<Point> queue = new ArrayDeque<>();
queue.add(edge);
visited[edge.y][edge.x] = true;
Direction headDirection = player.direction;
while (!queue.isEmpty()) {
Point point = queue.removeFirst();
Point from = edgeTo.get(point);
if (from != null) {
headDirection = from.directionTo(point);
}
for (Direction direction : Direction.nextDirections(headDirection)) {
Point next = point.move(direction);
if (next == null || visited[next.y][next.x]) {
continue;
}
queue.add(next);
visited[next.y][next.x] = true;
edgeTo.put(next, point);
if (!capture.containsKey(next) && (player.territory.containsKey(next) || !toBase)) {
int result = 0;
do {
result ++;
next = edgeTo.get(next);
} while (next != null && next != edge);
return result;
}
}
}
return 500;
}
private static List<Point> findShortestPathToBase(World world, Player player, int len) {
List<Point> result = new ArrayList<>();
boolean[][] visited = new boolean[world.height][world.width];
IdentityHashMap<Point, Point> edgeTo = new IdentityHashMap<>();
Point edge = player.position;
ArrayDeque<Point> queue = new ArrayDeque<>();
queue.add(edge);
visited[edge.y][edge.x] = true;
Direction headDirection = player.direction;
while (!queue.isEmpty()) {
Point point = queue.removeFirst();
Point from = edgeTo.get(point);
if (from != null) {
headDirection = from.directionTo(point);
}
for (Direction direction : Direction.nextDirections(headDirection)) {
Point next = point.move(direction);
if (next == null || visited[next.y][next.x] || player.line.containsKey(next)) {
continue;
}
queue.add(next);
visited[next.y][next.x] = true;
edgeTo.put(next, point);
if (player.territory.containsKey(next)) {
do {
result.add(next);
next = edgeTo.get(next);
} while (next != null && next != edge);
if (result.size() + len > world.remainingTicks) {
result.clear();
return result;
}
Collections.reverse(result);
return result;
}
}
}
return result;
}
private static double calcScore(World world, List<Point> track, double enemyDistance) {
double score = 0;
List<Bonus> bonuses = new ArrayList<>();
if (world.me.position == null) {
//некуда ходить
score = STACK_BONUS;
} else if (!world.me.territory.containsKey(world.me.position)) {
//не замкнули
score = scoreDistanceToBase(world);
} else if (world.me.line.isEmpty()) {
//не вышли из территории
/*int shortest = track.isEmpty() ? 0 : track.get(0).distanceTo(track.get(track.size() - 1));
if (shortest + 1 < track.size()) {
//болтались без толку по территории
score = -100 * (track.size() - (shortest + 1));
}*/
score += world.influenceMap[track.get(0).y][track.get(0).x] / 100;
} else {
double fill = calcFill(world, world.me, bonuses);
score = fill * fill / Math.max(track.size(), world.me.line.size()) /*/ Math.max(1, (world.me.line.size() - NON_FINED_LEN) / LINE_FINE_DIVIDER)*/
+ calcLineMaxInfluenceBonus(world);
}
for (Bonus bonus : world.bonuses.values()) {
if (track.contains(bonus.position)) {
bonuses.add(bonus);
}
}
score += calcEnemyCollision(world, track) + calcBonuses(bonuses) + calcEnemyCapture(world, track)
+ (track.isEmpty() ? 0 : calcSawDanger(world, track.get(0)));
enemyDistance = Math.min(enemyDistance,
getMinEnemyLineDistance(world.opponents, line));
int len = track.size();
Bonus myBonus = world.me.bonuses.stream().filter(b -> b.type != Bonus.Type.SAW).findAny().orElse(null);
if (myBonus != null) {
double k = myBonus.type == Bonus.Type.SLOW ? Constants.SLOW : Constants.NITRO;
len = (int) Math.ceil(Math.min(track.size(), myBonus.time) * k) + Math.max(0, track.size() - myBonus.time);
}
if (len + TAIL_BUFFER > enemyDistance) {
if (score > 0) {
score /= 100;
}
if (!world.me.territory.containsKey(world.me.position)) {
score += STACK_BONUS;
} else {
score -= (len + TAIL_BUFFER - enemyDistance) * FILL_MULTI * FILL_OTHER_BONUS * 10;
}
}
return score;
}
private static double calcSawDanger(World world, Point next) {
double score = 0;
for (Map.Entry<Point, Direction> entry : world.sawDanger.entrySet()) {
if (Direction.UP == entry.getValue() && entry.getKey().x == next.x && entry.getKey().y < next.y
|| Direction.DOWN == entry.getValue() && entry.getKey().x == next.x && entry.getKey().y > next.y
|| Direction.RIGHT == entry.getValue() && entry.getKey().y == next.y && entry.getKey().x < next.x
|| Direction.LEFT == entry.getValue() && entry.getKey().y == next.y && entry.getKey().x > next.x) {
score += STACK_BONUS / 10;
}
}
return score;
}
private static void findSawDangerPoints(World world) {
for (Point point : world.bonuses.keySet()) {
Bonus bonus = world.bonuses.get(point);
if (bonus.type != Bonus.Type.SAW) {
continue;
}
for (Player player : world.opponents) {
if (player.position.distanceTo(point) == 1 && player.direction != point.directionTo(player.position)) {
world.sawDanger.put(point, player.position.directionTo(point));
}
}
}
}
private static double calcEnemyCapture(World world, List<Point> track) {
double min = 0;
for (Player player : world.opponents) {
for (int i = 0; i < player.paths.size(); i++) {
List<Point> path = player.paths.get(i);
IdentityHashMap<Point, Integer> capture = player.captures.get(i);
if (track.size() >= path.size() && capture.containsKey(track.get(path.size() - 1))) {
//окружили голову, нам конец
min = Math.min(STACK_BONUS / path.size(), min);
}
if (track.size() >= path.size() && capture.containsKey(world.me.position)) {
//отъел базу, куда мы собирались
min = Math.min(min, STACK_BONUS / 3 / path.size());
}
//теперь ситуация, когда мы зашли на территорию до окружения
if (capture.containsKey(world.me.position) && !world.me.currentPlanedCapture.containsKey(path.get(path.size() - 1))) {
//и вся территория окружена
if (world.me.currentPlanedCapture.keySet().stream().allMatch(capture::containsKey)) {
//и не успеваем с нее уйти
if (track.size() + outOfCapture(world, world.me, capture, true) >= path.size()) {
min = Math.min(STACK_BONUS / path.size(), min);
}
}
}
}
}
return min;
}
private static double scoreDistanceToBase(World world) {
if (world.me.territory.size() == 0) {
return world.influenceMap[world.me.position.y][world.me.position.x] / world.me.line.size();
}
int minDistance = 100500;
for (Point point : world.me.territory.keySet()) {
int distance = point.distanceTo(world.me.position);
if (distance < minDistance) {
minDistance = distance;
}
}
return 1. / minDistance;
}
private static double calcBonuses(List<Bonus> bonuses) {
double score = 0;
for (Bonus bonus : bonuses) {
if (bonus.type == Bonus.Type.SLOW) {
score -= 500;
} else {
score += 25;
}
}
return score;
}
private static double calcEnemyCollision(World world, List<Point> track) {
for (Player player : world.opponents) {
if (world.me.startPosition.distanceTo(player.position) == 1 && player.line.size() <= world.me.line.size()) {
Direction directionToEnemy = world.me.startPosition.directionTo(player.position);
Direction firstDirection = world.me.startPosition.directionTo(track.get(0));
if (directionToEnemy == firstDirection) {
return STACK_BONUS;
} else if (directionToEnemy.opposite() != firstDirection) {
return STACK_BONUS / 10;
}
}
double trackTime = updateTimeWithBonus(world.me.speedBonus, track.size());
//Для отсечения проверим простой дистанцией, округление кверху, потому что даже пересечение кусочком убивает
if (Math.floor(updateTimeWithBonus(player.speedBonus, player.getDistance(world.me.position)+ player.addTime)) <= trackTime) {
List<Point> pathToEnd = findPath(player, world, world.me.position);
if (updateTimeWithBonus(player.speedBonus, pathToEnd.size()) <= trackTime
&& getLineSizeTo(pathToEnd, player) <= world.me.line.size() + line.size()) {
return STACK_BONUS / 10;
}
}
if (track.size() > 1) {
if (Math.floor(updateTimeWithBonus(player.speedBonus, player.getDistance(track.get(track.size() - 2)) + player.addTime)) <= trackTime) {
List<Point> pathToPreEnd = findPath(player, world, track.get(track.size() - 2));
if (updateTimeWithBonus(player.speedBonus, pathToPreEnd.size()) <= trackTime
&& getLineSizeTo(pathToPreEnd, player) <= world.me.line.size() + line.size()) {
return STACK_BONUS / 10;
}
}
}
}
return 0;
}
private static int getLineSizeTo(List<Point> path, Player player) {
int len = 0;
boolean terr = false;
if (path.size() > 1) {
for (int i = path.size() - 2; i >= 0; i--) {
Point point = path.get(i);
if (player.territory.containsKey(point)) {
terr = true;
break;
}
len ++;
}
}
if (!terr) {
len += player.line.size();
}
return len;
}
private static double calcLineMaxInfluenceBonus(World world) {
double score = 0;
for (Point point : world.me.line.keySet()) {
score = Math.max(world.influenceMap[point.y][point.x], score);
}
return score;
}
static double calcFill(World world, Player player, List<Bonus> catchBonuses) {
Double cashed = fillCash.get(player.line);
if (cashed != null) {
return cashed;
}
boolean[][] visited = new boolean[world.height][world.width];
//fill all other area
fillAllOtherArea(player, visited);
//Посчитаем захват
double area = fillMyArea(world, player, visited, catchBonuses);
if (world.me == player) {
fillCash.put(new IdentityHashMap<>(player.line), area);
}
return area;
}
private static double fillMyArea(World world, Player player, boolean[][] visited, List<Bonus> catchBonuses) {
double score = 0;
ArrayDeque<Point> queue = new ArrayDeque<>();
for (Point terr : player.line.keySet()) {
if (visited[terr.y][terr.x]) {
continue;
}
queue.add(terr);
visited[queue.getFirst().y][queue.getFirst().x] = true;
while (!queue.isEmpty()) {
Point point = queue.removeFirst();
if (!player.territory.containsKey(point)) {
player.currentPlanedCapture.put(point, 1);
}
if (player == world.me) {
if (world.opponentsTerritory.containsKey(point)) {
score += Constants.FILL_OTHER_BONUS;
} else if (!player.territory.containsKey(point)) {
score += Constants.FILL_BONUS;
}
}
if (world.bonuses.containsKey(point) && !player.territory.containsKey(point) && !player.line.containsKey(point)) {
catchBonuses.add(world.bonuses.get(point));
}
for (Direction direction : Direction.directions) {
Point next = point.move(direction);
if (next == null || visited[next.y][next.x] || player.territory.containsKey(next)) {
continue;
}
queue.add(next);
visited[next.y][next.x] = true;
}
}
}
return score;
}
private static void fillAllOtherArea(Player player, boolean[][] visited) {
for (Point edge : Point.edges) {
if (visited[edge.y][edge.x] || player.territory.containsKey(edge) || player.line.containsKey(edge)) {
continue;
}
ArrayDeque<Point> queue = new ArrayDeque<>();
queue.add(edge);
visited[edge.y][edge.x] = true;
while (!queue.isEmpty()) {
Point point = queue.removeFirst();
for (Direction direction : Direction.directions) {
Point next = point.move(direction);
if (next == null || visited[next.y][next.x] || player.line.containsKey(next) || player.territory.containsKey(next)) {
continue;
}
queue.add(next);
visited[next.y][next.x] = true;
}
}
}
}
private static void rollback(World world, List<Point> line, Point start, Direction startDirection) {
for (int i = 0; i < line.size(); i++) {
world.me.line.remove(line.get(i));
}
world.me.position = start;
world.me.direction = startDirection;
}
public static List<Point> getAvailableMoves(World world) {
availableMoves.clear();
Player me = world.me;
Direction[] directions = Direction.nextDirections(me.direction);
for (Direction direction : directions) {
Point point = me.position.move(direction);
if (point != null && !me.line.containsKey(point)) {
availableMoves.add(point);
}
}
return availableMoves;
}
public static class Result {
List<Point> track = new ArrayList<>();
double score;
boolean addSearch = false;
}
}