Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v0 source pure

Package hex holds the pure hex geometry of the game: absolute directions, directions relative to a character's facing...

Overview

Package hex holds the pure hex geometry of the game: absolute directions, directions relative to a character's facing, and board adjacency tables.

Constants 3

const HeightDown, HeightObstacle, HeightUpright, HeightWall

 1const (
 2	// HeightDown is a DOWN body counter.
 3	HeightDown Height = 3
 4	// HeightObstacle is an obstacle (36.3) or a window sill (33.5).
 5	HeightObstacle Height = 4
 6	// HeightUpright is an upright counter, a counter on an obstacle (30.32)
 7	// and a hex aimed at (31.3).
 8	HeightUpright Height = 5
 9	// HeightWall is a wall or a treetrunk, higher than anything (33.2, 38.3).
10	HeightWall Height = 10
11)
source

Variables 3

var A

  1var A = &Board{
  2	name: "A",
  3	ids: []string{
  4		"A-A1",
  5		"A-A10",
  6		"A-A11",
  7		"A-A12",
  8		"A-A2",
  9		"A-A3",
 10		"A-A4",
 11		"A-A5",
 12		"A-A6",
 13		"A-A7",
 14		"A-A8",
 15		"A-A9",
 16		"A-B0",
 17		"A-B1",
 18		"A-B10",
 19		"A-B11",
 20		"A-B12",
 21		"A-B2",
 22		"A-B3",
 23		"A-B4",
 24		"A-B5",
 25		"A-B6",
 26		"A-B7",
 27		"A-B8",
 28		"A-B9",
 29		"A-C1",
 30		"A-C10",
 31		"A-C11",
 32		"A-C12",
 33		"A-C2",
 34		"A-C3",
 35		"A-C4",
 36		"A-C5",
 37		"A-C6",
 38		"A-C7",
 39		"A-C8",
 40		"A-C9",
 41		"A-D0",
 42		"A-D1",
 43		"A-D10",
 44		"A-D11",
 45		"A-D12",
 46		"A-D2",
 47		"A-D3",
 48		"A-D4",
 49		"A-D5",
 50		"A-D6",
 51		"A-D7",
 52		"A-D8",
 53		"A-D9",
 54		"A-E1",
 55		"A-E10",
 56		"A-E11",
 57		"A-E12",
 58		"A-E2",
 59		"A-E3",
 60		"A-E4",
 61		"A-E5",
 62		"A-E6",
 63		"A-E7",
 64		"A-E8",
 65		"A-E9",
 66		"A-F0",
 67		"A-F1",
 68		"A-F10",
 69		"A-F11",
 70		"A-F12",
 71		"A-F2",
 72		"A-F3",
 73		"A-F4",
 74		"A-F5",
 75		"A-F6",
 76		"A-F7",
 77		"A-F8",
 78		"A-F9",
 79		"A-G1",
 80		"A-G10",
 81		"A-G11",
 82		"A-G12",
 83		"A-G2",
 84		"A-G3",
 85		"A-G4",
 86		"A-G5",
 87		"A-G6",
 88		"A-G7",
 89		"A-G8",
 90		"A-G9",
 91		"A-H0",
 92		"A-H1",
 93		"A-H10",
 94		"A-H11",
 95		"A-H12",
 96		"A-H2",
 97		"A-H3",
 98		"A-H4",
 99		"A-H5",
100		"A-H6",
101		"A-H7",
102		"A-H8",
103		"A-H9",
104		"A-I1",
105		"A-I10",
106		"A-I11",
107		"A-I11*",
108		"A-I12",
109		"A-I2",
110		"A-I3",
111		"A-I4",
112		"A-I5",
113		"A-I6",
114		"A-I7",
115		"A-I8",
116		"A-I9",
117		"A-J0",
118		"A-J1",
119		"A-J10",
120		"A-J11",
121		"A-J12",
122		"A-J2",
123		"A-J3",
124		"A-J4",
125		"A-J5",
126		"A-J6",
127		"A-J7",
128		"A-J8",
129		"A-J9",
130		"A-K1",
131		"A-K10",
132		"A-K11",
133		"A-K12",
134		"A-K2",
135		"A-K3",
136		"A-K4",
137		"A-K5",
138		"A-K6",
139		"A-K7",
140		"A-K8",
141		"A-K9",
142	},
143	nbr: [][6]int{
144		{-1, 12, 13, 4, -1, -1},
145		{11, 24, 14, 2, -1, -1},
146		{1, 14, 15, 3, -1, -1},
147		{2, 15, 16, -1, -1, -1},
148		{0, 13, 17, 5, -1, -1},
149		{4, 17, 18, 6, -1, -1},
150		{5, 18, 19, 7, -1, -1},
151		{6, 19, 20, 8, -1, -1},
152		{7, 20, 21, 9, -1, -1},
153		{8, 21, 22, 10, -1, -1},
154		{9, 22, 23, 11, -1, -1},
155		{10, 23, 24, 1, -1, -1},
156		{-1, -1, 25, 13, 0, -1},
157		{12, 25, 29, 17, 4, 0},
158		{24, 26, 27, 15, 2, 1},
159		{14, 27, 28, 16, 3, 2},
160		{15, 28, -1, -1, -1, 3},
161		{13, 29, 30, 18, 5, 4},
162		{17, 30, 31, 19, 6, 5},
163		{18, 31, 32, 20, 7, 6},
164		{19, 32, 33, 21, 8, 7},
165		{20, 33, 34, 22, 9, 8},
166		{21, 34, 35, 23, 10, 9},
167		{22, 35, 36, 24, 11, 10},
168		{23, 36, 26, 14, 1, 11},
169		{-1, 37, 38, 29, 13, 12},
170		{36, 49, 39, 27, 14, 24},
171		{26, 39, 40, 28, 15, 14},
172		{27, 40, 41, -1, 16, 15},
173		{25, 38, 42, 30, 17, 13},
174		{29, 42, 43, 31, 18, 17},
175		{30, 43, 44, 32, 19, 18},
176		{31, 44, 45, 33, 20, 19},
177		{32, 45, 46, 34, 21, 20},
178		{33, 46, 47, 35, 22, 21},
179		{34, 47, 48, 36, 23, 22},
180		{35, 48, 49, 26, 24, 23},
181		{-1, -1, 50, 38, 25, -1},
182		{37, 50, 54, 42, 29, 25},
183		{49, 51, 52, 40, 27, 26},
184		{39, 52, 53, 41, 28, 27},
185		{40, 53, -1, -1, -1, 28},
186		{38, 54, 55, 43, 30, 29},
187		{42, 55, 56, 44, 31, 30},
188		{43, 56, 57, 45, 32, 31},
189		{44, 57, 58, 46, 33, 32},
190		{45, 58, 59, 47, 34, 33},
191		{46, 59, 60, 48, 35, 34},
192		{47, 60, 61, 49, 36, 35},
193		{48, 61, 51, 39, 26, 36},
194		{-1, 62, 63, 54, 38, 37},
195		{61, 74, 64, 52, 39, 49},
196		{51, 64, 65, 53, 40, 39},
197		{52, 65, 66, -1, 41, 40},
198		{50, 63, 67, 55, 42, 38},
199		{54, 67, 68, 56, 43, 42},
200		{55, 68, 69, 57, 44, 43},
201		{56, 69, 70, 58, 45, 44},
202		{57, 70, 71, 59, 46, 45},
203		{58, 71, 72, 60, 47, 46},
204		{59, 72, 73, 61, 48, 47},
205		{60, 73, 74, 51, 49, 48},
206		{-1, -1, 75, 63, 50, -1},
207		{62, 75, 79, 67, 54, 50},
208		{74, 76, 77, 65, 52, 51},
209		{64, 77, 78, 66, 53, 52},
210		{65, 78, -1, -1, -1, 53},
211		{63, 79, 80, 68, 55, 54},
212		{67, 80, 81, 69, 56, 55},
213		{68, 81, 82, 70, 57, 56},
214		{69, 82, 83, 71, 58, 57},
215		{70, 83, 84, 72, 59, 58},
216		{71, 84, 85, 73, 60, 59},
217		{72, 85, 86, 74, 61, 60},
218		{73, 86, 76, 64, 51, 61},
219		{-1, 87, 88, 79, 63, 62},
220		{86, 99, 89, 77, 64, 74},
221		{76, 89, 90, 78, 65, 64},
222		{77, 90, 91, -1, 66, 65},
223		{75, 88, 92, 80, 67, 63},
224		{79, 92, 93, 81, 68, 67},
225		{80, 93, 94, 82, 69, 68},
226		{81, 94, 95, 83, 70, 69},
227		{82, 95, 96, 84, 71, 70},
228		{83, 96, 97, 85, 72, 71},
229		{84, 97, 98, 86, 73, 72},
230		{85, 98, 99, 76, 74, 73},
231		{-1, -1, 100, 88, 75, -1},
232		{87, 100, 105, 92, 79, 75},
233		{99, 101, 103, 90, 77, 76},
234		{89, 103, 104, 91, 78, 77},
235		{90, 104, -1, -1, -1, 78},
236		{88, 105, 106, 93, 80, 79},
237		{92, 106, 107, 94, 81, 80},
238		{93, 107, 108, 95, 82, 81},
239		{94, 108, 109, 96, 83, 82},
240		{95, 109, 110, 97, 84, 83},
241		{96, 110, 111, 98, 85, 84},
242		{97, 111, 112, 99, 86, 85},
243		{98, 112, 101, 89, 76, 86},
244		{-1, 113, 114, 105, 88, 87},
245		{112, 125, 115, 103, 89, 99},
246		{103, 115, 116, 104, 90, 103},
247		{101, 115, 102, 102, 90, 89},
248		{102, 116, 117, -1, 91, 90},
249		{100, 114, 118, 106, 92, 88},
250		{105, 118, 119, 107, 93, 92},
251		{106, 119, 120, 108, 94, 93},
252		{107, 120, 121, 109, 95, 94},
253		{108, 121, 122, 110, 96, 95},
254		{109, 122, 123, 111, 97, 96},
255		{110, 123, 124, 112, 98, 97},
256		{111, 124, 125, 101, 99, 98},
257		{-1, -1, 126, 114, 100, -1},
258		{113, 126, 130, 118, 105, 100},
259		{125, 127, 128, 116, 103, 101},
260		{115, 128, 129, 117, 104, 102},
261		{116, 129, -1, -1, -1, 104},
262		{114, 130, 131, 119, 106, 105},
263		{118, 131, 132, 120, 107, 106},
264		{119, 132, 133, 121, 108, 107},
265		{120, 133, 134, 122, 109, 108},
266		{121, 134, 135, 123, 110, 109},
267		{122, 135, 136, 124, 111, 110},
268		{123, 136, 137, 125, 112, 111},
269		{124, 137, 127, 115, 101, 112},
270		{-1, -1, -1, 130, 114, 113},
271		{137, -1, -1, 128, 115, 125},
272		{127, -1, -1, 129, 116, 115},
273		{128, -1, -1, -1, 117, 116},
274		{126, -1, -1, 131, 118, 114},
275		{130, -1, -1, 132, 119, 118},
276		{131, -1, -1, 133, 120, 119},
277		{132, -1, -1, 134, 121, 120},
278		{133, -1, -1, 135, 122, 121},
279		{134, -1, -1, 136, 123, 122},
280		{135, -1, -1, 137, 124, 123},
281		{136, -1, -1, 127, 125, 124},
282	},
283	qr: [][2]int{
284		{0, 0},
285		{0, 9},
286		{0, 10},
287		{0, 11},
288		{0, 1},
289		{0, 2},
290		{0, 3},
291		{0, 4},
292		{0, 5},
293		{0, 6},
294		{0, 7},
295		{0, 8},
296		{1, -1},
297		{1, 0},
298		{1, 9},
299		{1, 10},
300		{1, 11},
301		{1, 1},
302		{1, 2},
303		{1, 3},
304		{1, 4},
305		{1, 5},
306		{1, 6},
307		{1, 7},
308		{1, 8},
309		{2, -1},
310		{2, 8},
311		{2, 9},
312		{2, 10},
313		{2, 0},
314		{2, 1},
315		{2, 2},
316		{2, 3},
317		{2, 4},
318		{2, 5},
319		{2, 6},
320		{2, 7},
321		{3, -2},
322		{3, -1},
323		{3, 8},
324		{3, 9},
325		{3, 10},
326		{3, 0},
327		{3, 1},
328		{3, 2},
329		{3, 3},
330		{3, 4},
331		{3, 5},
332		{3, 6},
333		{3, 7},
334		{4, -2},
335		{4, 7},
336		{4, 8},
337		{4, 9},
338		{4, -1},
339		{4, 0},
340		{4, 1},
341		{4, 2},
342		{4, 3},
343		{4, 4},
344		{4, 5},
345		{4, 6},
346		{5, -3},
347		{5, -2},
348		{5, 7},
349		{5, 8},
350		{5, 9},
351		{5, -1},
352		{5, 0},
353		{5, 1},
354		{5, 2},
355		{5, 3},
356		{5, 4},
357		{5, 5},
358		{5, 6},
359		{6, -3},
360		{6, 6},
361		{6, 7},
362		{6, 8},
363		{6, -2},
364		{6, -1},
365		{6, 0},
366		{6, 1},
367		{6, 2},
368		{6, 3},
369		{6, 4},
370		{6, 5},
371		{7, -4},
372		{7, -3},
373		{7, 6},
374		{7, 7},
375		{7, 8},
376		{7, -2},
377		{7, -1},
378		{7, 0},
379		{7, 1},
380		{7, 2},
381		{7, 3},
382		{7, 4},
383		{7, 5},
384		{8, -4},
385		{8, 5},
386		{8, 6},
387		{8, 6},
388		{8, 7},
389		{8, -3},
390		{8, -2},
391		{8, -1},
392		{8, 0},
393		{8, 1},
394		{8, 2},
395		{8, 3},
396		{8, 4},
397		{9, -5},
398		{9, -4},
399		{9, 5},
400		{9, 6},
401		{9, 7},
402		{9, -3},
403		{9, -2},
404		{9, -1},
405		{9, 0},
406		{9, 1},
407		{9, 2},
408		{9, 3},
409		{9, 4},
410		{10, -5},
411		{10, 4},
412		{10, 5},
413		{10, 6},
414		{10, -4},
415		{10, -3},
416		{10, -2},
417		{10, -1},
418		{10, 0},
419		{10, 1},
420		{10, 2},
421		{10, 3},
422	},
423	fence: []uint8{
424		0,
425		0,
426		0,
427		0,
428		0,
429		0,
430		4,
431		6,
432		6,
433		6,
434		6,
435		2,
436		0,
437		0,
438		0,
439		0,
440		0,
441		0,
442		12,
443		49,
444		48,
445		48,
446		48,
447		56,
448		3,
449		0,
450		3,
451		0,
452		0,
453		0,
454		12,
455		33,
456		0,
457		0,
458		0,
459		0,
460		24,
461		0,
462		0,
463		3,
464		0,
465		0,
466		12,
467		33,
468		0,
469		0,
470		0,
471		0,
472		0,
473		24,
474		0,
475		24,
476		1,
477		0,
478		8,
479		33,
480		0,
481		0,
482		0,
483		0,
484		0,
485		0,
486		0,
487		0,
488		0,
489		0,
490		0,
491		0,
492		0,
493		0,
494		0,
495		0,
496		0,
497		0,
498		0,
499		0,
500		12,
501		1,
502		0,
503		8,
504		3,
505		0,
506		0,
507		0,
508		0,
509		0,
510		0,
511		0,
512		0,
513		33,
514		0,
515		0,
516		24,
517		3,
518		0,
519		0,
520		0,
521		0,
522		0,
523		12,
524		0,
525		33,
526		0,
527		0,
528		0,
529		0,
530		24,
531		3,
532		0,
533		0,
534		0,
535		0,
536		12,
537		0,
538		0,
539		0,
540		0,
541		0,
542		0,
543		24,
544		7,
545		6,
546		6,
547		6,
548		14,
549		33,
550		0,
551		0,
552		0,
553		0,
554		0,
555		0,
556		16,
557		48,
558		48,
559		48,
560		48,
561		32,
562	},
563	obstacles: []int{
564		103,
565	},
566	between: [][3]int{
567		{0, 102, 0},
568		{0, 116, 0},
569		{0, 117, 0},
570		{1, 102, 0},
571		{1, 128, 0},
572		{2, 102, 0},
573		{2, 128, 0},
574		{3, 102, 0},
575		{3, 128, 0},
576		{4, 102, 0},
577		{4, 116, 0},
578		{4, 117, 0},
579		{5, 102, 0},
580		{5, 116, 0},
581		{5, 117, 0},
582		{6, 102, 0},
583		{6, 116, 0},
584		{6, 117, 0},
585		{6, 129, 0},
586		{7, 102, 0},
587		{7, 116, 0},
588		{7, 129, 0},
589		{8, 102, 0},
590		{8, 116, 0},
591		{8, 129, 0},
592		{9, 102, 0},
593		{9, 116, 0},
594		{9, 129, 0},
595		{10, 102, 0},
596		{10, 116, 0},
597		{10, 129, 0},
598		{11, 102, 0},
599		{11, 116, 0},
600		{11, 128, 0},
601		{12, 102, 0},
602		{12, 117, 0},
603		{13, 102, 0},
604		{13, 117, 0},
605		{14, 102, 0},
606		{14, 128, 0},
607		{15, 102, 0},
608		{15, 128, 0},
609		{17, 102, 0},
610		{17, 116, 0},
611		{17, 117, 0},
612		{18, 102, 0},
613		{18, 116, 0},
614		{18, 117, 0},
615		{19, 102, 0},
616		{19, 116, 0},
617		{19, 117, 0},
618		{19, 129, 0},
619		{20, 102, 0},
620		{20, 116, 0},
621		{20, 129, 0},
622		{21, 102, 0},
623		{21, 116, 0},
624		{21, 129, 0},
625		{22, 102, 0},
626		{22, 116, 0},
627		{22, 129, 0},
628		{23, 102, 0},
629		{23, 116, 0},
630		{23, 129, 0},
631		{24, 102, 0},
632		{24, 116, 0},
633		{24, 128, 0},
634		{25, 102, 0},
635		{25, 117, 0},
636		{26, 102, 0},
637		{26, 116, 0},
638		{26, 128, 0},
639		{27, 102, 0},
640		{27, 128, 0},
641		{29, 102, 0},
642		{29, 117, 0},
643		{30, 102, 0},
644		{30, 116, 0},
645		{30, 117, 0},
646		{31, 102, 0},
647		{31, 116, 0},
648		{31, 117, 0},
649		{32, 102, 0},
650		{32, 116, 0},
651		{32, 117, 0},
652		{33, 102, 0},
653		{33, 116, 0},
654		{33, 117, 0},
655		{33, 129, 0},
656		{34, 102, 0},
657		{34, 116, 0},
658		{34, 129, 0},
659		{35, 102, 0},
660		{35, 116, 0},
661		{35, 129, 0},
662		{36, 102, 0},
663		{36, 116, 0},
664		{36, 128, 0},
665		{36, 129, 0},
666		{37, 102, 0},
667		{37, 104, 0},
668		{37, 117, 0},
669		{38, 102, 0},
670		{38, 104, 0},
671		{38, 117, 0},
672		{39, 102, 0},
673		{39, 128, 0},
674		{40, 102, 0},
675		{40, 128, 0},
676		{42, 102, 0},
677		{42, 117, 0},
678		{43, 102, 0},
679		{43, 117, 0},
680		{44, 102, 0},
681		{44, 116, 0},
682		{44, 117, 0},
683		{45, 102, 0},
684		{45, 116, 0},
685		{45, 117, 0},
686		{46, 102, 0},
687		{46, 116, 0},
688		{46, 117, 0},
689		{46, 129, 0},
690		{47, 102, 0},
691		{47, 116, 0},
692		{47, 129, 0},
693		{48, 102, 0},
694		{48, 116, 0},
695		{48, 129, 0},
696		{49, 102, 0},
697		{49, 116, 0},
698		{49, 128, 0},
699		{49, 129, 0},
700		{50, 102, 0},
701		{50, 104, 0},
702		{50, 117, 0},
703		{51, 102, 0},
704		{51, 116, 0},
705		{51, 128, 0},
706		{51, 129, 0},
707		{52, 102, 0},
708		{52, 128, 0},
709		{54, 102, 0},
710		{54, 104, 0},
711		{54, 117, 0},
712		{55, 102, 0},
713		{55, 104, 0},
714		{55, 117, 0},
715		{56, 102, 0},
716		{56, 104, 0},
717		{56, 117, 0},
718		{57, 102, 0},
719		{57, 117, 0},
720		{58, 102, 0},
721		{58, 116, 0},
722		{58, 117, 0},
723		{59, 102, 0},
724		{59, 116, 0},
725		{59, 117, 0},
726		{60, 102, 0},
727		{60, 116, 0},
728		{60, 129, 0},
729		{61, 102, 0},
730		{61, 116, 0},
731		{61, 129, 0},
732		{62, 102, 0},
733		{62, 104, 0},
734		{63, 102, 0},
735		{63, 104, 0},
736		{64, 102, 0},
737		{64, 116, 0},
738		{64, 128, 0},
739		{65, 102, 0},
740		{66, 127, 0},
741		{67, 102, 0},
742		{67, 104, 0},
743		{67, 117, 0},
744		{68, 102, 0},
745		{68, 104, 0},
746		{68, 117, 0},
747		{69, 102, 0},
748		{69, 104, 0},
749		{69, 117, 0},
750		{70, 102, 0},
751		{70, 104, 0},
752		{70, 117, 0},
753		{71, 102, 0},
754		{71, 117, 0},
755		{72, 102, 0},
756		{72, 116, 0},
757		{72, 117, 0},
758		{73, 102, 0},
759		{73, 116, 0},
760		{73, 117, 0},
761		{73, 129, 0},
762		{74, 102, 0},
763		{74, 116, 0},
764		{74, 129, 0},
765		{75, 102, 0},
766		{75, 104, 0},
767		{76, 102, 0},
768		{76, 116, 0},
769		{76, 128, 0},
770		{76, 129, 0},
771		{77, 102, 0},
772		{77, 128, 0},
773		{78, 115, 0},
774		{79, 102, 0},
775		{79, 104, 0},
776		{80, 102, 0},
777		{80, 104, 0},
778		{81, 102, 0},
779		{81, 104, 0},
780		{82, 102, 0},
781		{82, 104, 0},
782		{82, 117, 0},
783		{83, 102, 0},
784		{83, 104, 0},
785		{83, 117, 0},
786		{84, 102, 0},
787		{84, 104, 0},
788		{84, 117, 0},
789		{85, 102, 0},
790		{85, 104, 0},
791		{85, 116, 0},
792		{85, 117, 0},
793		{86, 102, 0},
794		{86, 116, 0},
795		{86, 117, 0},
796		{86, 129, 0},
797		{87, 102, 0},
798		{87, 104, 0},
799		{88, 102, 0},
800		{88, 104, 0},
801		{89, 102, 0},
802		{89, 104, 0},
803		{89, 116, 0},
804		{89, 117, 0},
805		{89, 128, 0},
806		{89, 129, 0},
807		{91, 101, 0},
808		{91, 123, 0},
809		{91, 124, 0},
810		{91, 125, 0},
811		{91, 132, 0},
812		{91, 133, 0},
813		{91, 134, 0},
814		{91, 135, 0},
815		{91, 136, 0},
816		{92, 102, 0},
817		{92, 104, 0},
818		{93, 102, 0},
819		{93, 104, 0},
820		{94, 102, 0},
821		{94, 104, 0},
822		{95, 102, 0},
823		{95, 104, 0},
824		{96, 102, 0},
825		{96, 104, 0},
826		{97, 102, 0},
827		{97, 104, 0},
828		{97, 117, 0},
829		{98, 102, 0},
830		{98, 104, 0},
831		{98, 117, 0},
832		{99, 102, 0},
833		{99, 104, 0},
834		{99, 116, 0},
835		{99, 117, 0},
836		{100, 102, 0},
837		{100, 104, 0},
838		{101, 102, 0},
839		{101, 104, 0},
840		{101, 117, 0},
841		{102, 105, 0},
842		{102, 106, 0},
843		{102, 107, 0},
844		{102, 108, 0},
845		{102, 109, 0},
846		{102, 110, 0},
847		{102, 111, 0},
848		{102, 112, 0},
849		{102, 113, 0},
850		{102, 114, 0},
851		{102, 118, 0},
852		{102, 119, 0},
853		{102, 120, 0},
854		{102, 121, 0},
855		{102, 122, 0},
856		{102, 123, 0},
857		{102, 124, 0},
858		{102, 125, 0},
859		{102, 126, 0},
860		{102, 130, 0},
861		{102, 131, 0},
862		{102, 132, 0},
863		{102, 133, 0},
864		{102, 134, 0},
865		{102, 135, 0},
866		{102, 136, 0},
867		{104, 105, 0},
868		{104, 106, 0},
869		{104, 107, 0},
870		{104, 108, 0},
871		{104, 109, 0},
872		{104, 110, 0},
873		{104, 111, 0},
874		{104, 112, 0},
875		{104, 113, 0},
876		{104, 114, 0},
877		{104, 118, 0},
878		{104, 119, 0},
879		{104, 120, 0},
880		{104, 121, 0},
881		{104, 122, 0},
882		{104, 123, 0},
883		{104, 124, 0},
884		{104, 126, 0},
885		{104, 130, 0},
886		{104, 131, 0},
887		{104, 132, 0},
888		{104, 133, 0},
889	},
890}
source

