-
Notifications
You must be signed in to change notification settings - Fork 2
/
ai.c
2571 lines (2169 loc) · 74.5 KB
/
ai.c
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
////////////////////////////////////////
//
// File : ai.c
// CoSpace Robot
// Version 1.0.0
// Jan 1 2016
// Copyright (C) 2016 CoSpace Robot. All Rights Reserved
//
//////////////////////////////////////
//
// ONLY C Code can be compiled.
//
/////////////////////////////////////
#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnusedImportStatement"
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
#define CsBot_AI_H//DO NOT delete this line
#ifndef CSBOT_REAL
#include <windows.h>
#endif
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include <stdlib.h>
#include <float.h>
#define DLL_EXPORT extern __declspec(dllexport)
#define false 0
#define true 1
#define NONE (-1)
#define E_A 0
#define E_B 1
#define E_C 3
#define CsBot_AI_C //DO NOT delete this line
typedef int bool;
//The robot ID : It must be two char, such as '00','kl' or 'Cr'.
char AI_MyID[2] = {'1', '0'};
double toRange(double value, double mmin, double mmax);
double direction_normalize(double value);
/***
* ######## ## ## ######## ######## ######
* ## ## ## ## ## ## ## ##
* ## #### ## ## ## ##
* ## ## ######## ###### ######
* ## ## ## ## ##
* ## ## ## ## ## ##
* ## ## ## ######## ######
*/
typedef struct {
double x, y;
} Vector;
Vector new_vector(double xa, double ya) {
Vector v;
v.x = xa;
v.y = ya;
return v;
}
typedef struct {
int xa, ya, xb, yb;
} Area;
Area new_area(int xa, int ya, int xb, int yb) {
Area v;
v.xa = min(xa, xb);
v.ya = min(ya, yb);
v.xb = max(xa, xb);
v.yb = max(ya, yb);
return v;
}
typedef struct {
int count;
Area areas[10];
} AreaGroup;
typedef double Direction;
Direction new_Direction(double value) {
return value;
}
typedef struct {
Vector point;
double radius;
} Anchor;
Anchor new_Anchor(Vector point, double radius) {
Anchor v;
v.point = point;
v.radius = radius;
return v;
}
typedef struct {
Vector point;
double radius;
Direction direction;
} FlowPoint;
FlowPoint new_FlowPoint(Vector point, double radius, Direction direction) {
FlowPoint v;
v.point = point;
v.radius = radius;
v.direction = direction;
return v;
}
typedef struct {
Anchor pa;
Anchor pb;
} FlowLine;
FlowLine new_FlowLine(Anchor pa, Anchor pb) {
FlowLine v;
v.pa = pa;
v.pb = pb;
return v;
}
typedef struct {
int count;
Vector points[30];
} Route;
typedef struct {
bool withEnd;
int count;
Anchor points[25];
} FlowRoute;
typedef struct {
double randomnessSize;
int anchorCount;
Anchor anchors[20];
FlowLine flowLines[20];
int flowPointCount;
FlowPoint flowPoints[100];
int routeCount;
FlowRoute flowRoutes[15];
} Environment;
typedef struct {
Vector a;
Vector b;
} Wall;
Wall new_Wall(Vector a, Vector b) {
Wall v;
v.a = a;
v.b = b;
return v;
};
typedef struct {
Area area;
Area entry;
Route route;
} SuperobjectRule;
typedef struct {
FlowPoint point;
FlowLine line;
} FlowPointAndLine;
FlowPointAndLine new_FlowPointAndLine(FlowPoint point, FlowLine line) {
FlowPointAndLine o;
o.point = point;
o.line = line;
return o;
}
//========== VECTOR ==========
Vector vector_radial(const Direction direction, double size) {
return new_vector(
cos(direction) * size,
sin(direction) * size
);
}
double vector_size(Vector A) {
return sqrt(pow(A.x, 2) + pow(A.y, 2));
}
Vector vector_vectorTo(const Vector A, const Vector B) {
return new_vector(B.x - A.x, B.y - A.y);
}
double vector_distanceTo(const Vector A, const Vector B) {
return vector_size(vector_vectorTo(A, B));
}
Direction vector_direction(Vector A) {
return new_Direction(atan2(A.y, A.x));
}
Direction vector_directionTo(const Vector A, Vector B) {
return vector_direction(vector_vectorTo(A, B));
}
Vector vector_plus(Vector A, Vector B) {
if (B.x == 0 && B.y == 0) return A;
return new_vector(A.x + B.x, A.y + B.y);
}
Vector vector_minus(Vector A, Vector B) {
return new_vector(A.x - B.x, A.y - B.y);
}
Vector vector_multiply(Vector A, double k) {
return new_vector(A.x * k, A.y * k);
}
Vector vector_invert(Vector A) {
return new_vector(-A.x, -A.y);
}
//========== AREA ==========
//========== DIRECTION ==========
Direction direction_fromDegrees(double degrees) {
return new_Direction(degrees * M_PI / 180);
}
double toDegrees(double angle) {
return angle * 180 / M_PI;
}
double direction_normalize(double value) {
while (value < 0) value += 2 * M_PI;
while (value >= 2 * M_PI) value -= 2 * M_PI;
return value;
}
double direction_differenceTo(const Direction t, Direction target) {
if (target < t) target += 2 * M_PI;
return target - t;
}
double direction_difference(const Direction t, const Direction direction) {
return min(
direction_differenceTo(t, direction),
direction_differenceTo(direction, t)
);
}
Direction direction_plus(const Direction t, const Direction direction) {
return new_Direction(t + direction);
}
Direction direction_plus_double(const Direction t, double val) {
return new_Direction(t + val);
}
Direction direction_minus(const Direction t, const Direction direction) {
return new_Direction(t - direction);
}
Direction direction_invert(const Direction t) {
return new_Direction(t + M_PI);
}
double direction_degrees(const Direction t) {
return t * 180 / M_PI;
}
Direction direction_mirrorWith(const Direction t, const Direction axis) {
return new_Direction(2 * axis - t);
}
Direction direction_weightedAverageWith(Direction t, Direction direction, double weight) {
return vector_direction(vector_plus(vector_radial(t, 1 - weight), vector_radial(direction, weight)));
}
Direction direction_averageWith(Direction t, Direction direction) {
return direction_weightedAverageWith(t, direction, 0.5);
}
//========== ANCHOR ==========
//========== FLOWPOINT ==========
//========== FLOWLINE ==========
FlowPoint nearestFlowPointOnFlowLine(FlowLine t, Vector point) {
Vector aToP = vector_vectorTo(t.pa.point, point);
Vector aToB = vector_vectorTo(t.pa.point, t.pb.point);
double atb2 = pow(aToB.x, 2) + pow(aToB.y, 2);
double atp_dot_atb = aToP.x * aToB.x + aToP.y * aToB.y;
double tx = toRange(atp_dot_atb / atb2, 0, 1);
return new_FlowPoint(vector_plus(t.pa.point, vector_multiply(aToB, tx)),
tx * t.pb.radius + (1 - tx) * t.pa.radius,
vector_direction(aToB));
}
/*Vector nearestPointOnLine(Vector pa, Vector pb, Vector point) {
Vector aToP = vector_vectorTo(pa, point);
Vector aToB = vector_vectorTo(pa, pb);
double atb2 = pow(aToB.x, 2) + pow(aToB.y, 2);
double atp_dot_atb = aToP.x * aToB.x + aToP.y * aToB.y;
double tx = toRange(atp_dot_atb / atb2, 0, 1);
return vector_plus(pa, vector_multiply(aToB, tx));
}*/
FlowLine flowline_move(FlowLine t, Vector moveVector) {
return new_FlowLine(
new_Anchor(vector_plus(t.pa.point, moveVector), t.pa.radius),
new_Anchor(vector_plus(t.pb.point, moveVector), t.pb.radius)
);
}
/***
* ## ## ### ######## #### ### ######## ## ######## ######
* ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
* ## ## ## ## ## ## ## ## ## ## ## ## ## ##
* ## ## ## ## ######## ## ## ## ######## ## ###### ######
* ## ## ######### ## ## ## ######### ## ## ## ## ##
* ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
* ### ## ## ## ## #### ## ## ######## ######## ######## ######
*/
//========== COSPACE ==========
int Duration = 0;
int SuperDuration = 0;
int bGameEnd = false;
int CurAction = -1;
int CurGame = 0;
int SuperObj_Num = 0;
int SuperObj_X = 0;
int SuperObj_Y = 0;
int Teleport = 0;
int LoadedObjects = 0;
int US_Front = 0;
int US_Left = 0;
int US_Right = 0;
int CSLeft_R = 0;
int CSLeft_G = 0;
int CSLeft_B = 0;
int CSRight_R = 0;
int CSRight_G = 0;
int CSRight_B = 0;
int PX = 0;
int PY = 0;
int TM_State = 0;
int Compass = 0;
int Time = 0;
int WheelLeft = 0;
int WheelRight = 0;
int LED_1 = 0;
int MyState = 0;
int AI_SensorNum = 13;
//========== CONSTANTS ==========
#define BORDER_MARGIN 20
#define MAP_WIDTH 350
#define MAP_HEIGHT 260
#define ACTION_DEPOSIT 50
#define ACTION_DEPOSITING 51
#define ACTION_ADJUST_FOR_DEPOSIT 52
#define ACTION_COLLECT 20
#define ACTION_COLLECTING 21
#define ACTION_OBSTACLE_AVOID 30
#define ACTION_OBSTACLE_AVOIDING 31
#define ACTION_FOLLOW_ROUTE 41
#define ACTION_FOLLOW_SUPEROBJECT 61
#define ACTION_REVERSING 71
#define ACTION_NORMAL 1
int MIN_DEP_LOADED_OBJECTS = 4;
int STD_SPEED = 2;
double STD_ANGLE_TOLERANCE = 8 * M_PI / 180;
double STD_RANDOMNESS = 0.1;
int AVOIDING_BORDER_TIME = 20;
int DEPOSITING_TIME = 44;
int RANDOM_COORDINATES_PADDING = 30;
int US_DISTANCE = 3;
int ROUTE_DISTANCE_THRESHOLD = 8;
int SMALL_RADIUS = 4;
int ROBOT_WIDTH = 15;
/**
* Collect policy = maximum number of collected objects of one color
* 0 - all
* 1 - space for 1 of each
* 2 - space for 2 of each
*/
int POLICY_COLLECT = 1;
double SUPEROBJECT_VISION_DISTANCE = 200;
double BORDER_DISTANCE = 12;
double COEFF_K = 6;
double DISCRETE_FLOWPOINT_FORCE = 2.0;
int RANDOM_VECTOR_STEP_DEVIATION = 20; // degrees
double RANDOM_VECTOR_SIZE = 0.4;
//========== PROGRAM variables ==========
bool initialized = false;
int ticks = 0;
// Collecting objects
int loadedColor[] = {0, 0, 0}; // red, black, blue
int loadedSuperobject = 0;
// Superobjects
int superobjectCount = 0;
Vector superobjects[20];
Vector lastSuperobjectRegistered = {-1, -1};
bool isFollowingSuperobject = false;
FlowLine superobjectFlowLine = {};
int superobjectIndex = NONE;
int lastDecidedForSuperobject = 10000000;
//========== STATE variables ==========
int collectingTime = 0;
bool mustRemainCollecting = true;
int currentArea = 0;
int currentCheckpoint = 0;
int avoidingObstacleTime = 0;
int avoidingBorderTime = 0;
Vector *avoidingBorderPos;
int depositingTime = 0;
int reversingTime = 0;
int currentRoute = NONE;
int currentRoutePoint = NONE;
// moving and position
Vector currentPosition;
Direction currentDirection;
Vector lastPosition;
Direction lastDirection;
Vector estimatedPosition;
Direction estimatedDirection;
int motorLeft;
int motorRight;
Direction lastRandomDirection;
int lastCollect = 0;
// Flows
int bottomEnvIndex;
int depositEnvIndex = NONE;
//========== TEMPORARY variables ==========
int lastState = 0;
int debug1 = -777;
int debug2 = -777;
//========== REAL PART ==========
int kanyar = 0;
int goingtodeposit = 0;
int start = 0;
int foundDeposit = 0;
int justdeposited = 0;
/***
* ######## ######## ######## ######## ######## ######## #### ## ## ######## ########
* ## ## ## ## ## ## ## ## ## ## ### ## ## ## ##
* ## ## ## ## ## ## ## ## ## ## #### ## ## ## ##
* ######## ######## ###### ## ## ###### ###### ## ## ## ## ###### ## ##
* ## ## ## ## ## ## ## ## ## ## #### ## ## ##
* ## ## ## ## ## ## ## ## ## ## ### ## ## ##
* ## ## ## ######## ######## ######## ## #### ## ## ######## ########
*/
bool _was_init = false;
#define AREA_GROUP_COUNT 10
AreaGroup AREA_GROUPS[AREA_GROUP_COUNT];
int _index_area_group = 0;
int _area_group() {
AREA_GROUPS[_index_area_group++].count = 0;
}
void _area(int x1, int y1, int x2, int y2) {
AreaGroup *g = &AREA_GROUPS[_index_area_group - 1];
g->areas[g->count] = new_area(x1, y1, x2, y2);
}
// ========== ENVIRONMENTS ==========
#define ENVIRONMENT_COUNT 3
Environment ENVIRONMENTS[ENVIRONMENT_COUNT];
int environment_count = 0;
Environment *getEnv(int index) {
return &ENVIRONMENTS[index];
}
int getCurrentEnvIndex() {
if (depositEnvIndex != NONE) {
return 0;
}
return bottomEnvIndex;
}
Environment *getCurrentEnv() {
return getEnv(getCurrentEnvIndex());
}
void setBottomEnv(int index) {
bottomEnvIndex = index;
}
void _environment(double randomnessSize) { // _environment must be defined before _anchor, _flowPoint
Environment *e = &ENVIRONMENTS[environment_count++];
e->randomnessSize = randomnessSize;
}
void _anchor(int x, int y, int radius) {
Environment *e = &ENVIRONMENTS[environment_count - 1];
e->anchors[e->anchorCount++] = new_Anchor(new_vector(x, y), radius);
}
void _flowPoint(int x, int y, int radius, int direction) {
Environment *e = &ENVIRONMENTS[environment_count - 1];
e->flowPoints[e->flowPointCount++] = new_FlowPoint(new_vector(x, y), radius, direction_fromDegrees(direction));
}
void _init_flowlines() {
for (int ei = 0; ei < ENVIRONMENT_COUNT; ei++) {
Environment *e = &ENVIRONMENTS[ei];
for (int i = 0; i < e->anchorCount; i++) {
Anchor aa = e->anchors[i];
Anchor ab = e->anchors[(i + 1) % e->anchorCount];
e->flowLines[i] = new_FlowLine(aa, ab);
}
}
}
void _environment_route(bool withEnd) {
Environment *e = &ENVIRONMENTS[environment_count - 1];
e->flowRoutes[e->routeCount++].withEnd = withEnd;
}
void _environment_route_point(int x, int y, int radius) {
Environment *e = &ENVIRONMENTS[environment_count - 1];
FlowRoute *r = &(e->flowRoutes[e->routeCount - 1]);
r->points[r->count++] = new_Anchor(new_vector(x, y), radius);
}
// ========== ROUTES ==========
#define ROUTES_COUNT 1 // routes: put number of routes here
Route ROUTES[ROUTES_COUNT];
Route *getCurrentRoute() {
if (currentRoute == NONE) return NULL;
return &ROUTES[currentRoute];
}
void _routePoint(int route, int x, int y) {
Route *r = &ROUTES[route];
r->points[r->count++] = new_vector(x, y);
}
// ============= WALLS =============
#define WALLS_COUNT 100
Wall WALLS[WALLS_COUNT];
int wall_count = 0;
void _wall(int ax, int ay, int bx, int by) {
WALLS[wall_count++] = new_Wall(new_vector(ax, ay), new_vector(bx, by));
};
// ========== SUPEROBJECTRULES ==========
SuperobjectRule SUPEROBJECT_RULES[20];
int superobjectRulesCount = 0;
void _rule(int areaXa, int areaYa, int areaXb, int areaYb, int entryXa, int entryYa, int entryXb, int entryYb) {
SuperobjectRule *r = &SUPEROBJECT_RULES[superobjectRulesCount++];
r->area = new_area(areaXa, areaYa, areaXb, areaYb);
r->entry = new_area(entryXa, entryYa, entryXb, entryYb);
r->route.count = 0;
}
void _rule_route_point(int x, int y) { // _rule must be defined first
// add the route point to the last SuperobjectRule
SuperobjectRule *r = &SUPEROBJECT_RULES[superobjectRulesCount - 1];
r->route.points[r->route.count++] = new_vector(x, y);
}
// ========== INITIALIZATION ==========
void _init_values() {
//fun Flows._init_values() {
// =====DEFINITIONS=====
_wall(160, 36, 209, 36);
_wall(211, 75, 210, 36);
_wall(211, 76, 200, 76);
_wall(200, 75, 200, 47);
_wall(160, 46, 200, 47);
_wall(160, 46, 160, 36);
_wall(270, 85, 309, 85);
_wall(309, 76, 270, 77);
_wall(270, 86, 270, 77);
_wall(310, 76, 310, 85);
_wall(309, 120, 319, 120);
_wall(320, 120, 319, 160);
_wall(319, 161, 310, 159);
_wall(309, 159, 309, 121);
_wall(309, 160, 309, 189);
_wall(309, 189, 280, 189);
_wall(280, 170, 279, 189);
_wall(308, 159, 290, 160);
_wall(290, 160, 280, 171);
_wall(267, 159, 279, 148);
_wall(279, 149, 279, 129);
_wall(250, 129, 277, 131);
_wall(267, 159, 249, 160);
_wall(249, 160, 251, 130);
_wall(90, 110, 209, 110);
_wall(209, 110, 208, 149);
_wall(209, 149, 249, 151);
_wall(250, 151, 249, 161);
_wall(249, 161, 201, 159);
_wall(201, 159, 200, 121);
_wall(200, 121, 88, 121);
_wall(88, 121, 89, 111);
_wall(89, 109, 60, 108);
_wall(60, 108, 61, 79);
_wall(61, 79, 90, 80);
_wall(90, 80, 90, 109);
_wall(40, 229, 48, 230);
_wall(48, 230, 48, 269);
_wall(48, 269, 35, 269);
_wall(35, 269, 39, 230);
_wall(151, 191, 156, 189);
_wall(158, 189, 159, 229);
_wall(159, 229, 148, 229);
_wall(149, 191, 148, 229);
_wall(229, 223, 229, 223);
_wall(198, 224, 229, 223);
_wall(229, 223, 229, 194);
_wall(229, 194, 200, 194);
_wall(200, 194, 199, 224);
_wall(60, 79, 44, 80);
_wall(44, 80, 44, 50);
_wall(44, 49, 2, 48);
_wall(0, 97, 59, 97);
_wall(165, 174, 167, 167);
_wall(167, 166, 174, 160);
_wall(176, 159, 183, 158);
_wall(185, 160, 193, 167);
_wall(193, 167, 196, 177);
_wall(196, 177, 187, 183);
_wall(187, 183, 182, 185);
_wall(181, 186, 174, 185);
_wall(174, 185, 168, 183);
_wall(168, 183, 164, 174);
_area_group();
_area(1, 1, 211, 34);
_area(61, 34, 91, 77);
_area(1, 113, 159, 194);
_area(308, 2, 357, 159);
_area(153, 229, 257, 268);
_area(202, 159, 278, 192);
_area(318, 159, 358, 199);
_environment(0.0);
_environment_route(false);
_environment_route_point(19, 11, 6);
_environment_route_point(79, 12, 7);
_environment_route_point(101, 50, 5);
_environment_route_point(171, 90, 4);
_environment_route_point(232, 97, 7);
_environment_route_point(284, 107, 8);
_environment_route_point(294, 120, 7);
_environment_route_point(289, 149, 5);
_environment_route_point(271, 168, 5);
_environment_route_point(255, 203, 2);
_environment_route_point(247, 234, 4);
_environment_route_point(237, 246, 5);
_environment_route(false);
_environment_route_point(285, 15, 17);
_environment_route_point(239, 55, 17);
_environment_route_point(244, 89, 12);
_environment_route(false);
_environment_route_point(348, 65, 3);
_environment_route_point(345, 203, 2);
_environment_route_point(240, 250, 6);
_environment_route_point(184, 250, 9);
_environment_route_point(181, 215, 11);
_environment_route(false);
_environment_route_point(25, 206, 2);
_environment_route_point(17, 243, 6);
_environment_route(false);
_environment_route_point(31, 149, 12);
_environment_route_point(178, 140, 4);
_environment_route(false);
_environment_route(false);
_environment_route(false);
_environment_route_point(81, 204, 8);
_environment_route_point(86, 249, 11);
_environment_route_point(154, 261, 6);
_environment_route_point(175, 254, 6);
_flowPoint(272, 137, 29, -45);
_flowPoint(257, 140, 25, -126);
_flowPoint(197, 79, 32, 129);
_flowPoint(272, 72, 29, -144);
_flowPoint(320, 120, 18, -41);
_flowPoint(323, 162, 20, 9);
_flowPoint(230, 219, 35, 67);
_flowPoint(311, 187, 25, 58);
_flowPoint(145, 160, 39, -122);
_flowPoint(144, 231, 23, 125);
_flowPoint(117, 225, 69, 110);
_flowPoint(138, 210, 48, 149);
_flowPoint(48, 231, 29, -94);
_flowPoint(136, 188, 58, 129);
_flowPoint(146, 195, 28, 151);
_flowPoint(89, 109, 45, 137);
_flowPoint(90, 113, 47, 119);
_flowPoint(90, 89, 48, -52);
_flowPoint(116, 103, 45, -41);
_flowPoint(134, 103, 39, -50);
_flowPoint(148, 101, 27, -54);
_flowPoint(163, 100, 29, -46);
_flowPoint(178, 113, 40, -52);
_flowPoint(193, 105, 26, -47);
_flowPoint(210, 107, 23, -59);
_flowPoint(221, 143, 37, -72);
_flowPoint(162, 34, 48, -141);
_flowPoint(164, 43, 32, 142);
_flowPoint(204, 26, 47, -29);
_flowPoint(209, 37, 42, -43);
_flowPoint(182, 31, 27, -57);
_flowPoint(308, 59, 43, -7);
_flowPoint(295, 71, 30, -52);
_flowPoint(310, 121, 22, 170);
_flowPoint(291, 171, 20, -153);
_flowPoint(269, 153, 22, 60);
_flowPoint(247, 170, 38, 24);
_flowPoint(270, 76, 20, -152);
_flowPoint(31, 54, 62, -22);
_flowPoint(20, 96, 56, 118);
_flowPoint(46, 96, 56, 110);
_flowPoint(64, 99, 41, 117);
_flowPoint(45, 66, 29, -55);
_flowPoint(77, 76, 18, -56);
_flowPoint(255, 208, 46, 114);
_flowPoint(232, 207, 15, 58);
_flowPoint(231, 197, 19, -118);
_flowPoint(191, 179, 17, 30);
_flowPoint(318, 140, 21, 25);
_flowPoint(211, 178, 59, 6);
_environment(STD_RANDOMNESS);
_environment_route(false);
_environment_route_point(19, 198, 29);
_environment_route_point(64, 165, 18);
_environment_route_point(99, 247, 13);
_environment_route_point(175, 249, 13);
_environment_route_point(256, 248, 20);
_environment_route_point(327, 217, 21);
_environment_route_point(341, 187, 2);
_environment_route_point(338, 103, 5);
_environment_route_point(337, 56, 24);
_environment_route_point(271, 43, 15);
_environment_route_point(232, 20, 3);
_environment_route_point(140, 13, 10);
_environment_route_point(129, 46, 9);
_environment_route_point(161, 78, 3);
_environment_route_point(201, 95, 3);
_environment_route_point(236, 91, 4);
_environment_route_point(267, 44, 5);
_environment_route(false);
_environment_route_point(180, 143, 23);
_environment_route_point(119, 157, 5);
_environment_route_point(122, 238, 13);
_environment_route(false);
_environment_route_point(293, 134, 2);
_environment_route_point(273, 115, 3);
_environment_route_point(241, 93, 14);
_environment_route(false);
_environment_route_point(19, 16, 20);
_environment_route_point(91, 17, 16);
_environment_route_point(105, 64, 4);
_environment_route_point(153, 76, 9);
_flowPoint(132, 208, 52, 90);
_flowPoint(177, 206, 42, 91);
_flowPoint(198, 224, 26, 143);
_flowPoint(284, 183, 23, 137);
_flowPoint(266, 159, 11, 0);
_flowPoint(278, 170, 6, -90);
_flowPoint(285, 164, 11, -75);
_flowPoint(273, 151, 16, 0);
_flowPoint(19, 258, 53, -92);
_flowPoint(35, 229, 18, -93);
_flowPoint(34, 261, 18, -139);
_flowPoint(35, 242, 21, -137);
_flowPoint(12, 105, 58, 89);
_flowPoint(45, 104, 38, 78);
_flowPoint(67, 103, 39, 86);
_flowPoint(185, 143, 35, 180);
_flowPoint(14, 37, 23, -75);
_flowPoint(35, 35, 18, -90);
_flowPoint(53, 41, 30, -56);
_flowPoint(55, 64, 25, -16);
_flowPoint(69, 84, 16, -57);
_flowPoint(87, 86, 17, -66);
_flowPoint(209, 117, 20, -51);
_flowPoint(210, 134, 15, -35);
_flowPoint(219, 148, 25, -56);
_flowPoint(237, 147, 15, -129);
_flowPoint(252, 145, 17, -140);
_flowPoint(257, 161, 20, 84);
_flowPoint(243, 163, 15, 72);
_flowPoint(228, 167, 13, 81);
_flowPoint(216, 165, 13, 63);
_flowPoint(198, 170, 26, 34);
_flowPoint(206, 194, 14, -70);
_flowPoint(222, 224, 27, 39);
_flowPoint(227, 195, 15, -35);
_flowPoint(299, 187, 17, 140);
_flowPoint(309, 75, 14, -67);
_flowPoint(294, 78, 16, -133);
_flowPoint(309, 85, 19, 93);
_flowPoint(49, 230, 12, -48);
_flowPoint(152, 188, 34, -163);
_flowPoint(153, 166, 18, -174);
_flowPoint(165, 161, 13, -117);
_flowPoint(148, 226, 22, 113);
_flowPoint(202, 237, 19, 49);
_flowPoint(210, 76, 25, 29);
_flowPoint(190, 64, 49, 114);
_flowPoint(159, 54, 25, 113);
_flowPoint(215, 39, 22, -62);
_flowPoint(196, 76, 17, 114);
_flowPoint(213, 98, 33, 0);
_flowPoint(233, 102, 41, -89);
_flowPoint(132, 109, 14, -48);
_flowPoint(103, 110, 25, -53);
_flowPoint(164, 37, 22, -141);
_flowPoint(272, 91, 19, 111);
_flowPoint(86, 127, 17, 121);
_flowPoint(326, 170, 15, 4);
_flowPoint(308, 183, 29, 72);
_flowPoint(305, 95, 32, 85);
_flowPoint(252, 198, 74, 52);
_flowPoint(290, 199, 45, 29);
_flowPoint(192, 37, 32, -141);
_environment(STD_RANDOMNESS);
_environment_route(false);
_environment_route_point(19, 198, 29);
_environment_route_point(57, 164, 82);
_environment_route_point(99, 247, 36);
_environment_route_point(175, 249, 20);
_environment_route_point(256, 248, 20);
_environment_route_point(322, 226, 21);
_environment_route_point(342, 189, 2);
_environment_route_point(342, 105, 5);
_environment_route_point(254, 106, 24);
_environment_route_point(260, 56, 47);
_environment_route_point(236, 17, 13);
_environment_route_point(142, 17, 14);
_environment_route_point(129, 46, 16);
_environment_route_point(150, 96, 27);
_environment_route_point(192, 97, 16);
_environment_route(false);
_environment_route_point(180, 143, 23);
_environment_route_point(140, 146, 20);
_environment_route_point(111, 205, 20);
_environment_route(false);
_environment_route_point(250, 186, 20);
_environment_route_point(269, 210, 20);
_environment_route_point(316, 220, 14);
_environment_route(false);
_environment_route_point(19, 16, 20);
_environment_route_point(109, 19, 20);
_flowPoint(132, 208, 52, 90);
_flowPoint(177, 206, 42, 91);
_flowPoint(198, 224, 26, 143);
_flowPoint(284, 183, 23, 137);
_flowPoint(266, 159, 11, 0);
_flowPoint(278, 170, 6, -90);
_flowPoint(285, 164, 11, -75);
_flowPoint(273, 151, 16, 0);
_flowPoint(19, 258, 53, -92);
_flowPoint(35, 229, 18, -93);
_flowPoint(34, 261, 18, -139);
_flowPoint(35, 242, 21, -137);
_flowPoint(12, 105, 58, 89);
_flowPoint(45, 104, 38, 78);
_flowPoint(67, 103, 39, 86);
_flowPoint(92, 122, 28, 131);
_flowPoint(109, 121, 30, 96);
_flowPoint(126, 120, 20, 93);
_flowPoint(139, 120, 14, 90);
_flowPoint(147, 123, 9, 90);
_flowPoint(155, 122, 12, 99);
_flowPoint(185, 143, 35, 180);
_flowPoint(212, 97, 41, -16);
_flowPoint(210, 39, 16, -45);
_flowPoint(162, 37, 16, -130);
_flowPoint(160, 46, 17, 114);
_flowPoint(178, 47, 21, 93);
_flowPoint(195, 50, 20, 125);
_flowPoint(199, 65, 16, 135);
_flowPoint(199, 76, 20, 110);
_flowPoint(208, 76, 21, 31);
_flowPoint(211, 68, 29, -56);
_flowPoint(196, 34, 16, -125);
_flowPoint(183, 34, 15, -145);
_flowPoint(173, 34, 15, -143);
_flowPoint(14, 37, 23, -75);
_flowPoint(35, 35, 18, -90);
_flowPoint(53, 41, 30, -38);
_flowPoint(55, 64, 25, -16);
_flowPoint(69, 84, 16, -57);
_flowPoint(87, 86, 17, -66);
_flowPoint(83, 104, 15, 110);
_flowPoint(93, 106, 14, -61);
_flowPoint(109, 108, 21, -77);
_flowPoint(126, 109, 17, -79);
_flowPoint(141, 109, 24, -51);
_flowPoint(161, 110, 16, -52);
_flowPoint(183, 110, 18, -65);
_flowPoint(209, 117, 20, -51);
_flowPoint(210, 134, 15, -35);
_flowPoint(219, 148, 25, -56);
_flowPoint(237, 147, 15, -129);
_flowPoint(236, 112, 52, -75);
_flowPoint(252, 145, 17, -140);
_flowPoint(257, 161, 20, 84);
_flowPoint(243, 163, 15, 72);
_flowPoint(228, 167, 13, 81);
_flowPoint(216, 165, 13, 63);
_flowPoint(198, 170, 26, 34);
_flowPoint(206, 194, 14, -70);
_flowPoint(222, 224, 27, 39);
_flowPoint(227, 195, 15, -35);
_flowPoint(299, 187, 17, 140);
_flowPoint(318, 122, 15, -90);
_flowPoint(318, 154, 20, -61);
_flowPoint(318, 139, 17, -54);
_flowPoint(319, 161, 14, 28);
_flowPoint(308, 173, 24, -9);
_flowPoint(309, 75, 14, -118);
_flowPoint(294, 78, 16, -133);
_flowPoint(309, 85, 19, 93);
_flowPoint(273, 86, 20, 153);
_flowPoint(49, 230, 12, -48);
_flowPoint(152, 188, 34, -163);
_flowPoint(153, 166, 18, -174);
_flowPoint(312, 190, 21, 55);
_flowPoint(309, 180, 17, -21);
_flowPoint(165, 161, 13, -117);
_flowPoint(148, 226, 22, 113);
_flowPoint(202, 237, 19, 49);
_flowPoint(295, 146, 25, -95);
_flowPoint(272, 165, 17, 130);
_flowPoint(278, 131, 17, -83);