Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need simple task to do with parts of sudoku code in python I added all the rows and blocks to the groups list aliasing

I need simple task to do with parts of sudoku code in python I added all the rows and blocks to the groups list aliasing the actual tiles in the board. All you need is to add the columns following the same logic.

code------------------------

def __init__(self): """The empty board""" # Row/Column structure: Each row contains columns self.tiles: List[List[Tile]] = [] for row in range(NROWS): cols = [] for col in range(NCOLS): cols.append(Tile(row, col)) self.tiles.append(cols) # create an alias for each group for easy access. self.groups: List[List[Tile]] = [] # adding rows to groups for row in self.tiles: self.groups.append(row) # adding columns to groups # TODO: Add the column tiles as group to the groups of tiles # adding blocks to groups for block_row in range(SIZE): for block_col in range(SIZE): group = [] for row in range(SIZE): for col in range(SIZE): row_addr = (SIZE * block_row) + row col_addr = (SIZE * block_col) + col group.append(self.tiles[row_addr][col_addr]) self.groups.append(group) 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions