From 235c2a463104c7e9bfce1dce202b5364b28f72d2 Mon Sep 17 00:00:00 2001 From: Paolo Villanueva Date: Sun, 17 Nov 2024 15:41:26 -0500 Subject: [PATCH 1/8] first commit --- Backend/main.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Backend/main.py diff --git a/Backend/main.py b/Backend/main.py new file mode 100644 index 00000000..e69de29b From 02d79782e5ba877ecded13af590f7f04f9162ff5 Mon Sep 17 00:00:00 2001 From: Paolo Villanueva Date: Sun, 17 Nov 2024 15:45:48 -0500 Subject: [PATCH 2/8] first commit* --- Backend/{main.py => sudoku.py} | 0 sudoku_generator.py => Backend/sudoku_generator.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename Backend/{main.py => sudoku.py} (100%) rename sudoku_generator.py => Backend/sudoku_generator.py (100%) diff --git a/Backend/main.py b/Backend/sudoku.py similarity index 100% rename from Backend/main.py rename to Backend/sudoku.py diff --git a/sudoku_generator.py b/Backend/sudoku_generator.py similarity index 100% rename from sudoku_generator.py rename to Backend/sudoku_generator.py From 13fc7440adbb464b1ed4aff2a3650bdc20615b9b Mon Sep 17 00:00:00 2001 From: Paolo Villanueva Date: Sun, 17 Nov 2024 15:47:50 -0500 Subject: [PATCH 3/8] First back --- Backend/test.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Backend/test.py diff --git a/Backend/test.py b/Backend/test.py new file mode 100644 index 00000000..e69de29b From 7c57296e826958ab59a03d77f872be4f13946c48 Mon Sep 17 00:00:00 2001 From: Paolo Villanueva Date: Sun, 17 Nov 2024 16:22:27 -0500 Subject: [PATCH 4/8] second --- Backend/board.py | 3 +++ Backend/cell.py | 2 ++ Backend/sudoku.py | 6 ++++++ Backend/sudoku_generator.py | 11 ++++++++--- Backend/test.py | 1 + test.py | 18 ++++++++++++++++++ 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 Backend/board.py create mode 100644 Backend/cell.py create mode 100644 test.py diff --git a/Backend/board.py b/Backend/board.py new file mode 100644 index 00000000..cd0d2fc5 --- /dev/null +++ b/Backend/board.py @@ -0,0 +1,3 @@ +class Board: + None + \ No newline at end of file diff --git a/Backend/cell.py b/Backend/cell.py new file mode 100644 index 00000000..1e88ac20 --- /dev/null +++ b/Backend/cell.py @@ -0,0 +1,2 @@ +class Cell: + None \ No newline at end of file diff --git a/Backend/sudoku.py b/Backend/sudoku.py index e69de29b..8aa84bb9 100644 --- a/Backend/sudoku.py +++ b/Backend/sudoku.py @@ -0,0 +1,6 @@ +def main(): + None + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/Backend/sudoku_generator.py b/Backend/sudoku_generator.py index 7ec18a59..e6ec6614 100644 --- a/Backend/sudoku_generator.py +++ b/Backend/sudoku_generator.py @@ -23,7 +23,11 @@ class SudokuGenerator: None ''' def __init__(self, row_length, removed_cells): - pass + self.row_length = row_length + self.removed_cells = removed_cells + self.board = [] + self.box_length = row_length ** 0.5 + ''' Returns a 2D python list of numbers which represents the board @@ -32,7 +36,7 @@ def __init__(self, row_length, removed_cells): Return: list[list] ''' def get_board(self): - pass + return self.board ''' Displays the board to the console @@ -42,7 +46,8 @@ def get_board(self): Return: None ''' def print_board(self): - pass + for i in range(self.board): + None ''' Determines if num is contained in the specified row (horizontal) of the board diff --git a/Backend/test.py b/Backend/test.py index e69de29b..8414caa3 100644 --- a/Backend/test.py +++ b/Backend/test.py @@ -0,0 +1 @@ +print(16 ** 0.5) \ No newline at end of file diff --git a/test.py b/test.py new file mode 100644 index 00000000..4936fde3 --- /dev/null +++ b/test.py @@ -0,0 +1,18 @@ +test_board = [ + [4, 8, 7, 9, 2, 5, 9, 1, 6], + [1, 8, 7, 6, 6, 9, 2, 7, 2], + [2, 3, 7, 1, 2, 9, 9, 8, 9], + [7, 9, 6, 2, 4, 9, 6, 1, 9], + [2, 1, 1, 4, 9, 5, 5, 7, 6], + [1, 3, 4, 6, 9, 5, 7, 2, 3], + [9, 2, 8, 5, 5, 9, 4, 6, 2], + [6, 5, 9, 3, 3, 6, 9, 9, 8], + [5, 9, 5, 7, 2, 7, 5, 7, 5] +] + +for i in range(len(test_board)): + print() + for j in test_board[i]: + print(j, end=" ") + +print() \ No newline at end of file From ce89bfefb807e468b5a5957211bde847ecbe3001 Mon Sep 17 00:00:00 2001 From: Paolo Villanueva Date: Sun, 17 Nov 2024 16:55:09 -0500 Subject: [PATCH 5/8] new --- test.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test.py b/test.py index 4936fde3..6e651519 100644 --- a/test.py +++ b/test.py @@ -10,9 +10,9 @@ [5, 9, 5, 7, 2, 7, 5, 7, 5] ] -for i in range(len(test_board)): +row_start = 5 +col_start = 1 +for i in range(row_start - 1 ,row_start + 2): + for j in range(col_start -1, col_start + 2): + print(test_board[i][j], end="") print() - for j in test_board[i]: - print(j, end=" ") - -print() \ No newline at end of file From e53b659fab82acc9c4f08b19f4af0aa0821df400 Mon Sep 17 00:00:00 2001 From: Paolo Villanueva Date: Sun, 17 Nov 2024 22:22:03 -0500 Subject: [PATCH 6/8] 11/17/24 10:22pm --- Backend/sudoku_generator.py | 37 ++++++++++++++++++++++++++++++---- {Backend => Frontend}/board.py | 0 {Backend => Frontend}/cell.py | 0 test.py | 20 ++++++++++++++---- 4 files changed, 49 insertions(+), 8 deletions(-) rename {Backend => Frontend}/board.py (100%) rename {Backend => Frontend}/cell.py (100%) diff --git a/Backend/sudoku_generator.py b/Backend/sudoku_generator.py index e6ec6614..2c14f58f 100644 --- a/Backend/sudoku_generator.py +++ b/Backend/sudoku_generator.py @@ -60,7 +60,11 @@ def print_board(self): Return: boolean ''' def valid_in_row(self, row, num): - pass + if num in self.board[row]: + return False + else: + return True + ''' Determines if num is contained in the specified column (vertical) of the board @@ -73,7 +77,10 @@ def valid_in_row(self, row, num): Return: boolean ''' def valid_in_col(self, col, num): - pass + for row in self.board: + if row[col] == num: + return False + return True ''' Determines if num is contained in the 3x3 box specified on the board @@ -88,7 +95,12 @@ def valid_in_col(self, col, num): Return: boolean ''' def valid_in_box(self, row_start, col_start, num): - pass + for i in range(row_start - 1 ,row_start + 2): + for j in range(col_start -1, col_start + 2): + if self.board[i][j] == num: + return False + + return True ''' Determines if it is valid to enter num at (row, col) in the board @@ -101,7 +113,24 @@ def valid_in_box(self, row_start, col_start, num): Return: boolean ''' def is_valid(self, row, col, num): - pass + if self.valid_in_col(col, num) and self.valid_in_row(row, num): + if row <= 3: + row_start = 1 + elif row <=6: + row_start = 4 + else: + row_start = 7 + if col <= 3: + col_start = 1 + elif col <= 6: + col_start = 4 + else: + col_start = 7 + if self.valid_in_box(row_start, col_start, num): + return True + + return False + ''' Fills the specified 3x3 box with values diff --git a/Backend/board.py b/Frontend/board.py similarity index 100% rename from Backend/board.py rename to Frontend/board.py diff --git a/Backend/cell.py b/Frontend/cell.py similarity index 100% rename from Backend/cell.py rename to Frontend/cell.py diff --git a/test.py b/test.py index 6e651519..f6f827f2 100644 --- a/test.py +++ b/test.py @@ -12,7 +12,19 @@ row_start = 5 col_start = 1 -for i in range(row_start - 1 ,row_start + 2): - for j in range(col_start -1, col_start + 2): - print(test_board[i][j], end="") - print() + +# Valid in box +# for i in range(row_start - 1 ,row_start + 2): +# for j in range(col_start -1, col_start + 2): +# print(test_board[i][j], end="") +# print() + +# for i in test_board: +# print(i[0]) + +# board = [] +# class Test: +# def __init__(self, board): +# self.board = board + +# test = Test(test_board) \ No newline at end of file From b87997c4358392e75c01ee712c2b02398028e888 Mon Sep 17 00:00:00 2001 From: Vianneej Date: Mon, 18 Nov 2024 16:22:52 -0500 Subject: [PATCH 7/8] first --- unicorn.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 unicorn.py diff --git a/unicorn.py b/unicorn.py new file mode 100644 index 00000000..e69de29b From 5a161154f839d20dc02e495b1af2d8d9cafb7488 Mon Sep 17 00:00:00 2001 From: Vianneej Date: Mon, 18 Nov 2024 16:28:44 -0500 Subject: [PATCH 8/8] first2 --- Frontend/unicorn.py | 1 + unicorn.py | 0 2 files changed, 1 insertion(+) create mode 100644 Frontend/unicorn.py delete mode 100644 unicorn.py diff --git a/Frontend/unicorn.py b/Frontend/unicorn.py new file mode 100644 index 00000000..a9f9cfbf --- /dev/null +++ b/Frontend/unicorn.py @@ -0,0 +1 @@ +import pygame diff --git a/unicorn.py b/unicorn.py deleted file mode 100644 index e69de29b..00000000