A is board A ("Corral"): 138 flat-top hexes in offset vertical columns. ids is sorted so Index can binary-search it; nbr holds, for each hex, the index of its neighbour in each of the 6 directions (N, NE, SE, S, SW, NW), or -1 when the hex is on the board edge; qr holds its axial coordinates; fence holds its fenced hexsides, bit d for direction d (rule 35); obstacles lists the indices of the obstacle hexes (rule 36); between lists the hex pairs an obstacle lies between for the line of sight (rule 31), as {a, b, o}: a < b indices in ids, o an index in obstacles, sorted by (a, b, o).

var AheadRels

1var AheadRels = [3]Rel{AheadLeft, Ahead, AheadRight}
source

AheadRels are the three forward directions a move_ahead/turn_ahead card offers.

var BackRels

1var BackRels = [3]Rel{BackLeft, Back, BackRight}
source

BackRels are the three backward directions a move_back/turn_back card offers.

Functions 4

func AheadDirs

1func AheadDirs(f Dir) [3]Dir
source

AheadDirs returns the absolute directions of ahead_left, ahead and ahead_right for a facing; these are also the aim-zone spokes (rule 8.32).

func BackDirs

1func BackDirs(f Dir) [3]Dir
source

BackDirs returns the absolute directions of back_left, back and back_right.

func Resolve

1func Resolve(facing Dir, r Rel) Dir
source

Resolve turns a relative direction into an absolute one for a facing.

func ParseRel

1func ParseRel(s string) (Rel, bool)
source

ParseRel converts a plan string token to a Rel.

Types 4

type Board

struct
 1type Board struct {
 2	name      string
 3	ids       []string
 4	nbr       [][6]int
 5	qr        [][2]int // axial coordinates (q, r) of ids[i], see geom.gno
 6	fence     []uint8  // fenced hexsides of ids[i]: bit d for direction d (rule 35)
 7	obstacles []int    // indices of the obstacle hexes (rule 36)
 8	// between lists the hex pairs an obstacle lies between for the line of
 9	// sight (rule 31), computed by the generator from the printed coordinates
10	// and the obstacle's outline on the board image: {a, b, o} with a < b
11	// indices in ids and o an index in obstacles, sorted by (a, b, o).
12	between [][3]int
13}
source

Board is the adjacency table of one game board. ids is sorted so lookups can binary-search it; nbr[i][d] is the index in ids of the neighbour of ids[i] in direction d, or -1 when the board edge lies that way.

Boards are generated by scripts/gen_board_data.py and never mutated, so sharing *Board values is safe.

Methods on Board

func Between

method on Board
1func (b *Board) Between(from, to string) []string
source

