#################################################
# 15-112-n18 hw7
# Your Name:
# Your Andrew ID:
# Your Section:
#################################################

from tkinter import *
import math
    

def drawSudokuBoard(canvas, board, margin, canvasSize):
    canvas.create_text(canvasSize//2, canvasSize//2, 
        text="Implement drawSudokuBoard!", font="Arial 20 bold")

def drawStar(canvas, centerX, centerY, diameter, numPoints, color):
    canvas.create_text(centerX, centerY, text="Implement drawStar!", 
                                                    font="Arial 20 bold")

#################################################################
# hw7 tests
# Note: You must look at the output of these and confirm
# they work visually.
#################################################################


def getBoard0():
    return [
      [ 1, 2, 3, 4, 5, 6, 7, 8, 9],
      [ 5, 0, 8, 1, 3, 9, 6, 2, 4],
      [ 4, 9, 6, 8, 7, 2, 1, 5, 3],
      [ 9, 5, 2, 3, 8, 1, 4, 6, 7],
      [ 6, 4, 1, 2, 9, 7, 8, 3, 5],
      [ 3, 8, 7, 5, 6, 4, 0, 9, 1],
      [ 7, 1, 9, 6, 2, 3, 5, 4, 8],
      [ 8, 6, 4, 9, 1, 5, 3, 7, 2],
      [ 2, 3, 5, 7, 4, 8, 9, 1, 6]
    ]

def getBoard1():
    return [
        [1,2,3,4],
        [3,4,5,6],
        [7,8,9,10],
        [11,12,13,14]
    ]


def runSudoku(board, canvasSize=400):
    root = Tk()
    canvas = Canvas(root, width=canvasSize, height=canvasSize)
    canvas.pack()
    margin = 10
    drawSudokuBoard(canvas, board, margin, canvasSize)
    root.mainloop()

def testRunSudoku():
    print("Testing runSudoku()...")
    print("Since this is graphics, this test is not interactive.")
    print("Inspect each of these results manually to verify them.")
    runSudoku(getBoard0(), 400)
    runSudoku(getBoard1(), 500)
    print("Done!")

def runDrawStar(centerX, centerY, diameter, numPoints, color, 
                   winWidth=500, winHeight=500):
    root = Tk()
    canvas = Canvas(root, width=winWidth, height=winHeight)
    canvas.pack()

    drawStar(canvas, centerX, centerY, diameter, numPoints, color)

    root.mainloop()

def testDrawStar():
    print("Testing drawStar()...")
    print("Since this is graphics, this test is not interactive.")
    print("Inspect each of these results manually to verify them.")
    runDrawStar(250, 250, 500, 5, "gold")
    runDrawStar(300, 400, 100, 4, "blue")
    runDrawStar(300, 200, 300, 9, "red")
    print("Done!")


def testAll():
    testRunSudoku()
    testDrawStar()

def main():
    testAll()


if __name__ == '__main__':
    main()