Skip to content

Instantly share code, notes, and snippets.

@rikur
Created January 5, 2011 22:29
Show Gist options
  • Save rikur/767148 to your computer and use it in GitHub Desktop.
Save rikur/767148 to your computer and use it in GitHub Desktop.
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