Between returns the obstacle hexes lying between two hexes for the line of sight (rule 31): those every string from one hex's printed coordinate to the other's passes through (31.2, 36.3), as the generator computed them from the board image into the between table. The order of the two hexes does not matter. It is nil when nothing lies between them, when they are the same hex or when either is unknown, and it never names one of the two hexes (36.5).

func Coords

method on Board
1func (b *Board) Coords(id string) (q, r int, ok bool)
source

Coords returns the axial coordinates of a hex.

func Distance

method on Board
1func (b *Board) Distance(from, to string) int
source

Distance is the range between two hexes in hexes along the shortest route over the board (rule 13.51), or -1 when either hex is unknown.

func Fenced

method on Board
1func (b *Board) Fenced(id string, d Dir) bool
source

Fenced reports whether a fence or hitching post (rule 35) runs along the hexside of id in direction d, so that moving or staggering across it costs two delay cards.

func Has

method on Board
1func (b *Board) Has(id string) bool
source

Has reports whether id is a hex of this board.

func IDs

method on Board
1func (b *Board) IDs() []string
source

IDs returns a copy of the sorted hex ids.

func InAimZone

method on Board
1func (b *Board) InAimZone(from string, f Dir, target string) bool
source

InAimZone reports whether target lies in the aim zone of a character at from facing f (rule 8.32): its own hex and every hex in or between its ahead-left and ahead-right rows, i.e. the 120° cone spanned by those two directions.

func Index

method on Board
1func (b *Board) Index(id string) int
source

Index returns the position of id in the sorted id list, or -1.

func LineOfSight

method on Board
1func (b *Board) LineOfSight(from, to string, hFrom, hTo Height) (clear bool, blocker string)
source

LineOfSight reports whether a character at from, of height hFrom, has a clear line of sight to a target at to, of height hTo (rule 31). Every obstacle lying between the two hexes is compared with the two heights (31.3): it blocks the sight when higher than both and not when lower than both (31.31); when it is between the two heights it blocks only if the lower end is adjacent to it (31.32; the plateau effect of 31.33 needs hill or gully hexes, which no board has yet). The aim zone is not looked at here: 31.21 is InAimZone. blocker is the first obstacle blocking the sight, "" when it is clear or a hex is unknown (which blocks).

func LongDir

method on Board
1func (b *Board) LongDir(shooter, target string, shooterFacing Dir) Dir
source

LongDir is the direction from target that continues the line drawn from shooter through target (rule 14.32): the "Long" hex of a direction card is the target's neighbour that way. When the line runs between two hexes the one closest to it wins, lowest direction first; in a shared hex it is the shooter's facing.

func Name

method on Board
1func (b *Board) Name() string
source

Name returns the board letter, e.g. "A".

func Neighbor

method on Board
1func (b *Board) Neighbor(id string, d Dir) (nb string, ok bool)
source

Neighbor returns the hex adjacent to id in direction d. ok is false when id is unknown, d is invalid, or the board edge lies in that direction.

func Neighbors

method on Board
1func (b *Board) Neighbors(id string) [6]string
source

Neighbors returns the six neighbours of id in direction order; an empty string marks the board edge. An unknown id yields six empty strings.

func Obstacle

method on Board
1func (b *Board) Obstacle(id string) bool
source

Obstacle reports whether id is an obstacle hex (rule 36: a trough, a table...), so that moving or staggering onto or off it costs two delay cards.

func Size

method on Board
1func (b *Board) Size() int
source

Size returns the number of hexes.

type Dir

ident
1type Dir int
source

Dir is an absolute direction on a flat-top hex grid laid out in vertical columns: 0=N 1=NE 2=SE 3=S 4=SW 5=NW.

Methods on Dir

func Opposite

method on Dir
1func (d Dir) Opposite() Dir
source

Opposite returns the direction pointing back at d.

func Step

method on Dir
1func (d Dir) Step() (q, r int)
source

Step returns the axial (q, r) offset of one hex in direction d.

func String

method on Dir
1func (d Dir) String() string
source

String returns the compass name of d.

func Valid

method on Dir
1func (d Dir) Valid() bool
source

Valid reports whether d is one of the six directions.

type Height

ident
1type Height int
source

Height is the height of a counter or of a terrain feature for the line of sight (rule 31.3, the HEIGHTS table), at ground elevation: a higher number is higher on the map. Hill and gully elevations come with the boards that have them.

type Rel

ident
1type Rel string
source

Rel is a direction relative to a character's facing, as chosen on a move or turn card. The names are the ones the client and the plan string use. Same and Long only appear on the HEX line of result cards (direction cards, rule 14.3, relative to the target's body counter): they are not movement choices, ParseRel rejects them and Offset panics on them.

Methods on Rel

func IsAhead

method on Rel
1func (r Rel) IsAhead() bool
source

IsAhead reports whether r is one of the three forward directions.

func IsBack

method on Rel
1func (r Rel) IsBack() bool
source

IsBack reports whether r is one of the three backward directions.

func Offset

method on Rel
1func (r Rel) Offset() int
source

Offset is the number of 60° clockwise steps from the facing to r (ahead_left=5 ahead=0 ahead_right=1 back_right=2 back=3 back_left=4). Left and right are the character's own sides while it keeps facing forward: facing N, back_right is SE and back_left is SW.

Dependencies

Imports 2

/p/g1th0masp67zfs9lg6d34qhghldhg6kjcqjuv7c2/gnoslinger/hex/v0

Imported by indexer

Source Files 6