diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-12-12 12:01:29 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-12-12 12:01:29 -0500 |
commit | 231d225fdcf3d11ff83587ac09c145aa7bca0e9a (patch) | |
tree | 0a87a612e0ae8a045a8d95da93b446ba806e8a26 /randomizer | |
parent | f0555579cd462b27c71c486bd7456265cc827937 (diff) | |
download | lingo-randomizer-231d225fdcf3d11ff83587ac09c145aa7bca0e9a.tar.gz lingo-randomizer-231d225fdcf3d11ff83587ac09c145aa7bca0e9a.tar.bz2 lingo-randomizer-231d225fdcf3d11ff83587ac09c145aa7bca0e9a.zip |
More panels
Diffstat (limited to 'randomizer')
-rw-r--r-- | randomizer/generator.gd | 257 | ||||
-rw-r--r-- | randomizer/load.gd | 69 |
2 files changed, 284 insertions, 42 deletions
diff --git a/randomizer/generator.gd b/randomizer/generator.gd index 22ab178..e04d0e3 100644 --- a/randomizer/generator.gd +++ b/randomizer/generator.gd | |||
@@ -2,6 +2,7 @@ extends Node | |||
2 | 2 | ||
3 | var panel_mapping = [] | 3 | var panel_mapping = [] |
4 | var gen_seed | 4 | var gen_seed |
5 | var is_set_seed = false | ||
5 | 6 | ||
6 | var _generated_puzzles | 7 | var _generated_puzzles |
7 | var _answer_by_id | 8 | var _answer_by_id |
@@ -11,6 +12,8 @@ var _puzzle_by_id | |||
11 | var _rng | 12 | var _rng |
12 | var _flags = 0 | 13 | var _flags = 0 |
13 | var _total_generated = 0 | 14 | var _total_generated = 0 |
15 | var _hint_by_path = {} | ||
16 | var _answer_by_path = {} | ||
14 | 17 | ||
15 | var _unique_pool = "" | 18 | var _unique_pool = "" |
16 | var _answers_by_unique_pool = {} | 19 | var _answers_by_unique_pool = {} |
@@ -55,9 +58,9 @@ const kPuzzleTypes = [ | |||
55 | kPurpleMiddle | 58 | kPurpleMiddle |
56 | ] | 59 | ] |
57 | 60 | ||
58 | const kMustReuseAnswer = 1 >> 0 | 61 | const kMustReuseAnswer = 1 |
59 | const kObscureHint = 1 >> 1 | 62 | const kObscureHint = 2 |
60 | const kShortAnswer = 1 >> 2 | 63 | const kShortAnswer = 4 |
61 | 64 | ||
62 | signal generator_status | 65 | signal generator_status |
63 | 66 | ||
@@ -77,8 +80,10 @@ func generate(chosen_seed): | |||
77 | var seed_rng = RandomNumberGenerator.new() | 80 | var seed_rng = RandomNumberGenerator.new() |
78 | seed_rng.randomize() | 81 | seed_rng.randomize() |
79 | gen_seed = seed_rng.randi_range(0, 999999) | 82 | gen_seed = seed_rng.randi_range(0, 999999) |
83 | is_set_seed = false | ||
80 | else: | 84 | else: |
81 | gen_seed = int(chosen_seed) | 85 | gen_seed = int(chosen_seed) |
86 | is_set_seed = true | ||
82 | 87 | ||
83 | _rng = RandomNumberGenerator.new() | 88 | _rng = RandomNumberGenerator.new() |
84 | _rng.seed = gen_seed | 89 | _rng.seed = gen_seed |
@@ -88,6 +93,8 @@ func generate(chosen_seed): | |||
88 | _answers_by_type = {} | 93 | _answers_by_type = {} |
89 | _answers_by_length = {} | 94 | _answers_by_length = {} |
90 | _puzzle_by_id = [] | 95 | _puzzle_by_id = [] |
96 | _hint_by_path = {} | ||
97 | _answer_by_path = {} | ||
91 | var openable_answers = [] | 98 | var openable_answers = [] |
92 | 99 | ||
93 | for puzzle_type in kPuzzleTypes: | 100 | for puzzle_type in kPuzzleTypes: |
@@ -137,7 +144,9 @@ func generate(chosen_seed): | |||
137 | ) | 144 | ) |
138 | 145 | ||
139 | _setUniquePool("seeker") | 146 | _setUniquePool("seeker") |
147 | _setFlag(kObscureHint) | ||
140 | _setPanel("Heteronym Room/Panel_entrance_entrance", open_answer_id, open_answer_id) | 148 | _setPanel("Heteronym Room/Panel_entrance_entrance", open_answer_id, open_answer_id) |
149 | _clearFlag(kObscureHint) | ||
141 | 150 | ||
142 | _setUniquePool("traveled") | 151 | _setUniquePool("traveled") |
143 | _setPanel("Synonym Room/Panel_open_open", open_answer_id, open_answer_id) | 152 | _setPanel("Synonym Room/Panel_open_open", open_answer_id, open_answer_id) |
@@ -170,6 +179,14 @@ func generate(chosen_seed): | |||
170 | open_answer_id | 179 | open_answer_id |
171 | ) | 180 | ) |
172 | 181 | ||
182 | _setUniquePool("scientific") | ||
183 | _setPanel("Chemistry Room/Panel_open", open_answer_id, open_answer_id) | ||
184 | _setPanel( | ||
185 | "Chemistry Room/Panel_close", | ||
186 | _pickRandom(_puzzle_by_id[open_answer_id][1][kBlackBottom]), | ||
187 | open_answer_id | ||
188 | ) | ||
189 | |||
173 | # Start generating puzzles that need to have reused solutions. | 190 | # Start generating puzzles that need to have reused solutions. |
174 | _setFlag(kMustReuseAnswer) | 191 | _setFlag(kMustReuseAnswer) |
175 | 192 | ||
@@ -241,6 +258,7 @@ func generate(chosen_seed): | |||
241 | _gSingle("Naps Room/Panel_even_ordinary", kDoubleBlackBottom) | 258 | _gSingle("Naps Room/Panel_even_ordinary", kDoubleBlackBottom) |
242 | 259 | ||
243 | _setUniquePool("unchallenged") | 260 | _setUniquePool("unchallenged") |
261 | _gSingle("Challenge Room/Panel_singed_singsong", kPurpleMiddle) | ||
244 | _gSingle("Challenge Room/Panel_nevertrusted_maladjusted", kPurpleMiddle) | 262 | _gSingle("Challenge Room/Panel_nevertrusted_maladjusted", kPurpleMiddle) |
245 | _gSingle("Challenge Room/Panel_writer_songwriter", kBlueMiddle) | 263 | _gSingle("Challenge Room/Panel_writer_songwriter", kBlueMiddle) |
246 | _gSingle("Challenge Room/Panel_lobs_lobster", kBlueMiddle) | 264 | _gSingle("Challenge Room/Panel_lobs_lobster", kBlueMiddle) |
@@ -419,12 +437,57 @@ func generate(chosen_seed): | |||
419 | "Double Room/Panel_descend_rhyme", kPurpleTop, "Double Room/Panel_descend_ant", kBlackBottom | 437 | "Double Room/Panel_descend_rhyme", kPurpleTop, "Double Room/Panel_descend_ant", kBlackBottom |
420 | ) | 438 | ) |
421 | 439 | ||
440 | _setUniquePool("fearless") | ||
441 | _gSingle("Naps Room/Panel_naps_span", kBlackMiddle) | ||
442 | _gSingle("Naps Room/Panel_funny_enough", kBlackTop) | ||
443 | _gSingle("Naps Room/Panel_team_meet", kBlackTop) | ||
444 | _gSingle("Naps Room/Panel_teem_meat", kBlackTop) | ||
445 | _gSingle("Naps Room/Panel_eat_tea", kBlackTop) | ||
446 | _gSingle("Naps Room/Panel_came_make", kBlackTop) | ||
447 | _gSingle("Naps Room/Panel_same_mace", kBlackTop) | ||
448 | _gSingle("Naps Room/Panel_safe_face", kBlackTop) | ||
449 | _gSingle("Naps Room/Panel_might_time", kBlackTop) | ||
450 | |||
451 | _setUniquePool("unchallenged") | ||
452 | _setFlag(kObscureHint) | ||
453 | _gSingle("Challenge Room/Panel_challenge_challenge", kWhiteMiddle) | ||
454 | _gSingle("Challenge Room/Panel_welcome_welcome", kWhiteMiddle) | ||
455 | _clearFlag(kObscureHint) | ||
456 | _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"]) | ||
457 | _gSingle("Challenge Room/Panel_corner_corn", kRedMiddle) | ||
458 | _gSingle("Challenge Room/Panel_realeyes_realize", kWhiteTop) | ||
459 | _gSingle("Challenge Room/Panel_double_anagram_1", kYellowMiddle) | ||
460 | _gSingle("Challenge Room/Panel_double_anagram_2", kYellowMiddle) | ||
461 | _gSingle("Challenge Room/Panel_double_anagram_3", kYellowMiddle) | ||
462 | _gSingle("Challenge Room/Panel_double_anagram_4", kYellowMiddle) | ||
463 | _gSingle("Challenge Room/Panel_double_anagram_5", kYellowMiddle) | ||
464 | _gSingle("Challenge Room/Panel_double_anagram_6", kYellowMiddle) | ||
465 | |||
466 | _setUniquePool("ecstatic") | ||
467 | _gSingle("Smiley Room/Panel_anagram_7_1", kYellowTop) | ||
468 | _gSingle("Smiley Room/Panel_anagram_7_2", kYellowTop) | ||
469 | _gSingle("Smiley Room/Panel_anagram_7_3", kYellowTop) | ||
470 | _gSingle("Smiley Room/Panel_anagram_7_4", kYellowTop) | ||
471 | _gSingle("Smiley Room/Panel_anagram_8_1", kYellowTop) | ||
472 | _gSingle("Smiley Room/Panel_anagram_8_2", kYellowTop) | ||
473 | _gSingle("Smiley Room/Panel_anagram_8_3", kYellowTop) | ||
474 | |||
475 | _setUniquePool("red") | ||
476 | _gSingle("Hangry Room/Panel_red_top_1", kRedTop) | ||
477 | _gSingle("Hangry Room/Panel_red_top_2", kRedTop) | ||
478 | _gSingle("Hangry Room/Panel_red_top_3", kRedTop) | ||
479 | _gSingle("Hangry Room/Panel_red_top_4", kRedTop) | ||
480 | _gSingle("Hangry Room/Panel_red_mid_1", kRedMiddle) | ||
481 | _gSingle("Hangry Room/Panel_red_mid_3", kRedMiddle) | ||
482 | _gStack2("Hangry Room/Panel_red_mid_4", kRedMiddle, "Hangry Room/Panel_red_bot_4", kRedBottom) | ||
483 | _gStack2("Hangry Room/Panel_red_mid_5", kRedMiddle, "Hangry Room/Panel_red_bot_5", kRedBottom) | ||
484 | |||
422 | _clearUniquePool() | 485 | _clearUniquePool() |
423 | _gSingle("Entry Room/Panel_hidden_hidden", kWhiteMiddle) | 486 | _gSingle("Entry Room/Panel_hidden_hidden", kWhiteMiddle) |
424 | 487 | ||
425 | _gPaired("Shuffle Room/Panel_sword_words", "Shuffle Room/Panel_words_sword", kYellowMiddle) | 488 | _gPaired("Shuffle Room/Panel_sword_words", "Shuffle Room/Panel_words_sword", kYellowMiddle) |
426 | _gPaired("Shuffle Room/Panel_turn_runt", "Shuffle Room/Panel_turn_runt2", kYellowMiddle) | 489 | _gPaired("Shuffle Room/Panel_turn_runt", "Shuffle Room/Panel_turn_runt2", kYellowMiddle) |
427 | _gCohinted("Shuffle Room/Panel_lost_lots", "Shuffle Room/Panel_lost_slot", kYellowMiddle) | 490 | _gPaired("Shuffle Room/Panel_lost_lots", "Shuffle Room/Panel_lost_slot", kYellowMiddle) |
428 | _gDouble("Shuffle Room/Panel_amen_mean", "Shuffle Room/Panel_name_mean", kYellowMiddle) | 491 | _gDouble("Shuffle Room/Panel_amen_mean", "Shuffle Room/Panel_name_mean", kYellowMiddle) |
429 | _gSingle("Shuffle Room/Panel_corner", kYellowTop) | 492 | _gSingle("Shuffle Room/Panel_corner", kYellowTop) |
430 | _gSingle("Shuffle Room/Panel_gel", kYellowTop) | 493 | _gSingle("Shuffle Room/Panel_gel", kYellowTop) |
@@ -437,8 +500,9 @@ func generate(chosen_seed): | |||
437 | _gCopy("Shuffle Room/Panel_left_left", "Shuffle Room/Panel_left_left_2") | 500 | _gCopy("Shuffle Room/Panel_left_left", "Shuffle Room/Panel_left_left_2") |
438 | _gCopy("Shuffle Room/Panel_right_right", "Shuffle Room/Panel_right_right_2") | 501 | _gCopy("Shuffle Room/Panel_right_right", "Shuffle Room/Panel_right_right_2") |
439 | _gCopy("Shuffle Room/Panel_middle_middle", "Shuffle Room/Panel_middle_middle_2") | 502 | _gCopy("Shuffle Room/Panel_middle_middle", "Shuffle Room/Panel_middle_middle_2") |
440 | _gSingle("Shuffle Room/Panel_shortcuts", kWhiteMiddle) | 503 | _gSingle("Shuffle Room/Panel_shortcuts", kYellowMiddle) |
441 | _gSingle("Shuffle Room/Panel_tower", kWhiteMiddle) | 504 | _gSingle("Shuffle Room/Panel_tower", kYellowMiddle) |
505 | _gPaired("Shuffle Room/Panel_far_far", "Shuffle Room/Panel_near_near", kWhiteMiddle) | ||
442 | 506 | ||
443 | _gSingle("Maze Room/Panel_reflow_flower", kYellowMiddle) | 507 | _gSingle("Maze Room/Panel_reflow_flower", kYellowMiddle) |
444 | 508 | ||
@@ -447,12 +511,10 @@ func generate(chosen_seed): | |||
447 | _gPaired("Appendix Room/Panel_night_knight", "Appendix Room/Panel_knight_night", kBlueMiddle) | 511 | _gPaired("Appendix Room/Panel_night_knight", "Appendix Room/Panel_knight_night", kBlueMiddle) |
448 | _gPaired("Appendix Room/Panel_bee_be", "Appendix Room/Panel_new_knew", kRedMiddle) | 512 | _gPaired("Appendix Room/Panel_bee_be", "Appendix Room/Panel_new_knew", kRedMiddle) |
449 | _gSingle("Appendix Room/Panel_fore_for", kRedMiddle) | 513 | _gSingle("Appendix Room/Panel_fore_for", kRedMiddle) |
450 | _gCohinted( | 514 | _gPaired("Appendix Room/Panel_trusted_trust", "Appendix Room/Panel_trusted_rusted", kRedMiddle) |
451 | "Appendix Room/Panel_trusted_trust", "Appendix Room/Panel_trusted_rusted", kRedMiddle | 515 | _gPaired("Appendix Room/Panel_rust_trust", "Appendix Room/Panel_rust_crust", kBlueMiddle) |
452 | ) | ||
453 | _gCohinted("Appendix Room/Panel_rust_trust", "Appendix Room/Panel_rust_crust", kBlueMiddle) | ||
454 | _gSingle("Appendix Room/Panel_encrusted_rust", kRedMiddle) | 516 | _gSingle("Appendix Room/Panel_encrusted_rust", kRedMiddle) |
455 | _gCohinted( | 517 | _gPaired( |
456 | "Appendix Room/Panel_adjust_readjust", "Appendix Room/Panel_adjust_adjusted", kBlueMiddle | 518 | "Appendix Room/Panel_adjust_readjust", "Appendix Room/Panel_adjust_adjusted", kBlueMiddle |
457 | ) | 519 | ) |
458 | 520 | ||
@@ -464,6 +526,65 @@ func generate(chosen_seed): | |||
464 | _gSingle("Painting Room/Panel_any_many", kBlueMiddle) | 526 | _gSingle("Painting Room/Panel_any_many", kBlueMiddle) |
465 | _gSingle("Painting Room/Panel_man_many", kBlueMiddle) | 527 | _gSingle("Painting Room/Panel_man_many", kBlueMiddle) |
466 | _clearFlag(kShortAnswer) | 528 | _clearFlag(kShortAnswer) |
529 | _writePanel("Painting Room/Panel_order_onepathmanyturns", "order", "%s road %s turns" % [_answer_by_path["Painting Room/Panel_eon_one"], _answer_by_path["Painting Room/Panel_any_many"]]) | ||
530 | |||
531 | _gStack2("Ceiling Room/Panel_blue_top_1", kBlueTop, "Ceiling Room/Panel_red_bot_1", kRedBottom) | ||
532 | _gStack2( | ||
533 | "Ceiling Room/Panel_red_mid_2", kRedMiddle, "Ceiling Room/Panel_blue_bot_2", kBlueBottom | ||
534 | ) | ||
535 | _gStack2( | ||
536 | "Ceiling Room/Panel_blue_mid_3", kBlueMiddle, "Ceiling Room/Panel_red_bot_3", kRedBottom | ||
537 | ) | ||
538 | _gStack2("Ceiling Room/Panel_red_top_4", kRedTop, "Ceiling Room/Panel_blue_mid_4", kBlueMiddle) | ||
539 | _gStack2( | ||
540 | "Ceiling Room/Panel_yellow_top_5", kYellowTop, "Ceiling Room/Panel_blue_bot_5", kBlueBottom | ||
541 | ) | ||
542 | _gStack2( | ||
543 | "Ceiling Room/Panel_blue_top_6", kBlueTop, "Ceiling Room/Panel_yellow_mid_6", kYellowMiddle | ||
544 | ) | ||
545 | # gen_.GeneratePanelStack("", {}, "Panel_blue_mid_7", kBlue, "Panel_yellow_bot_7", kYellow); | ||
546 | _gStack2( | ||
547 | "Ceiling Room/Panel_yellow_mid_8", | ||
548 | kYellowMiddle, | ||
549 | "Ceiling Room/Panel_black_bot_8", | ||
550 | kBlackBottom | ||
551 | ) | ||
552 | # gen_.GeneratePanelStack("Panel_black_top_9", kBlack, "", {}, "Panel_yellow_bot_9", kYellow); | ||
553 | _gStack2( | ||
554 | "Ceiling Room/Panel_yellow_top_10", | ||
555 | kYellowTop, | ||
556 | "Ceiling Room/Panel_black_bot_10", | ||
557 | kBlackBottom | ||
558 | ) | ||
559 | _gStack2( | ||
560 | "Ceiling Room/Panel_black_top_11", | ||
561 | kBlackTop, | ||
562 | "Ceiling Room/Panel_yellow_mid_11", | ||
563 | kYellowMiddle | ||
564 | ) | ||
565 | _gStack2( | ||
566 | "Ceiling Room/Panel_black_top_12", kBlackTop, "Ceiling Room/Panel_red_bot_12", kRedBottom | ||
567 | ) | ||
568 | _gStack2( | ||
569 | "Ceiling Room/Panel_red_top_13", kRedTop, "Ceiling Room/Panel_black_bot_13", kBlackBottom | ||
570 | ) | ||
571 | _gStack2( | ||
572 | "Ceiling Room/Panel_black_mid_14", kBlackMiddle, "Ceiling Room/Panel_red_bot_14", kRedBottom | ||
573 | ) | ||
574 | _gStack2( | ||
575 | "Ceiling Room/Panel_black_top_15", kBlackTop, "Ceiling Room/Panel_red_mid_15", kRedMiddle | ||
576 | ) | ||
577 | #gen_.GenerateSinglePanel("Panel_answer_1", kBottom, kRed); | ||
578 | #_gSingle("Ceiling Room/Panel_answer_2", kBlackTop) | ||
579 | _setFlag(kShortAnswer) | ||
580 | _gSingle("Ceiling Room/Panel_answer_3", kBlueMiddle) | ||
581 | _clearFlag(kShortAnswer) | ||
582 | _gSingle("Ceiling Room/Panel_answer_4", kBlackTop) | ||
583 | _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"]]) | ||
584 | |||
585 | _gQuadruple("Hallway Room/Panel_castle_1", "Hallway Room/Panel_castle_2", "Hallway Room/Panel_castle_3", "Hallway Room/Panel_castle_4", kBlueBottom) | ||
586 | _gQuadruple("Hallway Room/Panel_counterclockwise_1", "Hallway Room/Panel_counterclockwise_2", "Hallway Room/Panel_counterclockwise_3", "Hallway Room/Panel_counterclockwise_4", kBlueMiddle) | ||
587 | _gQuadruple("Hallway Room/Panel_transformation_1", "Hallway Room/Panel_transformation_2", "Hallway Room/Panel_transformation_3", "Hallway Room/Panel_transformation_4", kBlueTop) | ||
467 | 588 | ||
468 | _gExactLength("Backside Room/Panel_one_one", kWhiteMiddle, 1) | 589 | _gExactLength("Backside Room/Panel_one_one", kWhiteMiddle, 1) |
469 | _gExactLength("Backside Room/Panel_two_two", kWhiteMiddle, 2) | 590 | _gExactLength("Backside Room/Panel_two_two", kWhiteMiddle, 2) |
@@ -472,6 +593,19 @@ func generate(chosen_seed): | |||
472 | _gExactLength("Backside Room/Panel_three_three_2", kWhiteMiddle, 3) | 593 | _gExactLength("Backside Room/Panel_three_three_2", kWhiteMiddle, 3) |
473 | _gExactLength("Backside Room/Panel_three_three_3", kWhiteMiddle, 3) | 594 | _gExactLength("Backside Room/Panel_three_three_3", kWhiteMiddle, 3) |
474 | 595 | ||
596 | _gSingle("Color Arrow Room/Panel_red_near", kWhiteMiddle) | ||
597 | _gSingle("Color Arrow Room/Panel_blue_near", kWhiteMiddle) | ||
598 | _gSingle("Color Arrow Room/Panel_yellow_near", kWhiteMiddle) | ||
599 | _gSingle("Color Arrow Room/Panel_orange_near", kWhiteMiddle) | ||
600 | _gSingle("Color Arrow Room/Panel_purple_near", kWhiteMiddle) | ||
601 | _gSingle("Color Arrow Room/Panel_green_near", kWhiteMiddle) | ||
602 | _gCopyHidden("Color Arrow Room/Panel_red_near", "Color Arrow Room/Panel_red_afar") | ||
603 | _gCopyHidden("Color Arrow Room/Panel_blue_near", "Color Arrow Room/Panel_blue_afar") | ||
604 | _gCopyHidden("Color Arrow Room/Panel_yellow_near", "Color Arrow Room/Panel_yellow_afar") | ||
605 | _gCopyHidden("Color Arrow Room/Panel_orange_near", "Color Arrow Room/Panel_orange_afar") | ||
606 | _gCopyHidden("Color Arrow Room/Panel_purple_near", "Color Arrow Room/Panel_purple_afar") | ||
607 | _gCopyHidden("Color Arrow Room/Panel_green_near", "Color Arrow Room/Panel_green_afar") | ||
608 | |||
475 | _setFlag(kObscureHint) | 609 | _setFlag(kObscureHint) |
476 | _gSingle("Entry Room/Panel_forward_forward", kWhiteMiddle) | 610 | _gSingle("Entry Room/Panel_forward_forward", kWhiteMiddle) |
477 | _gSingle("Entry Room/Panel_between_between", kWhiteMiddle) | 611 | _gSingle("Entry Room/Panel_between_between", kWhiteMiddle) |
@@ -487,7 +621,6 @@ func generate(chosen_seed): | |||
487 | _gSingle("Shuffle Room/Panel_crossroads_crossroads", kWhiteMiddle) | 621 | _gSingle("Shuffle Room/Panel_crossroads_crossroads", kWhiteMiddle) |
488 | _gSingle("Shuffle Room/Panel_corner_corner", kWhiteMiddle) | 622 | _gSingle("Shuffle Room/Panel_corner_corner", kWhiteMiddle) |
489 | _gSingle("Shuffle Room/Panel_hollow_hollow", kWhiteMiddle) | 623 | _gSingle("Shuffle Room/Panel_hollow_hollow", kWhiteMiddle) |
490 | _gPaired("Shuffle Room/Panel_far_far", "Shuffle Room/Panel_near_near", kWhiteMiddle) | ||
491 | 624 | ||
492 | _gSingle("Maze Room/Panel_trace_trace", kWhiteMiddle) | 625 | _gSingle("Maze Room/Panel_trace_trace", kWhiteMiddle) |
493 | 626 | ||
@@ -561,6 +694,14 @@ func generate(chosen_seed): | |||
561 | print("%s: %s? %s!" % puzzle) | 694 | print("%s: %s? %s!" % puzzle) |
562 | 695 | ||
563 | 696 | ||
697 | func apply(scene): | ||
698 | var panels_parent = scene.get_node("Panels") | ||
699 | for puzzle in panel_mapping: | ||
700 | var panel = panels_parent.get_node(puzzle[0]) | ||
701 | panel.text = puzzle[1] | ||
702 | panel.answer = puzzle[2] | ||
703 | |||
704 | |||
564 | func _pickRandom(set): | 705 | func _pickRandom(set): |
565 | var id = _rng.randi_range(0, set.size() - 1) | 706 | var id = _rng.randi_range(0, set.size() - 1) |
566 | return set[id] | 707 | return set[id] |
@@ -628,10 +769,34 @@ func _gDouble(panel1_path, panel2_path, puzzle_type): | |||
628 | _setPanel(panel2_path, hint2_id, answer_id) | 769 | _setPanel(panel2_path, hint2_id, answer_id) |
629 | 770 | ||
630 | 771 | ||
772 | func _gQuadruple(panel1_path, panel2_path, panel3_path, panel4_path, puzzle_type): | ||
773 | var pre_choices = _filterBestPuzzles(_answers_by_type[puzzle_type]) | ||
774 | var puzzle_choices = [] | ||
775 | for word_id in pre_choices: | ||
776 | if _puzzle_by_id[word_id][1][puzzle_type].size() > 3: | ||
777 | puzzle_choices.append(word_id) | ||
778 | if puzzle_choices.empty(): | ||
779 | print("No possible puzzles for panel %s" % panel1_path) | ||
780 | else: | ||
781 | var answer_id = _pickRandom(puzzle_choices) | ||
782 | var hint_choices = _puzzle_by_id[answer_id][1][puzzle_type].duplicate() | ||
783 | var hint1_id = _pickRandom(hint_choices) | ||
784 | hint_choices.erase(hint1_id) | ||
785 | var hint2_id = _pickRandom(hint_choices) | ||
786 | hint_choices.erase(hint2_id) | ||
787 | var hint3_id = _pickRandom(hint_choices) | ||
788 | hint_choices.erase(hint3_id) | ||
789 | var hint4_id = _pickRandom(hint_choices) | ||
790 | _setPanel(panel1_path, hint1_id, answer_id) | ||
791 | _setPanel(panel2_path, hint2_id, answer_id) | ||
792 | _setPanel(panel3_path, hint3_id, answer_id) | ||
793 | _setPanel(panel4_path, hint4_id, answer_id) | ||
794 | |||
795 | |||
631 | func _gPaired(panel1_path, panel2_path, puzzle_type): | 796 | func _gPaired(panel1_path, panel2_path, puzzle_type): |
632 | var needed_type = puzzle_type | 797 | var needed_type = puzzle_type |
633 | if puzzle_type == kWhiteMiddle: | 798 | if puzzle_type == kWhiteMiddle: |
634 | needed_type = kBlackMiddle | 799 | needed_type = kBlackBottom |
635 | var puzzle_choices = _filterBestPuzzles(_answers_by_type[needed_type]) | 800 | var puzzle_choices = _filterBestPuzzles(_answers_by_type[needed_type]) |
636 | if puzzle_choices.empty(): | 801 | if puzzle_choices.empty(): |
637 | print("No possible puzzles for panel %s" % panel1_path) | 802 | print("No possible puzzles for panel %s" % panel1_path) |
@@ -647,10 +812,6 @@ func _gPaired(panel1_path, panel2_path, puzzle_type): | |||
647 | _setPanel(panel2_path, answer_id, hint_id) | 812 | _setPanel(panel2_path, answer_id, hint_id) |
648 | 813 | ||
649 | 814 | ||
650 | func _gCohinted(panel1_path, panel2_path, puzzle_type): | ||
651 | pass | ||
652 | |||
653 | |||
654 | func _gStack2(panel1_path, puzzle_type1, panel2_path, puzzle_type2): | 815 | func _gStack2(panel1_path, puzzle_type1, panel2_path, puzzle_type2): |
655 | if puzzle_type1 == kWhiteMiddle or puzzle_type2 == kWhiteMiddle: | 816 | if puzzle_type1 == kWhiteMiddle or puzzle_type2 == kWhiteMiddle: |
656 | if puzzle_type1 == kWhiteMiddle: | 817 | if puzzle_type1 == kWhiteMiddle: |
@@ -678,17 +839,15 @@ func _gStack2(panel1_path, puzzle_type1, panel2_path, puzzle_type2): | |||
678 | 839 | ||
679 | 840 | ||
680 | func _gCopy(panel1_path, panel2_path): | 841 | func _gCopy(panel1_path, panel2_path): |
681 | for thing in panel_mapping: | 842 | _writePanel(panel2_path, _hint_by_path[panel1_path], _answer_by_path[panel1_path]) |
682 | if thing[0] == panel1_path: | ||
683 | panel_mapping.append([panel2_path, thing[1], thing[2]]) | ||
684 | return | ||
685 | 843 | ||
686 | 844 | ||
687 | func _gCopyAnswer(panel1_path, panel2_path): | 845 | func _gCopyAnswer(panel1_path, panel2_path): |
688 | for thing in panel_mapping: | 846 | _writePanel(panel2_path, _answer_by_path[panel1_path], _answer_by_path[panel1_path]) |
689 | if thing[0] == panel1_path: | 847 | |
690 | panel_mapping.append([panel2_path, thing[2], thing[2]]) | 848 | |
691 | return | 849 | func _gCopyHidden(panel1_path, panel2_path): |
850 | _writePanel(panel2_path, "?".repeat(_answer_by_path[panel1_path].length()), _answer_by_path[panel1_path]) | ||
692 | 851 | ||
693 | 852 | ||
694 | func _gExactLength(panel_path, puzzle_type, answer_length): | 853 | func _gExactLength(panel_path, puzzle_type, answer_length): |
@@ -709,15 +868,17 @@ func _gExactLength(panel_path, puzzle_type, answer_length): | |||
709 | 868 | ||
710 | 869 | ||
711 | func _filterBestPuzzles(input): | 870 | func _filterBestPuzzles(input): |
712 | var not_uniqued = [] | 871 | var acceptable = [] |
713 | if _unique_pool == "": | 872 | for word_id in input: |
714 | not_uniqued = input | 873 | if ( |
715 | elif _answers_by_unique_pool.has(_unique_pool): | 874 | _unique_pool != "" |
716 | for word_id in input: | 875 | and _answers_by_unique_pool.has(_unique_pool) |
717 | if not _answers_by_unique_pool[_unique_pool].has(word_id): | 876 | and _answers_by_unique_pool[_unique_pool].has(word_id) |
718 | not_uniqued.append(word_id) | 877 | ): |
719 | else: | 878 | continue |
720 | not_uniqued = input | 879 | if _isFlag(kShortAnswer) and _answer_by_id[word_id].length() > 4: |
880 | continue | ||
881 | acceptable.append(word_id) | ||
721 | #if _isFlag(kMustReuseAnswer): | 882 | #if _isFlag(kMustReuseAnswer): |
722 | # var possible = [] | 883 | # var possible = [] |
723 | # for word_id in not_uniqued: | 884 | # for word_id in not_uniqued: |
@@ -725,11 +886,11 @@ func _filterBestPuzzles(input): | |||
725 | # possible.append(word_id) | 886 | # possible.append(word_id) |
726 | # not_uniqued = possible | 887 | # not_uniqued = possible |
727 | var result = [] | 888 | var result = [] |
728 | for word_id in not_uniqued: | 889 | for word_id in acceptable: |
729 | if _needs_reuse.has(word_id): | 890 | if _needs_reuse.has(word_id): |
730 | result.append(word_id) | 891 | result.append(word_id) |
731 | if result.empty(): | 892 | if result.empty(): |
732 | for word_id in not_uniqued: | 893 | for word_id in acceptable: |
733 | result.append(word_id) | 894 | result.append(word_id) |
734 | if _possible_reuse.has(word_id): | 895 | if _possible_reuse.has(word_id): |
735 | result.append(word_id) | 896 | result.append(word_id) |
@@ -739,10 +900,32 @@ func _filterBestPuzzles(input): | |||
739 | func _setPanel(panel_path, hint_id, answer_id): | 900 | func _setPanel(panel_path, hint_id, answer_id): |
740 | if _unique_pool != "": | 901 | if _unique_pool != "": |
741 | _answers_by_unique_pool[_unique_pool].append(answer_id) | 902 | _answers_by_unique_pool[_unique_pool].append(answer_id) |
742 | panel_mapping.append([panel_path, _answer_by_id[hint_id], _answer_by_id[answer_id]]) | 903 | |
904 | var hint_text = _answer_by_id[hint_id] | ||
905 | if _isFlag(kObscureHint): | ||
906 | var numToObscure = 1 | ||
907 | if hint_text.length()/3 > 0: | ||
908 | numToObscure = _rng.randi_range(1, hint_text.length()/3) | ||
909 | var iota = range(0, hint_text.length()) | ||
910 | var order = [] | ||
911 | while not iota.empty(): | ||
912 | var i = _rng.randi_range(0, iota.size() - 1) | ||
913 | order.append(iota[i]) | ||
914 | iota.remove(i) | ||
915 | for i in range(0, numToObscure): | ||
916 | if hint_text[order[i]] != " " and hint_text[order[i]] != "-": | ||
917 | hint_text[order[i]] = "?" | ||
918 | |||
919 | _writePanel(panel_path, hint_text, _answer_by_id[answer_id]) | ||
743 | if not _isFlag(kMustReuseAnswer): | 920 | if not _isFlag(kMustReuseAnswer): |
744 | if _needs_reuse.has(answer_id): | 921 | if _needs_reuse.has(answer_id): |
745 | _needs_reuse.erase(answer_id) | 922 | _needs_reuse.erase(answer_id) |
746 | _possible_reuse.append(answer_id) | 923 | _possible_reuse.append(answer_id) |
924 | |||
925 | |||
926 | func _writePanel(panel_path, hint, answer): | ||
927 | panel_mapping.append([panel_path, hint, answer]) | ||
928 | _hint_by_path[panel_path] = hint | ||
929 | _answer_by_path[panel_path] = answer | ||
747 | _total_generated += 1 | 930 | _total_generated += 1 |
748 | emit_signal("generator_status", "Generating puzzles... (%d/?)" % _total_generated) | 931 | emit_signal("generator_status", "Generating puzzles... (%d/?)" % _total_generated) |
diff --git a/randomizer/load.gd b/randomizer/load.gd index 727e368..9fcd038 100644 --- a/randomizer/load.gd +++ b/randomizer/load.gd | |||
@@ -5,14 +5,73 @@ func _load(): | |||
5 | global._print("Hooked Load Start") | 5 | global._print("Hooked Load Start") |
6 | 6 | ||
7 | var randomizer = global.get_node("Randomizer") | 7 | var randomizer = global.get_node("Randomizer") |
8 | var panels_parent = $Panels | ||
9 | |||
10 | # Hide the countdown true panels. | ||
11 | for child in $CountdownPanels.get_children(): | ||
12 | if child.is_class("Spatial"): | ||
13 | child.get_node(child.replace_with).translation.y -= 100.0 | ||
8 | 14 | ||
9 | # Apply the randomized panels. | 15 | # Apply the randomized panels. |
10 | var panels_parent = $Panels | 16 | randomizer.generator.apply(self) |
11 | for puzzle in randomizer.generator.panel_mapping: | 17 | |
12 | var panel = panels_parent.get_node(puzzle[0]) | 18 | # Write static panels. |
13 | panel.text = puzzle[1] | 19 | set_static_panel("Entry Room/Panel_hi_hi", "hi") |
14 | panel.answer = puzzle[2] | 20 | if randomizer.generator.is_set_seed: |
21 | set_static_panel("Entry Room/Panel_write_write", "set seed") | ||
22 | else: | ||
23 | set_static_panel("Entry Room/Panel_write_write", "random seed") | ||
24 | set_static_panel("Entry Room/Panel_same_same", str(randomizer.generator.gen_seed)) | ||
25 | set_static_panel("Entry Room/Panel_type_type", "version") | ||
26 | set_static_panel("Entry Room/Panel_this_this", randomizer.my_version) | ||
27 | set_static_panel("Entry Room/Panel_hi_high", "goode", "good") | ||
28 | set_static_panel("Entry Room/Panel_low_low", "serendipity", "luck") | ||
29 | set_static_panel("Shuffle Room/Panel_secret_secret", "trans rights", "human rights") | ||
30 | set_static_panel("Color Arrow Room/Panel_me", "me", "hatkirby") | ||
31 | |||
32 | # HOT CRUSTS should be at eye-level, have a yellow block behind it, and | ||
33 | # not vanish when solved. | ||
34 | var hotcrusts = panels_parent.get_node("Shuffle Room/Panel_shortcuts") | ||
35 | hotcrusts.translation.y = 1.5 | ||
36 | hotcrusts.get_node("Viewport/GUI/Panel/TextEdit").disconnect( | ||
37 | "answer_correct", hotcrusts, "handle_correct" | ||
38 | ) | ||
39 | |||
40 | set_gridmap_tile(-20.5, 1.5, -79.5, "MeshInstance9") | ||
41 | |||
42 | # TRANS RIGHTS should be bottom white, like it used to be. | ||
43 | var trans_rights = panels_parent.get_node("Shuffle Room/Panel_secret_secret") | ||
44 | trans_rights.translation.y = 0.5 | ||
45 | |||
46 | # Move LOW/LOW back to where it used to be. | ||
47 | var panel_low = panels_parent.get_node("Entry Room/Panel_low_low") | ||
48 | var sign_low = $Decorations/PanelSign/sign21 | ||
49 | panel_low.translation = sign_low.translation | ||
50 | panel_low.rotation = sign_low.rotation | ||
51 | sign_low.queue_free() | ||
52 | |||
53 | # Require LOW/LOW for opening the second door. | ||
54 | get_node("Doors/Entry Room Area Doors/Door_hi_high").panels.append("../../../Panels/Entry Room/Panel_low_low") | ||
55 | get_node("Doors/Entry Room Area Doors/Door_hi_high")._ready() | ||
15 | 56 | ||
16 | # Proceed with the rest of the load. | 57 | # Proceed with the rest of the load. |
17 | global._print("Hooked Load End") | 58 | global._print("Hooked Load End") |
18 | ._load() | 59 | ._load() |
60 | |||
61 | |||
62 | func set_static_panel(name, question, answer = ""): | ||
63 | if answer == "": | ||
64 | answer = question | ||
65 | |||
66 | var node = self.get_node("Panels").get_node(name) | ||
67 | |||
68 | node.text = question | ||
69 | node.answer = answer | ||
70 | |||
71 | |||
72 | func set_gridmap_tile(x, y, z, tile): | ||
73 | var gridmap = self.get_node("GridMap") | ||
74 | var mesh_library = gridmap.mesh_library | ||
75 | var mapvec = gridmap.world_to_map(gridmap.to_local(Vector3(x, y, z))) | ||
76 | |||
77 | gridmap.set_cell_item(mapvec.x, mapvec.y, mapvec.z, mesh_library.find_item_by_name(tile)) | ||