Last active
October 31, 2023 22:16
-
-
Save ParadoxV5/77cab0e2b47004712deba623fe5ea816 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BOARD = { | |
nil => %q[SCARY?!], | |
'🎃' => %q[BDEFGH ], | |
'👻' => %q[IJKLMN'], | |
'🍬' => %q[OPQTUV,], | |
'💀' => %q[WXZ.#$:] | |
} | |
row = BOARD[nil] | |
File.foreach 'input.txt', chomp: true do|line| | |
line.each_char do|char| | |
row = BOARD.fetch(char) do # invoked if key not found | |
print row[char.to_i] | |
BOARD[nil] | |
end | |
end | |
puts | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!ruby -p | |
gsub(/(\D?)(\d)/){'SCARY?!🎃BDEFGH 👻IJKLMN\'🍬OPQTUV,💀WXZ.#$:'[/#$1.{#$2}(.)/,1]} | |
# Well whadday know, @UlyssesZh’s algorithm and `⛳1 bytes[3].rb`’s are the only ones that covers the entire original board. | |
# Though this one too can squeeze some extra chars by simplfying off the the unused chars: | |
# ``gsub(/(\D?)(\d)/){"SCARY?!🎃BDEFGH 👻IJKLMN'🍬OPQTUV,💀WXZ."[/#$1.{#$2}(.)/,1]}`` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!ruby -p | |
gsub(/(\D?)(\d)/){"WXZ.IJKLMN'__BDEFGH ____OPQTUV,_SCARY?!_"[$2.hex-($1+?^).ord%77/2]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts$<.read.gsub(/(\S??)(\d)/){'SCARY?!🎃BDEFGH 👻IJKLMN\'🍬OPQTUV,💀WXZ.#$:'[/#$1.{#$2}(.)/,1]} | |
# ``puts$<.read.gsub(/(\S??)(\d)/){"SCARY?!🎃BDEFGH 👻IJKLMN'🍬OPQTUV,💀WXZ."[/#$1.{#$2}(.)/,1]}`` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts$<.read.gsub(/(\S??)(\d)/){'BDEFGH OPQTUV,WXZ.#$:SCARY?!IJKLMN\''[$2.hex-($1+?👼).bytes[3]%6*7]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts$<.read.gsub(/(\S??)(\d)/){"WXZ.IJKLMN'__BDEFGH ____OPQTUV,_SCARY?!_"[$2.hex-($1+?^).ord%77/2]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts~/\d/&&"SCARY?!BDEFGH IJKLMN'OPQTUV,"[($`.bytes[3]||0)/3%6*7+$&.hex]while gets | |
# @sampersand’s originally-shared non-acrostic edition: | |
# ``print~/\d/?"SCARY?!BDEFGH IJKLMN'OPQTUV,"[($`.bytes[3]||0)/3%6*7+$&.hex]:" "while gets`` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment