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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
|
extends Node
var panel_mapping = []
var painting_mapping = []
var gen_seed
var is_set_seed = false
var _generated_puzzles
var _answer_by_id
var _answers_by_type
var _answers_by_length
var _puzzle_by_id
var _rng
var _flags = 0
var _total_generated = 0
var _hint_by_path = {}
var _answer_by_path = {}
var _painting_puzzles = []
var _unique_pool = ""
var _answers_by_unique_pool = {}
var _needs_reuse = []
var _possible_reuse = []
const kWhiteMiddle = -1
const kWhiteTop = 0
const kWhiteBottom = 1
const kYellowTop = 2
const kYellowMiddle = 3
const kBlackTop = 4
const kBlackMiddle = 5
const kBlackBottom = 6
const kDoubleBlackBottom = 7
const kRedTop = 8
const kRedMiddle = 9
const kRedBottom = 10
const kBlueTop = 11
const kBlueMiddle = 12
const kBlueBottom = 13
const kPurpleTop = 14
const kPurpleMiddle = 15
const kPuzzleTypes = [
kWhiteMiddle,
kWhiteTop,
kWhiteBottom,
kYellowTop,
kYellowMiddle,
kBlackTop,
kBlackMiddle,
kBlackBottom,
kDoubleBlackBottom,
kRedTop,
kRedMiddle,
kRedBottom,
kBlueTop,
kBlueMiddle,
kBlueBottom,
kPurpleTop,
kPurpleMiddle
]
const kMustReuseAnswer = 1
const kObscureHint = 2
const kShortAnswer = 4
signal generator_status
func _init(gen_puzzles):
_generated_puzzles = gen_puzzles
func generate(chosen_seed):
emit_signal("generator_status", "Generating puzzles...")
_flags = 0
_total_generated = 0
# Seed the random number generator.
if chosen_seed == "":
var seed_rng = RandomNumberGenerator.new()
seed_rng.randomize()
gen_seed = seed_rng.randi_range(0, 999999)
is_set_seed = false
else:
gen_seed = int(chosen_seed)
is_set_seed = true
_rng = RandomNumberGenerator.new()
_rng.seed = gen_seed
# Create some helpful indexes.
_answer_by_id = []
_answers_by_type = {}
_answers_by_length = {}
_puzzle_by_id = []
_hint_by_path = {}
_answer_by_path = {}
_painting_puzzles = _generated_puzzles.paintings
var openable_answers = []
for puzzle_type in kPuzzleTypes:
_answers_by_type[puzzle_type] = []
var puzzle_id = 0
for puzzle in _generated_puzzles.forms:
_answers_by_type[kWhiteMiddle].append(puzzle_id)
match typeof(puzzle):
TYPE_ARRAY:
_answer_by_id.append(puzzle[0])
if not _answers_by_length.has(puzzle[0].length()):
_answers_by_length[puzzle[0].length()] = []
_answers_by_length[puzzle[0].length()].append(puzzle_id)
_puzzle_by_id.append(puzzle)
for puzzle_type in puzzle[1].keys():
_answers_by_type[puzzle_type].append(puzzle_id)
if (
puzzle[1].has(kYellowMiddle)
and puzzle[1].has(kBlackBottom)
and puzzle[1].has(kRedMiddle)
and puzzle[1].has(kBlueMiddle)
and puzzle[1].has(kPurpleMiddle)
):
openable_answers.append(puzzle_id)
TYPE_STRING:
_answer_by_id.append(puzzle)
if not _answers_by_length.has(puzzle.length()):
_answers_by_length[puzzle.length()] = []
_answers_by_length[puzzle.length()].append(puzzle_id)
_puzzle_by_id.append([puzzle, []])
puzzle_id += 1
# Choose the answer for the OPEN panels.
# There is a hedge maze OPEN but we can't randomize those yet.
var open_answer_id = _pickRandom(openable_answers)
_setUniquePool("agreeable")
_setPanel(
"Antonym Room/Panel_close_open",
_pickRandom(_puzzle_by_id[open_answer_id][1][kBlackBottom]),
open_answer_id
)
_setUniquePool("seeker")
_setFlag(kObscureHint)
_setPanel("Heteronym Room/Panel_entrance_entrance", open_answer_id, open_answer_id)
_clearFlag(kObscureHint)
_setUniquePool("traveled")
_setPanel("Synonym Room/Panel_open_open", open_answer_id, open_answer_id)
_setUniquePool("discerning")
_setPanel(
"Sun Room/Panel_nope_open",
_pickRandom(_puzzle_by_id[open_answer_id][1][kYellowMiddle]),
open_answer_id
)
_setUniquePool("bold")
_setPanel(
"Truncate Room/Panel_unopened_open",
_pickRandom(_puzzle_by_id[open_answer_id][1][kRedMiddle]),
open_answer_id
)
_setUniquePool("undeterred")
_setPanel(
"Blue Room/Panel_pen_open",
_pickRandom(_puzzle_by_id[open_answer_id][1][kBlueMiddle]),
open_answer_id
)
_setUniquePool("initiated")
_setPanel(
"Rhyme Room/Panel_locked_knocked",
_pickRandom(_puzzle_by_id[open_answer_id][1][kPurpleMiddle]),
open_answer_id
)
_setUniquePool("scientific")
_setPanel("Chemistry Room/Panel_open", open_answer_id, open_answer_id)
_setPanel(
"Chemistry Room/Panel_close",
_pickRandom(_puzzle_by_id[open_answer_id][1][kBlackBottom]),
open_answer_id
)
# Start generating puzzles that need to have reused solutions.
_setFlag(kMustReuseAnswer)
_setUniquePool("agreeable")
_gSingle("Antonym Room/Panel_read_write", kBlackBottom)
_gSingle("Antonym Room/Panel_different_same", kBlackBottom)
_gSingle("Antonym Room/Panel_bye_hi", kBlackBottom)
_gSingle("Antonym Room/Panel_low_high", kBlackBottom)
_gSingle("Antonym Room/Panel_alive_dead", kBlackBottom)
_gSingle("Antonym Room/Panel_that_this", kBlackBottom)
_gSingle("Doorways Room/Panel_found_lost", kBlackBottom)
_setUniquePool("bold")
_gDouble("Truncate Room/Panel_face_eye", "Truncate Room/Panel_needle_eye", kRedBottom)
_gDouble("Truncate Room/Panel_mouth_teeth", "Truncate Room/Panel_saw_teeth", kRedBottom)
_gSingle("Truncate Room/Panel_foot_toe", kRedBottom)
_gSingle("Truncate Room/Panel_hand_finger", kRedBottom)
_gSingle("Doorways Room/Panel_loaf_crust", kRedBottom)
_setUniquePool("undeterred")
_gSingle("Blue Room/Panel_two_toucan", kBlueTop)
_gDouble("Blue Room/Panel_ice_eyesight", "Blue Room/Panel_height_eyesight", kBlueTop)
_gSingle("Blue Room/Panel_eye_hi", kBlueTop)
_gSingle("Blue Room/Panel_not_notice", kBlueMiddle)
_gDouble("Blue Room/Panel_just_readjust", "Blue Room/Panel_read_readjust", kBlueMiddle)
_gSingle("Blue Room/Panel_ate_primate", kBlueMiddle)
_gSingle("Blue Room/Panel_bone_skeleton", kBlueBottom)
_gDouble("Blue Room/Panel_mouth_face", "Blue Room/Panel_eye_face", kBlueBottom)
_gSingle("Blue Room/Panel_toucan_bird", kBlueBottom)
_gSingle("Blue Room/Panel_primate_mammal", kBlueBottom)
_gDouble("Blue Room/Panel_continent_planet", "Blue Room/Panel_ocean_planet", kBlueBottom)
_gSingle("Blue Room/Panel_wall_room", kBlueBottom)
_gSingle("Doorways Room/Panel_sun_sky", kBlueBottom)
_setUniquePool("traveled")
_gSingle("Synonym Room/Panel_close_near", kWhiteBottom)
_gSingle("Synonym Room/Panel_category_type", kWhiteBottom)
_gSingle("Synonym Room/Panel_distant_far", kWhiteBottom)
_gSingle("Synonym Room/Panel_hay_straw", kWhiteBottom)
_gSingle("Synonym Room/Panel_snitch_rat", kWhiteBottom)
_gSingle("Synonym Room/Panel_concealed_hidden", kWhiteBottom)
_gSingle("Synonym Room/Panel_growths_warts", kWhiteBottom)
_gSingle("Synonym Room/Panel_hello_hi", kWhiteBottom)
_gDouble("Synonym Room/Panel_compose_write", "Synonym Room/Panel_record_write", kWhiteBottom)
_gDouble("Synonym Room/Panel_duplicate_same", "Synonym Room/Panel_identical_same", kWhiteBottom)
_gDouble("Synonym Room/Panel_giggle_laugh", "Synonym Room/Panel_chuckle_laugh", kWhiteBottom)
_gDouble("Synonym Room/Panel_plunge_fall", "Synonym Room/Panel_autumn_fall", kWhiteBottom)
_gSingle("Doorways Room/Panel_begin_start", kWhiteBottom)
_setUniquePool("initiated")
_gSingle("Rhyme Room/Panel_daughter_laughter", kPurpleMiddle)
_gSingle("Rhyme Room/Panel_scope_type", kPurpleMiddle)
_gSingle("Rhyme Room/Panel_abyss_this", kPurpleMiddle)
_gSingle("Rhyme Room/Panel_wrath_path", kPurpleMiddle)
_gSingle("Rhyme Room/Panel_bed_dead", kPurpleMiddle)
_gSingle("Rhyme Room/Panel_alumni_hi", kPurpleTop)
_gSingle("Rhyme Room/Panel_maim_same", kPurpleTop)
_gSingle("Rhyme Room/Panel_bare_bear", kPurpleTop)
_gDouble("Rhyme Room/Panel_move_love", "Rhyme Room/Panel_stove_love", kPurpleMiddle)
_gDouble("Rhyme Room/Panel_sweat_great", "Rhyme Room/Panel_beat_great", kPurpleMiddle)
_gDouble("Rhyme Room/Panel_knight_write", "Rhyme Room/Panel_byte_write", kPurpleTop)
# Panel_chair_bear, Panel_cost_most (cyborg)
_setUniquePool("fearless")
_gSingle("Naps Room/Panel_easy_soft", kDoubleBlackBottom)
_gSingle("Naps Room/Panel_sometimes_always", kDoubleBlackBottom)
_gSingle("Naps Room/Panel_dark_extinguish", kDoubleBlackBottom)
_gSingle("Naps Room/Panel_impatient_doctor", kDoubleBlackBottom)
_gSingle("Naps Room/Panel_even_ordinary", kDoubleBlackBottom)
_setUniquePool("unchallenged")
_gSingle("Challenge Room/Panel_singed_singsong", kPurpleMiddle)
_gSingle("Challenge Room/Panel_nevertrusted_maladjusted", kPurpleMiddle)
_gSingle("Challenge Room/Panel_writer_songwriter", kBlueMiddle)
_gSingle("Challenge Room/Panel_lobs_lobster", kBlueMiddle)
_setUniquePool("red")
_gSingle("Hangry Room/Panel_red_bot_1", kRedBottom)
_gSingle("Hangry Room/Panel_red_bot_2", kRedBottom)
_gSingle("Hangry Room/Panel_red_bot_3", kRedBottom)
_gSingle("Hangry Room/Panel_red_bot_6", kRedBottom)
# Do must-reuse panels with no unique pool last so that we can reuse already chosen answers.
_clearUniquePool()
_gSingle("Symmetry Room/Panel_left_wrong", kDoubleBlackBottom)
_gSingle("Symmetry Room/Panel_black_white", kBlackBottom)
_gSingle("Shuffle Room/Panel_lost_found", kBlackBottom)
_gSingle("Shuffle Room/Panel_clockwise_counterclockwise", kBlackBottom)
_gSingle("Shuffle Room/Panel_order_chaos", kBlackBottom)
_gSingle("Maze Room/Panel_down_up", kBlackBottom)
_gSingle("Maze Room/Panel_strays_maze", kPurpleTop)
_gSingle("Maze Room/Panel_daze_maze", kPurpleMiddle)
_gSingle("Maze Room/Panel_hide_seek", kBlackBottom)
_gSingle("Maze Room/Panel_hide_seek_2", kBlackBottom)
_gSingle("Maze Room/Panel_hide_seek_3", kBlackBottom)
_gSingle("Maze Room/Panel_hide_seek_4", kBlackBottom)
_gSingle("Maze Room/Panel_leap_jump", kWhiteBottom)
_gSingle("Maze Room/Panel_look_look", kWhiteBottom)
_gSingle("Appendix Room/Panel_discover_recover", kPurpleMiddle)
_gSingle("Appendix Room/Panel_warner_corner", kPurpleTop)
_gSingle("Appendix Room/Panel_adjust_readjusted", kBlueMiddle)
_gSingle("Appendix Room/Panel_trust_crust", kPurpleMiddle)
_gCopy("Appendix Room/Panel_trust_crust", "Appendix Room/Panel_trust_crust_2")
_gSingle("Appendix Room/Panel_trusted_readjusted", kPurpleMiddle)
_gSingle("Painting Room/Panel_free_three", kPurpleMiddle)
_gSingle("Painting Room/Panel_our_four", kBlueMiddle)
_gSingle("Painting Room/Panel_house_neighborhood", kBlueBottom)
# Panel_path_road
_gSingle("Painting Room/Panel_park_drive", kBlackBottom)
_gSingle("Painting Room/Panel_carriage_horse", kRedBottom)
_gSingle("Painting Room/Panel_learns_turns", kPurpleMiddle)
_gSingle("Painting Room/Panel_urns_turns", kBlueMiddle)
_gSingle("Backside Room/Panel_ward_forward", kBlueMiddle)
_gSingle("Backside Room/Panel_hind_behind", kBlueMiddle)
_gSingle("Backside Room/Panel_rig_right", kBlueMiddle)
_gSingle("Backside Room/Panel_turn_return", kBlueMiddle)
_gSingle("Backside Room/Panel_windward_forward", kPurpleMiddle)
_gSingle("Backside Room/Panel_light_right", kPurpleMiddle)
_gSingle("Backside Room/Panel_rewind_behind", kPurpleMiddle)
_gSingle("Backside Room/Panel_learn_return", kPurpleMiddle)
_gSingle("Color Arrow Room/Panel_hues_colors", kWhiteBottom)
# Now we'll generate puzzles that don't need to be reused, and hopefully cover
# all previously generated answers.
_clearFlag(kMustReuseAnswer)
_setUniquePool("agreeable")
_gSingle("Antonym Room/Panel_retool_looter", kBlackMiddle)
_gSingle("Antonym Room/Panel_drawer_reward", kBlackMiddle)
_gSingle("Antonym Room/Panel_stressed_desserts", kBlackMiddle)
_gSingle("Antonym Room/Panel_star_rats", kBlackMiddle)
_gSingle("Antonym Room/Panel_tame_mate", kBlackTop)
_gSingle("Antonym Room/Panel_cat_tack", kBlackTop)
_setUniquePool("seeker")
_setFlag(kObscureHint)
_gSingle("Heteronym Room/Panel_bear_bear", kWhiteMiddle)
_gSingle("Heteronym Room/Panel_bow_bow", kWhiteMiddle)
_gSingle("Heteronym Room/Panel_does_does", kWhiteMiddle)
_gDouble("Heteronym Room/Panel_mine_mine", "Heteronym Room/Panel_mine_mine_2", kWhiteMiddle)
_gDouble(
"Heteronym Room/Panel_mobile_mobile", "Heteronym Room/Panel_mobile_mobile_2", kWhiteMiddle
)
_gStack2(
"Heteronym Room/Panel_desert_dessert",
kWhiteTop,
"Heteronym Room/Panel_desert_desert",
kWhiteMiddle
)
_gStack2("Heteronym Room/Panel_sow_so", kWhiteTop, "Heteronym Room/Panel_sow_sow", kWhiteMiddle)
_gDouble("Heteronym Room/Panel_two_to", "Heteronym Room/Panel_two_too", kWhiteTop)
_gDouble("Heteronym Room/Panel_not_knot", "Heteronym Room/Panel_not_naught", kWhiteTop)
_gSingle("Heteronym Room/Panel_write_right", kWhiteTop)
_gSingle("Heteronym Room/Panel_you_ewe", kWhiteTop)
_gSingle("Heteronym Room/Panel_bear_bare", kWhiteTop)
_clearFlag(kObscureHint)
_setUniquePool("tenacious")
_gSingle("Palindrome Room/Panel_slaughter_laughter", kRedMiddle)
_gSingle("Palindrome Room/Panel_dread_dead", kRedMiddle)
_gSingle("Palindrome Room/Panel_massacred_sacred", kRedMiddle)
_gSingle("Palindrome Room/Panel_decay_day", kRedMiddle)
# do palindromes
_setUniquePool("discerning")
_gSingle("Sun Room/Panel_hits_this", kYellowMiddle)
_gSingle("Sun Room/Panel_adder_dread", kYellowMiddle)
_gSingle("Sun Room/Panel_laughters_slaughter", kYellowMiddle)
_gSingle("Sun Room/Panel_rat_art", kYellowMiddle)
_gSingle("Sun Room/Panel_dusty_study", kYellowMiddle)
_gSingle("Sun Room/Panel_state_taste", kYellowMiddle)
_gSingle("Sun Room/Panel_react_trace", kYellowMiddle)
_gSingle("Sun Room/Panel_seam_same", kYellowMiddle)
_gDouble("Sun Room/Panel_warred_drawer", "Sun Room/Panel_redraw_drawer", kYellowMiddle)
_gDouble("Sun Room/Panel_stone_notes", "Sun Room/Panel_onset_notes", kYellowMiddle)
_gDouble("Sun Room/Panel_arts_star", "Sun Room/Panel_tsar_star", kYellowMiddle)
_gDouble("Sun Room/Panel_dear_read", "Sun Room/Panel_dare_read", kYellowMiddle)
_setUniquePool("bold")
_gSingle("Truncate Room/Panel_sushi_hi", kRedMiddle)
_gSingle("Truncate Room/Panel_thistle_this", kRedMiddle)
_gSingle("Truncate Room/Panel_heartbreak_brake", kRedTop)
_gSingle("Truncate Room/Panel_airplane_plain", kRedTop)
_gSingle("Truncate Room/Panel_nightmare_knight", kRedTop)
_gSingle("Truncate Room/Panel_sign_sigh", kRedTop)
_gDouble("Truncate Room/Panel_undead_dead", "Truncate Room/Panel_deadline_dead", kRedMiddle)
_gDouble("Truncate Room/Panel_landmass_mass", "Truncate Room/Panel_massacred_mass", kRedMiddle)
_setUniquePool("rhyme")
_gStack2(
"Double Room/Panel_ascend_rhyme", kPurpleTop, "Double Room/Panel_ascend_syn", kWhiteBottom
)
_gStack2(
"Double Room/Panel_double_rhyme", kPurpleTop, "Double Room/Panel_double_syn", kWhiteBottom
)
_gStack2(
"Double Room/Panel_blocked_rhyme", kPurpleTop, "Double Room/Panel_blocked_syn", kWhiteBottom
)
_gStack2("Double Room/Panel_rise_rhyme", kPurpleTop, "Double Room/Panel_rise_syn", kWhiteBottom)
_gStack2(
"Double Room/Panel_crystal_rhyme", kPurpleTop, "Double Room/Panel_crystal_syn", kWhiteBottom
)
_gStack2(
"Double Room/Panel_creative_rhyme",
kPurpleTop,
"Double Room/Panel_creative_syn",
kWhiteBottom
)
_gStack2(
"Double Room/Panel_child_rhyme", kPurpleTop, "Double Room/Panel_child_syn", kWhiteBottom
)
_gStack2(
"Double Room/Panel_hidden_rhyme", kPurpleTop, "Double Room/Panel_hidden_syn", kWhiteBottom
)
_gStack2(
"Double Room/Panel_word_rhyme", kPurpleTop, "Double Room/Panel_word_whole", kBlueBottom
)
_gStack2(
"Double Room/Panel_silent_rhyme", kPurpleTop, "Double Room/Panel_silent_syn", kWhiteBottom
)
_gStack2(
"Double Room/Panel_bones_rhyme", kPurpleTop, "Double Room/Panel_bones_syn", kWhiteBottom
)
_gStack2(
"Double Room/Panel_sentence_rhyme",
kPurpleTop,
"Double Room/Panel_sentence_whole",
kBlueBottom
)
_gStack2(
"Double Room/Panel_dream_rhyme", kPurpleTop, "Double Room/Panel_dream_syn", kWhiteBottom
)
_gStack2(
"Double Room/Panel_mystery_rhyme", kPurpleTop, "Double Room/Panel_mystery_syn", kWhiteBottom
)
_gStack2("Double Room/Panel_jump_rhyme", kPurpleTop, "Double Room/Panel_jump_syn", kWhiteBottom)
_gStack2("Double Room/Panel_fall_rhyme", kPurpleTop, "Double Room/Panel_fall_syn", kWhiteBottom)
_gStack2(
"Double Room/Panel_return_rhyme", kPurpleTop, "Double Room/Panel_return_ant", kBlackBottom
)
_gStack2(
"Double Room/Panel_descend_rhyme", kPurpleTop, "Double Room/Panel_descend_ant", kBlackBottom
)
_setUniquePool("fearless")
_gSingle("Naps Room/Panel_naps_span", kBlackMiddle)
_gSingle("Naps Room/Panel_funny_enough", kBlackTop)
_gSingle("Naps Room/Panel_team_meet", kBlackTop)
_gSingle("Naps Room/Panel_teem_meat", kBlackTop)
_gSingle("Naps Room/Panel_eat_tea", kBlackTop)
_gSingle("Naps Room/Panel_came_make", kBlackTop)
_gSingle("Naps Room/Panel_same_mace", kBlackTop)
_gSingle("Naps Room/Panel_safe_face", kBlackTop)
_gSingle("Naps Room/Panel_might_time", kBlackTop)
_setUniquePool("unchallenged")
_setFlag(kObscureHint)
_gSingle("Challenge Room/Panel_challenge_challenge", kWhiteMiddle)
_gSingle("Challenge Room/Panel_welcome_welcome", kWhiteMiddle)
_clearFlag(kObscureHint)
_writePanel("Entry Room/Panel_return_return", "%s back" % _answer_by_path["Challenge Room/Panel_welcome_welcome"], "%s back" % _answer_by_path["Challenge Room/Panel_welcome_welcome"])
_gSingle("Challenge Room/Panel_corner_corn", kRedMiddle)
_gSingle("Challenge Room/Panel_realeyes_realize", kWhiteTop)
_gSingle("Challenge Room/Panel_double_anagram_1", kYellowMiddle)
_gSingle("Challenge Room/Panel_double_anagram_2", kYellowMiddle)
_gSingle("Challenge Room/Panel_double_anagram_3", kYellowMiddle)
_gSingle("Challenge Room/Panel_double_anagram_4", kYellowMiddle)
_gSingle("Challenge Room/Panel_double_anagram_5", kYellowMiddle)
_gSingle("Challenge Room/Panel_double_anagram_6", kYellowMiddle)
_setUniquePool("ecstatic")
_gSingle("Smiley Room/Panel_anagram_7_1", kYellowTop)
_gSingle("Smiley Room/Panel_anagram_7_2", kYellowTop)
_gSingle("Smiley Room/Panel_anagram_7_3", kYellowTop)
_gSingle("Smiley Room/Panel_anagram_7_4", kYellowTop)
_gSingle("Smiley Room/Panel_anagram_8_1", kYellowTop)
_gSingle("Smiley Room/Panel_anagram_8_2", kYellowTop)
_gSingle("Smiley Room/Panel_anagram_8_3", kYellowTop)
_setUniquePool("red")
_gSingle("Hangry Room/Panel_red_top_1", kRedTop)
_gSingle("Hangry Room/Panel_red_top_2", kRedTop)
_gSingle("Hangry Room/Panel_red_top_3", kRedTop)
_gSingle("Hangry Room/Panel_red_top_4", kRedTop)
_gSingle("Hangry Room/Panel_red_mid_1", kRedMiddle)
_gSingle("Hangry Room/Panel_red_mid_3", kRedMiddle)
_gStack2("Hangry Room/Panel_red_mid_4", kRedMiddle, "Hangry Room/Panel_red_bot_4", kRedBottom)
_gStack2("Hangry Room/Panel_red_mid_5", kRedMiddle, "Hangry Room/Panel_red_bot_5", kRedBottom)
_clearUniquePool()
_gSingle("Entry Room/Panel_hidden_hidden", kWhiteMiddle)
_gPaired("Shuffle Room/Panel_sword_words", "Shuffle Room/Panel_words_sword", kYellowMiddle)
_gPaired("Shuffle Room/Panel_turn_runt", "Shuffle Room/Panel_turn_runt2", kYellowMiddle)
_gPaired("Shuffle Room/Panel_lost_lots", "Shuffle Room/Panel_lost_slot", kYellowMiddle)
_gDouble("Shuffle Room/Panel_amen_mean", "Shuffle Room/Panel_name_mean", kYellowMiddle)
_gSingle("Shuffle Room/Panel_corner", kYellowTop)
_gSingle("Shuffle Room/Panel_gel", kYellowTop)
_gSingle("Shuffle Room/Panel_though", kYellowTop)
_gSingle("Shuffle Room/Panel_swap_wasp", kYellowMiddle)
_gSingle("Shuffle Room/Panel_eyes_see_shuffle", kYellowMiddle)
_gSingle("Shuffle Room/Panel_behind", kYellowMiddle)
_gPaired("Shuffle Room/Panel_left_left", "Shuffle Room/Panel_right_right", kWhiteMiddle)
_gSingle("Shuffle Room/Panel_middle_middle", kWhiteMiddle)
_gCopy("Shuffle Room/Panel_left_left", "Shuffle Room/Panel_left_left_2")
_gCopy("Shuffle Room/Panel_right_right", "Shuffle Room/Panel_right_right_2")
_gCopy("Shuffle Room/Panel_middle_middle", "Shuffle Room/Panel_middle_middle_2")
_gSingle("Shuffle Room/Panel_shortcuts", kYellowMiddle)
_gSingle("Shuffle Room/Panel_tower", kYellowMiddle)
_gPaired("Shuffle Room/Panel_far_far", "Shuffle Room/Panel_near_near", kWhiteMiddle)
_gSingle("Maze Room/Panel_reflow_flower", kYellowMiddle)
_gSingle("Appendix Room/Panel_rat_tar", kBlackMiddle)
_gSingle("Appendix Room/Panel_deadend_deadened", kWhiteTop)
_gPaired("Appendix Room/Panel_night_knight", "Appendix Room/Panel_knight_night", kBlueMiddle)
_gPaired("Appendix Room/Panel_bee_be", "Appendix Room/Panel_new_knew", kRedMiddle)
_gSingle("Appendix Room/Panel_fore_for", kRedMiddle)
_gPaired("Appendix Room/Panel_trusted_trust", "Appendix Room/Panel_trusted_rusted", kRedMiddle)
_gPaired("Appendix Room/Panel_rust_trust", "Appendix Room/Panel_rust_crust", kBlueMiddle)
_gSingle("Appendix Room/Panel_encrusted_rust", kRedMiddle)
_gPaired(
"Appendix Room/Panel_adjust_readjust", "Appendix Room/Panel_adjust_adjusted", kBlueMiddle
)
_gSingle("Painting Room/Panel_eon_one", kYellowMiddle)
_gSingle("Painting Room/Panel_to_two", kRedMiddle)
_setFlag(kShortAnswer)
_gSingle("Painting Room/Panel_an_many", kBlueMiddle)
_gSingle("Painting Room/Panel_may_many", kBlueMiddle)
_gSingle("Painting Room/Panel_any_many", kBlueMiddle)
_gSingle("Painting Room/Panel_man_many", kBlueMiddle)
_clearFlag(kShortAnswer)
_gOrangeAddition("Painting Room/Panel_send_use_turns")
_gOrangeWord("Painting Room/Panel_trust_06890")
_gOrangeNumber("Painting Room/Panel_06890_trust")
_writePanel("Painting Room/Panel_order_onepathmanyturns", "order", "%s road %s %s" % [_answer_by_path["Painting Room/Panel_eon_one"], _answer_by_path["Painting Room/Panel_any_many"], _answer_by_path["Painting Room/Panel_send_use_turns"]])
_gStack2("Ceiling Room/Panel_blue_top_1", kBlueTop, "Ceiling Room/Panel_red_bot_1", kRedBottom)
_gStack2(
"Ceiling Room/Panel_red_mid_2", kRedMiddle, "Ceiling Room/Panel_blue_bot_2", kBlueBottom
)
_gStack2(
"Ceiling Room/Panel_blue_mid_3", kBlueMiddle, "Ceiling Room/Panel_red_bot_3", kRedBottom
)
_gStack2("Ceiling Room/Panel_red_top_4", kRedTop, "Ceiling Room/Panel_blue_mid_4", kBlueMiddle)
_gStack2(
"Ceiling Room/Panel_yellow_top_5", kYellowTop, "Ceiling Room/Panel_blue_bot_5", kBlueBottom
)
_gStack2(
"Ceiling Room/Panel_blue_top_6", kBlueTop, "Ceiling Room/Panel_yellow_mid_6", kYellowMiddle
)
# gen_.GeneratePanelStack("", {}, "Panel_blue_mid_7", kBlue, "Panel_yellow_bot_7", kYellow);
_gStack2(
"Ceiling Room/Panel_yellow_mid_8",
kYellowMiddle,
"Ceiling Room/Panel_black_bot_8",
kBlackBottom
)
# gen_.GeneratePanelStack("Panel_black_top_9", kBlack, "", {}, "Panel_yellow_bot_9", kYellow);
_gStack2(
"Ceiling Room/Panel_yellow_top_10",
kYellowTop,
"Ceiling Room/Panel_black_bot_10",
kBlackBottom
)
_gStack2(
"Ceiling Room/Panel_black_top_11",
kBlackTop,
"Ceiling Room/Panel_yellow_mid_11",
kYellowMiddle
)
_gStack2(
"Ceiling Room/Panel_black_top_12", kBlackTop, "Ceiling Room/Panel_red_bot_12", kRedBottom
)
_gStack2(
"Ceiling Room/Panel_red_top_13", kRedTop, "Ceiling Room/Panel_black_bot_13", kBlackBottom
)
_gStack2(
"Ceiling Room/Panel_black_mid_14", kBlackMiddle, "Ceiling Room/Panel_red_bot_14", kRedBottom
)
_gStack2(
"Ceiling Room/Panel_black_top_15", kBlackTop, "Ceiling Room/Panel_red_mid_15", kRedMiddle
)
#gen_.GenerateSinglePanel("Panel_answer_1", kBottom, kRed);
#_gSingle("Ceiling Room/Panel_answer_2", kBlackTop)
_setFlag(kShortAnswer)
_gSingle("Ceiling Room/Panel_answer_3", kBlueMiddle)
_clearFlag(kShortAnswer)
_gSingle("Ceiling Room/Panel_answer_4", kBlackTop)
_writePanel("Countdown Panels/Panel_artistic_artistic", "", "the art %s %s" % [_answer_by_path["Ceiling Room/Panel_answer_3"], _answer_by_path["Ceiling Room/Panel_answer_4"]])
_gQuadruple("Hallway Room/Panel_castle_1", "Hallway Room/Panel_castle_2", "Hallway Room/Panel_castle_3", "Hallway Room/Panel_castle_4", kBlueBottom)
_gQuadruple("Hallway Room/Panel_counterclockwise_1", "Hallway Room/Panel_counterclockwise_2", "Hallway Room/Panel_counterclockwise_3", "Hallway Room/Panel_counterclockwise_4", kBlueMiddle)
_gQuadruple("Hallway Room/Panel_transformation_1", "Hallway Room/Panel_transformation_2", "Hallway Room/Panel_transformation_3", "Hallway Room/Panel_transformation_4", kBlueTop)
_gExactLength("Backside Room/Panel_one_one", kWhiteMiddle, 1)
_gExactLength("Backside Room/Panel_two_two", kWhiteMiddle, 2)
_gExactLength("Backside Room/Panel_two_two_2", kWhiteMiddle, 2)
_gExactLength("Backside Room/Panel_three_three", kWhiteMiddle, 3)
_gExactLength("Backside Room/Panel_three_three_2", kWhiteMiddle, 3)
_gExactLength("Backside Room/Panel_three_three_3", kWhiteMiddle, 3)
_gSingle("Color Arrow Room/Panel_red_near", kWhiteMiddle)
_gSingle("Color Arrow Room/Panel_blue_near", kWhiteMiddle)
_gSingle("Color Arrow Room/Panel_yellow_near", kWhiteMiddle)
_gSingle("Color Arrow Room/Panel_orange_near", kWhiteMiddle)
_gSingle("Color Arrow Room/Panel_purple_near", kWhiteMiddle)
_gSingle("Color Arrow Room/Panel_green_near", kWhiteMiddle)
_gCopyHidden("Color Arrow Room/Panel_red_near", "Color Arrow Room/Panel_red_afar")
_gCopyHidden("Color Arrow Room/Panel_blue_near", "Color Arrow Room/Panel_blue_afar")
_gCopyHidden("Color Arrow Room/Panel_yellow_near", "Color Arrow Room/Panel_yellow_afar")
_gCopyHidden("Color Arrow Room/Panel_orange_near", "Color Arrow Room/Panel_orange_afar")
_gCopyHidden("Color Arrow Room/Panel_purple_near", "Color Arrow Room/Panel_purple_afar")
_gCopyHidden("Color Arrow Room/Panel_green_near", "Color Arrow Room/Panel_green_afar")
_gOrangeNumber("Orange Room/Panel_lust")
_gOrangeNumber("Orange Room/Panel_read")
_gOrangeNumber("Orange Room/Panel_sew")
_gOrangeNumber("Orange Room/Panel_dead")
_writePanel("Tower Room/Panel_1234567890_wanderlust", "12345656", "the wanderer")
_gOrangeNumber("Tower Room/Panel_834283054_undaunted")
_gOrangeWord("Orange Room/Panel_learn")
_gOrangeWord("Orange Room/Panel_dust")
_gOrangeWord("Orange Room/Panel_star")
_gOrangeWord("Orange Room/Panel_wander")
_gOrangeWord("Tower Room/Panel_wanderlust_1234567890")
_gOrangeAddition("Tower Room/Panel_dads_ale_dead_1")
_gOrangeAddition("Tower Room/Panel_art_art_eat_2")
_gOrangeAddition("Tower Room/Panel_deer_wren_rats_3")
_gOrangeAddition("Tower Room/Panel_learns_unsew_unrest_4")
_gOrangeAddition("Tower Room/Panel_drawl_runs_enter_5")
_gOrangeAddition("Tower Room/Panel_reads_rust_lawns_6")
_gOrangeAddition("Tower Room/Panel_waded_wee_warts_7")
_gPaintingPuzzle("Panel Room/Panel_painting_flower", "flower_painting_gray")
_gPaintingPuzzle("Panel Room/Panel_painting_eye", "eye_painting_gray")
_gPaintingPuzzle("Panel Room/Panel_painting_snowman", "snowman_painting_gray")
_gPaintingPuzzle("Panel Room/Panel_painting_owl", "owl_painting_gray")
_gPaintingPuzzle("Panel Room/Panel_painting_panda", "panda_painting_gray")
_setFlag(kObscureHint)
_gSingle("Entry Room/Panel_forward_forward", kWhiteMiddle)
_gSingle("Entry Room/Panel_between_between", kWhiteMiddle)
_gSingle("Entry Room/Panel_backward_backward", kWhiteMiddle)
_gSingle("Entry Room/Panel_secret_secret", kWhiteMiddle)
_gPaired("Symmetry Room/Panel_leaf_feel", "Symmetry Room/Panel_feel_leaf", kBlackTop)
_gPaired("Symmetry Room/Panel_warts_straw", "Symmetry Room/Panel_straw_warts", kBlackMiddle)
_gPaired("Symmetry Room/Panel_near_far", "Symmetry Room/Panel_far_near", kBlackBottom)
_gPaired("Symmetry Room/Panel_left_right", "Symmetry Room/Panel_right_left", kBlackBottom)
_gSingle("Shuffle Room/Panel_theeyes_theeyes", kWhiteMiddle)
_gSingle("Shuffle Room/Panel_crossroads_crossroads", kWhiteMiddle)
_gSingle("Shuffle Room/Panel_corner_corner", kWhiteMiddle)
_gSingle("Shuffle Room/Panel_hollow_hollow", kWhiteMiddle)
_gSingle("Maze Room/Panel_trace_trace", kWhiteMiddle)
_gSingle("Appendix Room/Panel_deadend_deadend", kWhiteMiddle)
_gSingle("Appendix Room/Panel_lies_lies", kWhiteMiddle)
_gSingle("Cross Room/Panel_shortcut_shortcut", kWhiteMiddle)
_gSingle("Double Room/Panel_leap_leap", kWhiteMiddle)
_gSingle("Backside Room/Panel_backside_1", kWhiteMiddle)
_gSingle("Backside Room/Panel_backside_2", kWhiteMiddle)
_gSingle("Backside Room/Panel_backside_3", kWhiteMiddle)
_gSingle("Backside Room/Panel_backside_4", kWhiteMiddle)
_gSingle("Backside Room/Panel_backside_5", kWhiteMiddle)
_gSingle("Backside Room/Panel_farther_far", kRedMiddle)
_gSingle("Backside Room/Panel_first_first", kWhiteMiddle)
_gSingle("Backside Room/Panel_second_second", kWhiteMiddle)
_gSingle("Backside Room/Panel_third_third", kWhiteMiddle)
_gSingle("Backside Room/Panel_fourth_fourth", kWhiteMiddle)
_gExactLength("Backside Room/Panel_four_four", kWhiteMiddle, 4)
_gExactLength("Backside Room/Panel_four_four_2", kWhiteMiddle, 4)
_gExactLength("Backside Room/Panel_four_four_3", kWhiteMiddle, 4)
_gExactLength("Backside Room/Panel_four_four_4", kWhiteMiddle, 4)
_gExactLength("Backside Room/Panel_five_five", kWhiteMiddle, 5)
_gExactLength("Backside Room/Panel_five_five_2", kWhiteMiddle, 5)
_gExactLength("Backside Room/Panel_five_five_3", kWhiteMiddle, 5)
_gExactLength("Backside Room/Panel_five_five_4", kWhiteMiddle, 5)
_gExactLength("Backside Room/Panel_five_five_5", kWhiteMiddle, 5)
_gExactLength("Backside Room/Panel_six_six", kWhiteMiddle, 6)
_gExactLength("Backside Room/Panel_six_six_2", kWhiteMiddle, 6)
_gExactLength("Backside Room/Panel_six_six_3", kWhiteMiddle, 6)
_gExactLength("Backside Room/Panel_six_six_4", kWhiteMiddle, 6)
_gExactLength("Backside Room/Panel_six_six_5", kWhiteMiddle, 6)
_gExactLength("Backside Room/Panel_six_six_6", kWhiteMiddle, 6)
_gExactLength("Backside Room/Panel_seven_seven", kWhiteMiddle, 7)
_gExactLength("Backside Room/Panel_seven_seven_2", kWhiteMiddle, 7)
_gExactLength("Backside Room/Panel_seven_seven_3", kWhiteMiddle, 7)
_gExactLength("Backside Room/Panel_seven_seven_4", kWhiteMiddle, 7)
_gExactLength("Backside Room/Panel_seven_seven_5", kWhiteMiddle, 7)
_gExactLength("Backside Room/Panel_seven_seven_6", kWhiteMiddle, 7)
_gExactLength("Backside Room/Panel_seven_seven_7", kWhiteMiddle, 7)
_gExactLength("Backside Room/Panel_eight_eight", kWhiteMiddle, 8)
_gExactLength("Backside Room/Panel_eight_eight_2", kWhiteMiddle, 8)
_gExactLength("Backside Room/Panel_eight_eight_3", kWhiteMiddle, 8)
_gExactLength("Backside Room/Panel_eight_eight_4", kWhiteMiddle, 8)
_gExactLength("Backside Room/Panel_eight_eight_5", kWhiteMiddle, 8)
_gExactLength("Backside Room/Panel_eight_eight_6", kWhiteMiddle, 8)
_gExactLength("Backside Room/Panel_eight_eight_7", kWhiteMiddle, 8)
_gExactLength("Backside Room/Panel_eight_eight_8", kWhiteMiddle, 8)
_gExactLength("Backside Room/Panel_nine_nine", kWhiteMiddle, 9)
_gExactLength("Backside Room/Panel_nine_nine_2", kWhiteMiddle, 9)
_gExactLength("Backside Room/Panel_nine_nine_3", kWhiteMiddle, 9)
_gExactLength("Backside Room/Panel_nine_nine_4", kWhiteMiddle, 9)
_gExactLength("Backside Room/Panel_nine_nine_5", kWhiteMiddle, 9)
_gExactLength("Backside Room/Panel_nine_nine_6", kWhiteMiddle, 9)
_gExactLength("Backside Room/Panel_nine_nine_7", kWhiteMiddle, 9)
_gExactLength("Backside Room/Panel_nine_nine_8", kWhiteMiddle, 9)
_gExactLength("Backside Room/Panel_nine_nine_9", kWhiteMiddle, 9)
_clearFlag(kObscureHint)
if _needs_reuse.size() > 0:
print("Generation failed; the following words need to be reused:")
for word_id in _needs_reuse:
print(_answer_by_id[word_id])
print("Generated!")
for puzzle in panel_mapping:
print("%s: %s? %s!" % puzzle)
func apply(scene):
var panels_parent = scene.get_node("Panels")
for puzzle in panel_mapping:
var panel = panels_parent.get_node(puzzle[0])
panel.text = puzzle[1]
panel.answer = puzzle[2]
for mapping in painting_mapping:
var scene_path = "res://nodes/paintings/%s.tscn" % mapping[1]
var painting_scene = load(scene_path)
var new_painting = painting_scene.instance()
new_painting.set_name("%s_new" % mapping[0])
var old_painting = scene.get_node("Decorations/Paintings").get_node(mapping[0])
new_painting.translation = old_painting.translation
new_painting.rotation = old_painting.rotation
scene.get_node("Decorations/Paintings").add_child(new_painting)
old_painting.queue_free()
func _pickRandom(set):
var id = _rng.randi_range(0, set.size() - 1)
return set[id]
func _setFlag(flag):
_flags |= flag
func _clearFlag(flag):
_flags &= ~flag
func _isFlag(flag):
return (_flags & flag) > 0
func _setUniquePool(pool):
_unique_pool = pool
if not _answers_by_unique_pool.has(_unique_pool):
_answers_by_unique_pool[_unique_pool] = []
func _clearUniquePool():
_unique_pool = ""
func _gSingle(panel_path, puzzle_type):
if puzzle_type == kWhiteMiddle:
var word_choices = _filterBestPuzzles(_answers_by_type[kWhiteMiddle])
var answer_id = _pickRandom(word_choices)
_setPanel(panel_path, answer_id, answer_id)
else:
var puzzle_choices = _filterBestPuzzles(_answers_by_type[puzzle_type])
if puzzle_choices.empty():
print("No possible puzzles for panel %s" % panel_path)
else:
var answer_id = _pickRandom(puzzle_choices)
var hint_choices = _puzzle_by_id[answer_id][1][puzzle_type]
var hint_id = _pickRandom(hint_choices)
_setPanel(panel_path, hint_id, answer_id)
func _gDouble(panel1_path, panel2_path, puzzle_type):
if puzzle_type == kWhiteMiddle:
var word_choices = _filterBestPuzzles(_answers_by_type[kWhiteMiddle])
var answer_id = _pickRandom(word_choices)
_setPanel(panel1_path, answer_id, answer_id)
_setPanel(panel2_path, answer_id, answer_id)
else:
var pre_choices = _filterBestPuzzles(_answers_by_type[puzzle_type])
var puzzle_choices = []
for word_id in pre_choices:
if _puzzle_by_id[word_id][1][puzzle_type].size() > 1:
puzzle_choices.append(word_id)
if puzzle_choices.empty():
print("No possible puzzles for panel %s" % panel1_path)
else:
var answer_id = _pickRandom(puzzle_choices)
var hint_choices = _puzzle_by_id[answer_id][1][puzzle_type].duplicate()
var hint1_id = _pickRandom(hint_choices)
hint_choices.erase(hint1_id)
var hint2_id = _pickRandom(hint_choices)
_setPanel(panel1_path, hint1_id, answer_id)
_setPanel(panel2_path, hint2_id, answer_id)
func _gQuadruple(panel1_path, panel2_path, panel3_path, panel4_path, puzzle_type):
var pre_choices = _filterBestPuzzles(_answers_by_type[puzzle_type])
var puzzle_choices = []
for word_id in pre_choices:
if _puzzle_by_id[word_id][1][puzzle_type].size() > 3:
puzzle_choices.append(word_id)
if puzzle_choices.empty():
print("No possible puzzles for panel %s" % panel1_path)
else:
var answer_id = _pickRandom(puzzle_choices)
var hint_choices = _puzzle_by_id[answer_id][1][puzzle_type].duplicate()
var hint1_id = _pickRandom(hint_choices)
hint_choices.erase(hint1_id)
var hint2_id = _pickRandom(hint_choices)
hint_choices.erase(hint2_id)
var hint3_id = _pickRandom(hint_choices)
hint_choices.erase(hint3_id)
var hint4_id = _pickRandom(hint_choices)
_setPanel(panel1_path, hint1_id, answer_id)
_setPanel(panel2_path, hint2_id, answer_id)
_setPanel(panel3_path, hint3_id, answer_id)
_setPanel(panel4_path, hint4_id, answer_id)
func _gPaired(panel1_path, panel2_path, puzzle_type):
var needed_type = puzzle_type
if puzzle_type == kWhiteMiddle:
needed_type = kBlackBottom
var puzzle_choices = _filterBestPuzzles(_answers_by_type[needed_type])
if puzzle_choices.empty():
print("No possible puzzles for panel %s" % panel1_path)
else:
var answer_id = _pickRandom(puzzle_choices)
var hint_choices = _puzzle_by_id[answer_id][1][needed_type]
var hint_id = _pickRandom(hint_choices)
if puzzle_type == kWhiteMiddle:
_setPanel(panel1_path, hint_id, hint_id)
_setPanel(panel2_path, answer_id, answer_id)
else:
_setPanel(panel1_path, hint_id, answer_id)
_setPanel(panel2_path, answer_id, hint_id)
func _gStack2(panel1_path, puzzle_type1, panel2_path, puzzle_type2):
if puzzle_type1 == kWhiteMiddle or puzzle_type2 == kWhiteMiddle:
if puzzle_type1 == kWhiteMiddle:
_gSingle(panel2_path, puzzle_type2)
_gCopyAnswer(panel2_path, panel1_path)
else:
_gSingle(panel1_path, puzzle_type1)
_gCopyAnswer(panel1_path, panel2_path)
else:
var pre_choices = _filterBestPuzzles(_answers_by_type[puzzle_type1])
var puzzle_choices = []
for word_id in pre_choices:
if _puzzle_by_id[word_id][1].has(puzzle_type2):
puzzle_choices.append(word_id)
if puzzle_choices.empty():
print("No possible puzzles for panel %s" % panel1_path)
else:
var answer_id = _pickRandom(puzzle_choices)
var hint1_choices = _puzzle_by_id[answer_id][1][puzzle_type1]
var hint1_id = _pickRandom(hint1_choices)
var hint2_choices = _puzzle_by_id[answer_id][1][puzzle_type2]
var hint2_id = _pickRandom(hint2_choices)
_setPanel(panel1_path, hint1_id, answer_id)
_setPanel(panel2_path, hint2_id, answer_id)
func _gCopy(panel1_path, panel2_path):
_writePanel(panel2_path, _hint_by_path[panel1_path], _answer_by_path[panel1_path])
func _gCopyAnswer(panel1_path, panel2_path):
_writePanel(panel2_path, _answer_by_path[panel1_path], _answer_by_path[panel1_path])
func _gCopyHidden(panel1_path, panel2_path):
_writePanel(panel2_path, "?".repeat(_answer_by_path[panel1_path].length()), _answer_by_path[panel1_path])
func _gExactLength(panel_path, puzzle_type, answer_length):
var puzzle_choices = _filterBestPuzzles(_answers_by_length[answer_length])
if puzzle_type != kWhiteMiddle:
# TODO: Do we even need this?
pass
if puzzle_choices.empty():
print("No possible puzzles for panel %s" % panel_path)
else:
var answer_id = _pickRandom(puzzle_choices)
if puzzle_type == kWhiteMiddle:
_setPanel(panel_path, answer_id, answer_id)
else:
var hint_choices = _puzzle_by_id[answer_id][1][puzzle_type]
var hint_id = _pickRandom(hint_choices)
_setPanel(panel_path, hint_id, answer_id)
func _gOrangeNumber(panel_path):
var word_id = _pickRandom(_generated_puzzles.wanderlust)
var answer = _answer_by_id[word_id]
var hint = _applyCipher(answer)
_writePanel(panel_path, hint, answer)
func _gOrangeWord(panel_path):
var word_id = _pickRandom(_generated_puzzles.wanderlust)
var hint = _answer_by_id[word_id]
var answer = _applyCipher(hint)
_writePanel(panel_path, hint, answer)
func _gOrangeAddition(panel_path):
var puzzle = _pickRandom(_generated_puzzles.addition)
var word1 = _answer_by_id[puzzle[0]]
var word2 = _answer_by_id[puzzle[1]]
var solution = _answer_by_id[puzzle[2]]
_writePanel(panel_path, "%s + %s" % [word1, word2], solution)
func _gPaintingPuzzle(panel_path, painting_name):
var chosen = _pickRandom(_painting_puzzles)
_painting_puzzles.erase(chosen)
_writePanel(panel_path, "painting", chosen[1])
painting_mapping.append([painting_name, chosen[0]])
func _applyCipher(text):
var result = text
for i in range(result.length()):
if result.substr(i,1) == "w":
result[i] = "1"
elif result.substr(i,1) == "a":
result[i] = "2"
elif result.substr(i,1) == "n":
result[i] = "3"
elif result.substr(i,1) == "d":
result[i] = "4"
elif result.substr(i,1) == "e":
result[i] = "5"
elif result.substr(i,1) == "r":
result[i] = "6"
elif result.substr(i,1) == "l":
result[i] = "7"
elif result.substr(i,1) == "u":
result[i] = "8"
elif result.substr(i,1) == "s":
result[i] = "9"
elif result.substr(i,1) == "t":
result[i] = "0"
return result
func _filterBestPuzzles(input):
var acceptable = []
for word_id in input:
if (
_unique_pool != ""
and _answers_by_unique_pool.has(_unique_pool)
and _answers_by_unique_pool[_unique_pool].has(word_id)
):
continue
if _isFlag(kShortAnswer) and _answer_by_id[word_id].length() > 4:
continue
acceptable.append(word_id)
#if _isFlag(kMustReuseAnswer):
# var possible = []
# for word_id in not_uniqued:
# if _puzzle_by_id[word_id][1].size() > 1:
# possible.append(word_id)
# not_uniqued = possible
var result = []
for word_id in acceptable:
if _needs_reuse.has(word_id):
result.append(word_id)
if result.empty():
for word_id in acceptable:
result.append(word_id)
if _possible_reuse.has(word_id):
result.append(word_id)
return result
func _setPanel(panel_path, hint_id, answer_id):
if _unique_pool != "":
_answers_by_unique_pool[_unique_pool].append(answer_id)
var hint_text = _answer_by_id[hint_id]
if _isFlag(kObscureHint):
var numToObscure = 1
if hint_text.length()/3 > 0:
numToObscure = _rng.randi_range(1, hint_text.length()/3)
var iota = range(0, hint_text.length())
var order = []
while not iota.empty():
var i = _rng.randi_range(0, iota.size() - 1)
order.append(iota[i])
iota.remove(i)
for i in range(0, numToObscure):
if hint_text[order[i]] != " " and hint_text[order[i]] != "-":
hint_text[order[i]] = "?"
_writePanel(panel_path, hint_text, _answer_by_id[answer_id])
if not _isFlag(kMustReuseAnswer):
if _needs_reuse.has(answer_id):
_needs_reuse.erase(answer_id)
_possible_reuse.append(answer_id)
func _writePanel(panel_path, hint, answer):
panel_mapping.append([panel_path, hint, answer])
_hint_by_path[panel_path] = hint
_answer_by_path[panel_path] = answer
_total_generated += 1
emit_signal("generator_status", "Generating puzzles... (%d/?)" % _total_generated)
|