Last active
December 24, 2024 06:02
-
-
Save rikur/767148 to your computer and use it in GitHub Desktop.
I won the four-in-a-row code golf challenge 🥳
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
s='+---+---+---+---+---+---+---+ | |
| | | | | | | | | |
+---+---+---+---+---+---+---+ | |
| | | R | | | | | | |
+---+---+---+---+---+---+---+ | |
| R | | R | W | | | R | | |
+---+---+---+---+---+---+---+ | |
| R | | W | W | | | W | | |
+---+---+---+---+---+---+---+ | |
| W | W | R | R | | | R | | |
+---+---+---+---+---+---+---+ | |
| W | W | R | R | W | W | R | | |
+---+---+---+---+---+---+---+ | |
| W | W | R | W | R | R | W | | |
+---+---+---+---+---+---+---+'.gsub(/.*\+\n/,'').gsub(/ |\n/,'X').tr('| ','') | |
%w'W R'.map{|l|[0,6,7,8].map{|n|p l if s=~/(#{l}.{#{n}}){4}/}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment