Share your repls and programming experiences

← Back to all posts
Sudoku
h
sneukam

Sudoku

Click the green arrow to begin the game.

Enter the following commands into the Repl.it console to play. For those familiar with Sudoku and python, these should be self-explanatory.

--Commands --

New game

S = Sudoku()

Print board

S.print_board()

Add a number

S.add_num(5,1,1)

-- adds 5 to row 1, column 1
-- the add_num() method validates inputs against row/col/3x3 violations (no duplicates)
-- row and column inputs expect 1-base indices. (1-9)

Clear position

S.clear_position(1,1)

-- removes the number at row 1, column 1

Input a Row

S.input_row([1,' ',2,3,4,5,6,7,8,9])

-- This is for easier TA grading. Inputs are not validated against row/col/3x3 rule violations, only that digits 1-9 or a space ' ' character is entered.
-- This example places numbers 2-9 in row 1. Row 1, column 1 is still empty.

Clear the board

S.clear_board()

Verify Solution

S.verify_solution()

-- the board must be full.
-- results (or errors) printed to console.

Generate Solution

S.find_solution()

-- given a Sudoku puzzle with at least 17 and at most 77 clues, find a solution.

Voters
stu1082235
sneukam
Comments
hotnewtop
RedMonster12

i'm confused, do we have to make a new repel for this?

Gr8est

Dude, take it out of a comment, it will never work like that

sneukam

@Gr8est Somebody didn't read the directions (:

Gr8est

@sneukam, oh im sorry, i didn't realize that.