@jutge.org/toolkit 4.2.22 → 4.2.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/assets/problems/games/the-walking-dead.pbm/README.md +12 -0
  2. package/assets/problems/games/the-walking-dead.pbm/ca/Doc/Makefile +6 -0
  3. package/assets/problems/games/the-walking-dead.pbm/ca/Doc/api.tex +246 -0
  4. package/assets/problems/games/the-walking-dead.pbm/ca/Doc/defs.tex +2 -0
  5. package/assets/problems/games/the-walking-dead.pbm/ca/Doc/main.tex +63 -0
  6. package/assets/problems/games/the-walking-dead.pbm/ca/Doc/programming.tex +452 -0
  7. package/assets/problems/games/the-walking-dead.pbm/ca/Doc/rules.tex +222 -0
  8. package/assets/problems/games/the-walking-dead.pbm/ca/Doc/screenshot.png +0 -0
  9. package/assets/problems/games/the-walking-dead.pbm/ca/Doc/tips.tex +81 -0
  10. package/assets/problems/games/the-walking-dead.pbm/ca/Doc/twd.png +0 -0
  11. package/assets/problems/games/the-walking-dead.pbm/ca/Doc/viewer.tex +41 -0
  12. package/assets/problems/games/the-walking-dead.pbm/ca/Doc-eng/Makefile +6 -0
  13. package/assets/problems/games/the-walking-dead.pbm/ca/Doc-eng/api.tex +246 -0
  14. package/assets/problems/games/the-walking-dead.pbm/ca/Doc-eng/defs.tex +2 -0
  15. package/assets/problems/games/the-walking-dead.pbm/ca/Doc-eng/main.tex +63 -0
  16. package/assets/problems/games/the-walking-dead.pbm/ca/Doc-eng/programming.tex +176 -0
  17. package/assets/problems/games/the-walking-dead.pbm/ca/Doc-eng/rules.tex +194 -0
  18. package/assets/problems/games/the-walking-dead.pbm/ca/Doc-eng/screenshot.png +0 -0
  19. package/assets/problems/games/the-walking-dead.pbm/ca/Doc-eng/tips.tex +85 -0
  20. package/assets/problems/games/the-walking-dead.pbm/ca/Doc-eng/twd.png +0 -0
  21. package/assets/problems/games/the-walking-dead.pbm/ca/Doc-eng/viewer.tex +36 -0
  22. package/assets/problems/games/the-walking-dead.pbm/ca/Obj/AIDummy.o.Linux64 +0 -0
  23. package/assets/problems/games/the-walking-dead.pbm/ca/Obj/AIDummy.o.Linux64.Debug +0 -0
  24. package/assets/problems/games/the-walking-dead.pbm/ca/Obj/AIDummy.o.MacOS +0 -0
  25. package/assets/problems/games/the-walking-dead.pbm/ca/Obj/AIDummy.o.MacOS.ARM +0 -0
  26. package/assets/problems/games/the-walking-dead.pbm/ca/Obj/AIDummy.o.MacOS.ARM.Debug +0 -0
  27. package/assets/problems/games/the-walking-dead.pbm/ca/Obj/AIDummy.o.MacOS.Debug +0 -0
  28. package/assets/problems/games/the-walking-dead.pbm/ca/Obj/Board.o.Linux64 +0 -0
  29. package/assets/problems/games/the-walking-dead.pbm/ca/Obj/Board.o.Linux64.Debug +0 -0
  30. package/assets/problems/games/the-walking-dead.pbm/ca/Obj/Board.o.MacOS +0 -0
  31. package/assets/problems/games/the-walking-dead.pbm/ca/Obj/Board.o.MacOS.ARM +0 -0
  32. package/assets/problems/games/the-walking-dead.pbm/ca/Obj/Board.o.MacOS.ARM.Debug +0 -0
  33. package/assets/problems/games/the-walking-dead.pbm/ca/Obj/Board.o.MacOS.Debug +0 -0
  34. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/AIDemo.cc +89 -0
  35. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/AIDummy.cc +202 -0
  36. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/AINull.cc +37 -0
  37. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Action.cc +34 -0
  38. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Action.hh +107 -0
  39. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Board.cc +975 -0
  40. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Board.hh +287 -0
  41. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Defs.hh +2 -0
  42. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Game.cc +55 -0
  43. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Game.hh +23 -0
  44. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Info.cc +174 -0
  45. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Info.hh +129 -0
  46. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Main.cc +83 -0
  47. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Makefile +56 -0
  48. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Player.cc +66 -0
  49. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Player.hh +63 -0
  50. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/README.txt +9 -0
  51. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Random.cc +3 -0
  52. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Random.hh +88 -0
  53. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Registry.cc +28 -0
  54. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Registry.hh +42 -0
  55. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/SecGame.cc +368 -0
  56. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/SecGame.hh +90 -0
  57. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/SecMain.cc +99 -0
  58. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Settings.cc +67 -0
  59. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Settings.hh +175 -0
  60. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/State.cc +3 -0
  61. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/State.hh +188 -0
  62. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Structs.cc +3 -0
  63. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Structs.hh +377 -0
  64. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Utils.cc +3 -0
  65. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/Utils.hh +77 -0
  66. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/default-fixed.cnf +120 -0
  67. package/assets/problems/games/the-walking-dead.pbm/ca/Runner/default.cnf +17 -0
  68. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  69. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  70. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  71. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  72. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  73. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  74. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  75. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  76. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  77. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/css/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  78. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/css/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  79. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/css/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
  80. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/css/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  81. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/css/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  82. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/css/ui-lightness/jquery-ui-1.8.18.custom.css +310 -0
  83. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/help.html +18 -0
  84. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/img/but_close.png +0 -0
  85. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/img/but_end.png +0 -0
  86. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/img/but_help.png +0 -0
  87. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/img/but_pause.png +0 -0
  88. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/img/but_play.png +0 -0
  89. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/img/but_refresh.png +0 -0
  90. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/img/but_start.png +0 -0
  91. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/img/logo.png +0 -0
  92. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/js/jquery-1.7.1.min.js +4 -0
  93. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/js/jquery-ui-1.8.18.custom.min.js +49 -0
  94. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/sample.out +52807 -0
  95. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/viewer.html +118 -0
  96. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/viewer.js +846 -0
  97. package/assets/problems/games/the-walking-dead.pbm/ca/Viewer/viewer.sh +28 -0
  98. package/assets/problems/games/the-walking-dead.pbm/ca/handler.yml +6 -0
  99. package/assets/problems/games/the-walking-dead.pbm/ca/problem.ca.yml +3 -0
  100. package/assets/prompts/creators/create-solution.tpl.txt +15 -8
  101. package/assets/prompts/proglangs/cc.md +6 -2
  102. package/assets/prompts/proglangs/py.md +10 -6
  103. package/dist/index.js +370 -366
  104. package/docs/getting-started-guide.md +1 -1
  105. package/docs/install-linux.md +1 -1
  106. package/docs/install-macos.md +1 -1
  107. package/docs/install-windows.md +1 -1
  108. package/package.json +11 -11
  109. package/toolkit/ask.ts +0 -2
  110. package/toolkit/doctor.ts +1 -1
  111. package/toolkit/make.ts +2 -2
@@ -0,0 +1,377 @@
1
+ #ifndef Structs_hh
2
+ #define Structs_hh
3
+
4
+
5
+ #include "Utils.hh"
6
+
7
+
8
+ /**
9
+ * Contains the Dir enumeration,
10
+ * the CommandType enumeration,
11
+ * the Pos struct,
12
+ * the CellType enumeration, the Cell struct,
13
+ * the UnitType enumeration, the Unit struct,
14
+ * and some useful little functions.
15
+ */
16
+
17
+
18
+ /**
19
+ * Enum to encode directions. Remember that alive units cannot move diagonally
20
+ */
21
+ enum Dir {
22
+ Down, DR, Right, RU, Up, UL, Left, LD
23
+ };
24
+
25
+ inline ostream& operator << (ostream& out, Dir d) {
26
+ switch (d) {
27
+ case Down: out << "Down"; break;
28
+ case DR: out << "DR"; break;
29
+ case Right: out << "Right"; break;
30
+ case RU: out << "RU"; break;
31
+ case Up: out << "Up"; break;
32
+ case UL: out << "UL"; break;
33
+ case Left: out << "Left"; break;
34
+ case LD: out << "LD"; break;
35
+ default: out << int(d); break;
36
+ }
37
+ return out;
38
+ }
39
+
40
+
41
+ /**
42
+ * Simple struct to handle positions.
43
+ */
44
+ struct Pos {
45
+
46
+ int i, j;
47
+
48
+ /**
49
+ * Default constructor (0, 0).
50
+ */
51
+ Pos ();
52
+ /**
53
+ * Constructor with all defining fields.
54
+ */
55
+ Pos (int i, int j);
56
+
57
+ /**
58
+ * Print operator.
59
+ */
60
+ friend ostream& operator<< (ostream& os, const Pos& p);
61
+
62
+ /**
63
+ * Comparison operator.
64
+ */
65
+ friend bool operator== (const Pos& a, const Pos& b);
66
+
67
+ /**
68
+ * Comparison operator.
69
+ */
70
+ friend bool operator!= (const Pos& a, const Pos& b);
71
+
72
+ /**
73
+ * Comparison operator, mostly needed for sorting.
74
+ */
75
+ friend bool operator< (const Pos& a, const Pos& b);
76
+
77
+ /**
78
+ * Increment operator: moves a position according to a direction.
79
+ */
80
+ Pos& operator+= (Dir d);
81
+
82
+ /**
83
+ * Addition operator: Returns a position by adding a direction.
84
+ */
85
+ Pos operator+ (Dir d) const;
86
+
87
+ /**
88
+ * Increment operator: moves a position according to another position.
89
+ */
90
+ Pos& operator+= (Pos p);
91
+
92
+ /**
93
+ * Addition operator: Returns a position by adding another position.
94
+ */
95
+ Pos operator+ (Pos p) const;
96
+ };
97
+
98
+ /**
99
+ * Defines kinds of cells.
100
+ */
101
+ enum CellType {
102
+ Street,
103
+ Waste
104
+ };
105
+
106
+
107
+ inline ostream& operator << (ostream& out, CellType c) {
108
+ switch (c) {
109
+ case Street: out << "Street"; break;
110
+ case Waste: out << "Waste"; break;
111
+ default: out << int(c); break;
112
+ }
113
+ return out;
114
+ }
115
+
116
+
117
+ /**
118
+ * Describes a cell on the board, and its contents.
119
+ */
120
+ struct Cell {
121
+
122
+ CellType type; // The kind of cell (street or waste).
123
+ int owner; // The player that owns it, otherwise -1.
124
+ int id; // The id of a unit if present, or -1 otherwise.
125
+ bool food; // Whether it contains food
126
+
127
+ /**
128
+ * Default constructor (Street, -1, -1, false).
129
+ */
130
+ Cell ();
131
+
132
+ /**
133
+ * Constructor with all defining fields.
134
+ */
135
+ Cell (CellType t, int o, int i, bool f);
136
+
137
+ bool is_empty( ) const;
138
+ };
139
+
140
+
141
+ /**
142
+ * Defines the type of the unit.
143
+ */
144
+ enum UnitType {
145
+ Alive,
146
+ Dead,
147
+ Zombie
148
+ };
149
+
150
+
151
+ inline ostream& operator << (ostream& out, UnitType c) {
152
+ switch (c) {
153
+ case Alive: out << "Alive"; break;
154
+ case Dead: out << "Dead"; break;
155
+ case Zombie: out << "Zombie"; break;
156
+ default: out << int(c); break;
157
+ }
158
+ return out;
159
+ }
160
+
161
+
162
+ /**
163
+ * Describes an unit on the board and its properties.
164
+ */
165
+ struct Unit {
166
+
167
+ UnitType type; // The type of unit.
168
+ int id; // The unique id of this unit during the game.
169
+ int player; // The player that owns this unit (-1 if is a zombie)
170
+ Pos pos; // The position on the board.
171
+ int rounds_for_zombie; // Rounds before it becomes a zombie (-1 if is not being converted to zombie)
172
+
173
+ /**
174
+ * Default constructor (Alive, -1, -1, (0, 0), -1).
175
+ */
176
+ Unit ();
177
+
178
+ /**
179
+ * Constructor with all defining fields.
180
+ */
181
+ Unit (UnitType t, int i, int pl, Pos p, int r);
182
+
183
+ };
184
+
185
+
186
+ //////// STUDENTS DO NOT NEED TO READ BELOW THIS LINE ////////
187
+
188
+
189
+ /**
190
+ * Enum to encode commands.
191
+ */
192
+ enum CommandType {
193
+ Move
194
+ };
195
+
196
+
197
+ inline ostream& operator << (ostream& out, CommandType c) {
198
+ switch (c) {
199
+ case Move: out << "Move"; break;
200
+ default: out << int(c); break;
201
+ }
202
+ return out;
203
+ }
204
+
205
+
206
+ inline bool dir_ok (Dir dir) {
207
+ return dir >= Down and dir <= LD;
208
+ }
209
+
210
+ inline Pos::Pos ( ) : i(0), j(0) { }
211
+ inline Pos::Pos (int i, int j) : i(i), j(j) { }
212
+
213
+ inline ostream& operator<< (ostream& os, const Pos& p) {
214
+ return os << "(" << p.i << ", " << p.j << ")";
215
+ }
216
+
217
+ inline bool operator== (const Pos& a, const Pos& b) {
218
+ return a.i == b.i and a.j == b.j;
219
+ }
220
+
221
+ inline bool operator!= (const Pos& a, const Pos& b) {
222
+ return not (a == b);
223
+ }
224
+
225
+ inline bool operator< (const Pos& a, const Pos& b) {
226
+ if (a.i != b.i) return a.i < b.i;
227
+ return a.j < b.j;
228
+ }
229
+
230
+ inline Pos& Pos::operator+= (Dir d) {
231
+ switch (d) {
232
+ case Down: ++i; break;
233
+ case DR: ++i; ++j; break;
234
+ case Right: ++j; break;
235
+ case RU: --i; ++j; break;
236
+ case Up: --i; break;
237
+ case UL: --i; --j; break;
238
+ case Left: --j; break;
239
+ case LD: ++i; --j; break;
240
+ default: ; // do nothing
241
+ }
242
+ return *this;
243
+ }
244
+
245
+ inline Pos Pos::operator+ (Dir d) const {
246
+ Pos p = *this;
247
+ p += d;
248
+ return p;
249
+ }
250
+
251
+ inline Pos& Pos::operator+= (Pos p) {
252
+ this->i += p.i;
253
+ this->j += p.j;
254
+ return *this;
255
+ }
256
+
257
+ inline Pos Pos::operator+ (Pos p) const {
258
+ Pos p2 = *this;
259
+ p2 += p;
260
+ return p2;
261
+ }
262
+
263
+
264
+ inline Cell::Cell ( ) :
265
+ type(Street), owner(-1), id(-1), food(false) { }
266
+ inline Cell::Cell (CellType t, int o, int i, bool f) :
267
+ type(t), owner(o), id(i), food(false) { }
268
+
269
+ inline bool Cell::is_empty ( ) const {
270
+ return
271
+ type == Street and
272
+ id == -1 and
273
+ not food;
274
+ }
275
+
276
+ inline bool command_type_ok (CommandType c_type) {
277
+ return c_type == Move;
278
+ }
279
+
280
+
281
+ /**
282
+ * Conversion from command type to char.
283
+ */
284
+ inline char CommandType2char (int t) {
285
+ switch (t) {
286
+ case Move: return 'm';
287
+ default: return '_';
288
+ }
289
+ }
290
+
291
+
292
+ /**
293
+ * Conversion from char to command type.
294
+ */
295
+ inline int char2CommandType (char c) {
296
+ switch (c) {
297
+ case 'm': return Move;
298
+ }
299
+ return -1; // Can't abort: if data were corrupted, master would fail.
300
+ }
301
+
302
+
303
+ /**
304
+ * Conversion from direction to char.
305
+ * u, d, l, r are obvious
306
+ * diagonals are named after the position of letters in the keyboard:
307
+ * qwe
308
+ * asd
309
+ * zxc
310
+ */
311
+ inline char Dir2char (int d) {
312
+ switch (d) {
313
+ case Down: return 'd';
314
+ case DR: return 'c';
315
+ case Right: return 'r';
316
+ case RU: return 'e';
317
+ case Up: return 'u';
318
+ case UL: return 'q';
319
+ case Left: return 'l';
320
+ case LD: return 'z';
321
+ default: return '_';
322
+ }
323
+ }
324
+
325
+ /**
326
+ * Conversion from char to direction.
327
+ */
328
+ inline int char2Dir (char c) {
329
+ switch (c) {
330
+ case 'd': return Down;
331
+ case 'c': return DR;
332
+ case 'r': return Right;
333
+ case 'e': return RU;
334
+ case 'u': return Up;
335
+ case 'q': return UL;
336
+ case 'l': return Left;
337
+ case 'z': return LD;
338
+ }
339
+ return -1; // Can't abort: if data is corrupted, master will fail.
340
+ }
341
+
342
+
343
+ /**
344
+ * Conversion from unit type to char.
345
+ */
346
+ inline char UnitType2char (int t) {
347
+ switch (t) {
348
+ case Alive: return 'a';
349
+ case Dead: return 'd';
350
+ case Zombie: return 'z';
351
+ default: return '_';
352
+ }
353
+ }
354
+
355
+
356
+ /**
357
+ * Conversion from char to unit type.
358
+ */
359
+ inline int char2UnitType (char c) {
360
+ switch (c) {
361
+ case 'a': return Alive;
362
+ case 'd': return Dead;
363
+ case 'z': return Zombie;
364
+ }
365
+ return -1; // Can't abort: if data is corrupted, master will fail.
366
+ }
367
+
368
+
369
+ inline Unit::Unit ()
370
+ : type(Alive), id(-1), player(-1), pos(0, 0), rounds_for_zombie(-1) { }
371
+
372
+ inline Unit::Unit (UnitType t, int i, int pl, Pos p, int r)
373
+ : type(t), id(i), player(pl), pos(p), rounds_for_zombie(r) { }
374
+
375
+
376
+ #endif
377
+
@@ -0,0 +1,3 @@
1
+ //////// STUDENTS DO NOT NEED TO READ BELOW THIS LINE ////////
2
+
3
+ #include "Utils.hh"
@@ -0,0 +1,77 @@
1
+ //////// STUDENTS DO NOT NEED TO READ BELOW THIS LINE ////////
2
+
3
+ #ifndef Utils_hh
4
+ #define Utils_hh
5
+
6
+ #include <cassert>
7
+ #include <climits>
8
+ #include <cstdlib>
9
+ #include <getopt.h>
10
+ #include <string.h>
11
+
12
+ #include <iostream>
13
+ #include <iomanip>
14
+ #include <sstream>
15
+ #include <fstream>
16
+ #include <string>
17
+ #include <queue>
18
+ #include <stack>
19
+ #include <vector>
20
+ #include <map>
21
+ #include <set>
22
+ #include <algorithm>
23
+ #include <numeric>
24
+ #include <cmath>
25
+
26
+ #include "Defs.hh"
27
+
28
+ using namespace std;
29
+
30
+
31
+ /**
32
+ * Contains several useful includes, plus defines for errors and other
33
+ * utilities.
34
+ */
35
+
36
+
37
+ /**
38
+ * Assert with message.
39
+ */
40
+ #define _my_assert(b, s) { if (not (b)) { cerr << "error: " << s << endl; assert(b); } }
41
+
42
+
43
+ /**
44
+ * Macro to specifically indicate when some code is unreachable,
45
+ * so that the compiler doesn't cry when using NDEBUG.
46
+ */
47
+ #define _unreachable() { _my_assert(false, "Unreachable code reached."); }
48
+
49
+
50
+ /**
51
+ * C++11 to_string gives problems with Cygwin, so this is a replacement.
52
+ */
53
+ inline string int_to_string (int i) {
54
+ ostringstream oss;
55
+ oss << i;
56
+ return oss.str();
57
+ }
58
+
59
+ inline string double_to_string (double d) {
60
+ ostringstream oss;
61
+ oss << d;
62
+ return oss.str();
63
+ }
64
+
65
+
66
+ /**
67
+ * C++11 stoi gives problems with Cygwin, so this is a replacement.
68
+ */
69
+ inline int string_to_int (const string& s) {
70
+ istringstream iss(s);
71
+ int i;
72
+ iss >> i;
73
+ return i;
74
+ }
75
+
76
+
77
+ #endif
@@ -0,0 +1,120 @@
1
+ TheWalkingDead 1.0
2
+
3
+ NUM_PLAYERS 4
4
+ NUM_ROUNDS 250
5
+ BOARD_ROWS 60
6
+ BOARD_COLS 60
7
+ NUM_INI_UNITS_PER_CLAN 3
8
+ NUM_INI_ZOMBIES 3
9
+ NUM_INI_FOOD 15
10
+ CLAN_INI_STRENGTH 300
11
+ POINTS_FOR_KILLING_PERSON 50
12
+ POINTS_FOR_KILLING_ZOMBIE 10
13
+ POINTS_PER_OWNED_CELL 1
14
+ FOOD_STRENGTH 20
15
+ ROUNDS_BEFORE_BECOMING_ZOMBIE 5
16
+
17
+ FIXED
18
+
19
+ 000000000011111111112222222222333333333344444444445555555555
20
+ 012345678901234567890123456789012345678901234567890123456789
21
+ 00 ............................................................
22
+ 01 ............................................................
23
+ 02 .....................0......................................
24
+ 03 ............................................................
25
+ 04 ...WWW......................................................
26
+ 05 ...WWW......................................................
27
+ 06 ...WWW..............2.......................................
28
+ 07 ...WWW.....................................0................
29
+ 08 ...WWW.........................................WW...........
30
+ 09 ...WWW.........................................WW...........
31
+ 10 ...WWW.......................1.................WW...........
32
+ 11 ...WWW..............1....0...2.................WW...........
33
+ 12 ...WWW.........................................WW...........
34
+ 13 ...WWW.........................................WW...........
35
+ 14 ...............................................WW...........
36
+ 15 ...............................................WW...........
37
+ 16 .....2.........................................WW...........
38
+ 17 ...............................................WW...........
39
+ 18 .......1.......................................WW...........
40
+ 19 ...............................................WW...........
41
+ 20 ...............................................WW...........
42
+ 21 ...............................................WW...........
43
+ 22 ......WWWWWWWWWWWWWWWWWW.......................WW...........
44
+ 23 ......WWWWWWWWWWWWWWWWWW.......................WW...........
45
+ 24 ...............................................WW...........
46
+ 25 ...............................................WW...........
47
+ 26 ...............................................WW...3.......
48
+ 27 ...............................................WW...........
49
+ 28 ...............................................WW...........
50
+ 29 ...............................................WW...........
51
+ 30 ...............................................WW...........
52
+ 31 ...............................................WW...........
53
+ 32 .........................W.....................WW...........
54
+ 33 .........................W.....................WW...........
55
+ 34 .........................W.....................WW...........
56
+ 35 .........................W.....................WW...........
57
+ 36 .........................W.....................WW...........
58
+ 37 ...........3.............W.....................WW...........
59
+ 38 .........................WWWWWWW............................
60
+ 39 ...............................W............................
61
+ 40 ...............................W........3...................
62
+ 41 ...............................W............................
63
+ 42 ...............................W............................
64
+ 43 .........................WWWWWWW............................
65
+ 44 .........................W..................................
66
+ 45 .........................W..................................
67
+ 46 .........................W..................................
68
+ 47 .........................W..................................
69
+ 48 .........................W..................................
70
+ 49 .........................W..................................
71
+ 50 .........................W..................................
72
+ 51 ............................................................
73
+ 52 ............................................................
74
+ 53 ............................................................
75
+ 54 .................................WWWWWWWWWWWWWWWWW..........
76
+ 55 .................................................W..........
77
+ 56 .................................................W..........
78
+ 57 .................................................W..........
79
+ 58 .................................WWWWWWWWWWWWWWWWW..........
80
+ 59 ............................................................
81
+
82
+ units
83
+ 15
84
+ type id player row column
85
+ a 0 0 2 21
86
+ a 1 0 11 25
87
+ a 2 0 7 43
88
+ a 3 1 10 29
89
+ a 4 1 11 20
90
+ a 5 1 18 7
91
+ a 6 2 6 20
92
+ a 7 2 11 29
93
+ a 8 2 16 5
94
+ a 9 3 26 52
95
+ a 10 3 40 40
96
+ a 11 3 37 11
97
+ z 12 -1 2 9
98
+ z 13 -1 11 17
99
+ z 14 -1 51 37
100
+
101
+
102
+ food
103
+ 15
104
+ row column
105
+ 1 10
106
+ 23 24
107
+ 12 45
108
+ 53 56
109
+ 42 33
110
+ 35 2
111
+ 6 10
112
+ 9 14
113
+ 20 33
114
+ 45 50
115
+ 58 23
116
+ 22 35
117
+ 11 9
118
+ 3 19
119
+ 15 39
120
+
@@ -0,0 +1,17 @@
1
+ TheWalkingDead 1.0
2
+
3
+ NUM_PLAYERS 4
4
+ NUM_ROUNDS 200
5
+ BOARD_ROWS 60
6
+ BOARD_COLS 60
7
+ NUM_INI_UNITS_PER_CLAN 20
8
+ NUM_INI_ZOMBIES 10
9
+ NUM_INI_FOOD 15
10
+ CLAN_INI_STRENGTH 1000
11
+ POINTS_FOR_KILLING_PERSON 50
12
+ POINTS_FOR_KILLING_ZOMBIE 10
13
+ POINTS_PER_OWNED_CELL 1
14
+ FOOD_STRENGTH 50
15
+ ROUNDS_BEFORE_BECOMING_ZOMBIE 5
16
+
17
+ RANDOM