Skip to content

Instantly share code, notes, and snippets.

@dbc-challenges
Last active March 31, 2023 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 394 You must be signed in to fork a gist
  • Save dbc-challenges/31a17a82c8c7d27d82f0 to your computer and use it in GitHub Desktop.
Save dbc-challenges/31a17a82c8c7d27d82f0 to your computer and use it in GitHub Desktop.
Sudoku
105802000090076405200400819019007306762083090000061050007600030430020501600308900
005030081902850060600004050007402830349760005008300490150087002090000600026049503
105802000090076405200400819019007306762083090000061050007600030430020501600308900
005030081902850060600004050007402830349760005008300490150087002090000600026049503
290500007700000400004738012902003064800050070500067200309004005000080700087005109
080020000040500320020309046600090004000640501134050700360004002407230600000700450
608730000200000460000064820080005701900618004031000080860200039050000100100456200
370000001000700005408061090000010000050090460086002030000000000694005203800149500
000689100800000029150000008403000050200005000090240801084700910500000060060410000
030500804504200010008009000790806103000005400050000007800000702000704600610300500
096040001100060004504810390007950043030080000405023018010630059059070830003590007
000075400000000008080190000300001060000000034000068170204000603900000020530200000
300000000050703008000028070700000043000000000003904105400300800100040000968000200
302609005500730000000000900000940000000000109000057060008500006000000003019082040
class Sudoku
def initialize(board_string)
end
def solve!
end
# Returns a string representing the current state of the board
# Don't spend too much time on this method; flag someone from staff
# if you are.
def board
end
end
# The file has newlines at the end of each line, so we call
# String#chomp to remove them.
board_string = File.readlines('sample.unsolved.txt').first.chomp
game = Sudoku.new(board_string)
# Remember: this will just fill out what it can and not "guess"
game.solve!
puts game.board
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment