Microsoft Small Basic

Program Listing: SWT064
'General config (Window)
gw = 552
gh = 482
bg = "SeaGreen" 'GraphicsWindow.GetRandomColor()
GraphicsWindow.Width = gw
GraphicsWindow.Height = gh
GraphicsWindow.BackgroundColor = bg
GraphicsWindow.Title = "Small Basic Sudoku"
GraphicsWindow.CanResize = "False"
GraphicsWindow.Show()

'Grid Color (standard)
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(20, 20, 360, 360)

'Call by click
GraphicsWindow.MouseDown = mouseClicks
Sub mouseClicks
xpos = GraphicsWindow.MouseX
ypos = GraphicsWindow.MouseY

'Background Color
if (xpos > 420 and xpos < 528) And (ypos > 60 And ypos < 160) then
setBackground()
endif

'Grid Color
If (xpos > 420 And xpos < 528) And (ypos > 215 And ypos < 316) then
GridColor()
endif

'Start the Timer
If (xpos > 297 And xpos < 381) And (ypos > 417 And ypos < 471) then
StartTimer()
endif

'Select Box
If (xpos > 20 And xpos < 383) And (ypos > 20 And ypos < 383) then
allBox()
endif

Endsub

'Draw the Grid
CreateGrid()

'Sub (background color)
Sub setBackground
If (xpos > 420 And xpos < (420 + 20)) Then
If (ypos > 60 And ypos < (60 + 20)) Then
GraphicsWindow.BackgroundColor = "WhiteSmoke"
EndIf
EndIf
If (xpos > 465 And xpos < (465 + 20)) then
If (ypos > 60 And ypos < (60 + 20)) Then
GraphicsWindow.BackgroundColor = "RoyalBlue"
EndIf
Endif
If (xpos > 508 And xpos < (508 + 20)) then
If (ypos > 60 And ypos < (60 + 20)) Then
GraphicsWindow.BackgroundColor = "IndianRed"
EndIf
Endif
If (xpos > 420 And xpos < (420 + 20)) then
If (ypos > 100 And ypos < (100 + 20)) Then
GraphicsWindow.BackgroundColor = "Tomato"
EndIf
Endif
If (xpos > 465 And xpos < (465 + 20)) then
If (ypos > 100 And ypos < (100 + 20)) Then
GraphicsWindow.BackgroundColor = "SeaGreen"
EndIf
Endif
If (xpos > 508 And xpos < (508 + 20)) then
If (ypos > 100 And ypos < (100 + 20)) Then
GraphicsWindow.BackgroundColor = "Orchid"
EndIf
Endif
If (xpos > 420 And xpos < (420 + 20)) then
If (ypos > 140 And ypos < (140 + 20)) Then
GraphicsWindow.BackgroundColor = "Gold"
EndIf
Endif
If (xpos > 465 And xpos < (465 + 20)) then
If (ypos > 140 And ypos < (140 + 20)) Then
GraphicsWindow.BackgroundColor = "Gray"
EndIf
Endif
If (xpos > 508 And xpos < (508 + 20)) then
If (ypos > 140 And ypos < (140 + 20)) Then
GraphicsWindow.BackgroundColor = "Chocolate"
EndIf
Endif
endsub

'Sub (Start the Timer)
Sub StartTimer
If (xpos > 297 And xpos < (297 + 84)) then
If (ypos > 444 And ypos < (444 + 27)) Then
Timer.Tick = CountSeconds
GraphicsWindow.BrushColor = "GainsBoro"
GraphicsWindow.FillRectangle(299, 446, 80, 25)
EndIf
Endif

If (xpos > 297 And xpos < (297 + 42)) then
If (ypos > 417 And ypos < (417 + 27)) Then
Timer.Pause()
EndIf
Endif

If (xpos > 339 And xpos < (339 + 84)) then
If (ypos > 417 And ypos < (417 + 27)) Then
Timer.Resume()
EndIf
Endif
Endsub

'Sub (Grid Color)
Sub GridColor
If (xpos > 420 And xpos < (420 + 20)) Then
If (ypos > 215 And ypos < (215 + 20)) Then
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(20, 20, 360, 360)
CreateGrid()
EndIf
Endif

If (xpos > 465 And xpos < (465 + 20)) then
If (ypos > 215 And ypos < (215 + 20)) Then
GraphicsWindow.BrushColor = "CornFlowerBlue"
GraphicsWindow.FillRectangle(20, 20, 360, 360)
CreateGrid()
EndIf
endif

If (xpos > 508 And xpos < (508 + 20)) then
If (ypos > 215 And ypos < (215 + 20)) Then
GraphicsWindow.BrushColor = "Salmon"
GraphicsWindow.FillRectangle(20, 20, 360, 360)
CreateGrid()
If (LineOne = 1) then
SelectBox1()
Endif
EndIf
endif

If (xpos > 420 And xpos < (420 + 20)) then
If (ypos > 255 And ypos < (255 + 20)) Then
GraphicsWindow.BrushColor = "Coral"
GraphicsWindow.FillRectangle(20, 20, 360, 360)
CreateGrid()
If (LineOne = 1) then
SelectBox1()
Endif
EndIf
endif

If (xpos > 465 And xpos < (465 + 20)) then
If (ypos > 255 And ypos < (255 + 20)) Then
GraphicsWindow.BrushColor = "MediumSeaGreen"
GraphicsWindow.FillRectangle(20, 20, 360, 360)
CreateGrid()
If (LineOne = 1) then
SelectBox1()
Endif
EndIf
endif

If (xpos > 508 And xpos < (508 + 20)) then
If (ypos > 255 And ypos < (255 + 20)) Then
GraphicsWindow.BrushColor = "Violet"
GraphicsWindow.FillRectangle(20, 20, 360, 360)
CreateGrid()
If (LineOne = 1) then
SelectBox1()
Endif
EndIf
endif

If (xpos > 420 And xpos < (420 + 20)) then
If (ypos > 295 And ypos < (295 + 20)) Then
GraphicsWindow.BrushColor = "Khaki"
GraphicsWindow.FillRectangle(20, 20, 360, 360)
CreateGrid()
If (LineOne = 1) then
SelectBox1()
Endif
EndIf
endif

If (xpos > 465 And xpos < (465 + 20)) then
If (ypos > 295 And ypos < (295 + 20)) Then
GraphicsWindow.BrushColor = "DarkGray"
GraphicsWindow.FillRectangle(20, 20, 360, 360)
CreateGrid()
If (LineOne = 1) then
SelectBox1()
Endif
EndIf
endif

If (xpos > 508 And xpos < (508 + 20)) then
If (ypos > 295 And ypos < (295 + 20)) Then
GraphicsWindow.BrushColor = "Peru"
GraphicsWindow.FillRectangle(20, 20, 360, 360)
CreateGrid()
If (LineOne = 1) then
SelectBox1()
Endif
EndIf
endif
Endsub

'Sub (Select the box)
Sub allBox
If (xpos > 23 And xpos < (23 + 37)) then
If (ypos > 21 And ypos < (21 + 35)) Then
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(62, 21, 38, 35)
GraphicsWindow.FillRectangle(102, 21, 38, 35)
GraphicsWindow.FillRectangle(143, 21, 39, 35)
GraphicsWindow.FillRectangle(184, 21, 40, 35)
GraphicsWindow.FillRectangle(226, 21, 35, 35)
GraphicsWindow.FillRectangle(264, 21, 37, 35)
GraphicsWindow.FillRectangle(303, 21, 40, 35)
GraphicsWindow.FillRectangle(345, 21, 35, 35)
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox1()
fBox2()
fBox3()
fBox4()
fBox5()
fBox6()
fBox7()
fBox8()
fBox9()
fBox10()
LineOne = 1
Deletebox = 1
If (LineOne = 1) then
SelectBox1()
EndIf
endif
endif

If (xpos > 62 And xpos < (62 + 38)) then
If (ypos > 21 And ypos < (21 + 35)) Then
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
GraphicsWindow.FillRectangle(102, 21, 38, 35)
GraphicsWindow.FillRectangle(143, 21, 39, 35)
GraphicsWindow.FillRectangle(184, 21, 40, 35)
GraphicsWindow.FillRectangle(226, 21, 35, 35)
GraphicsWindow.FillRectangle(264, 21, 37, 35)
GraphicsWindow.FillRectangle(303, 21, 40, 35)
GraphicsWindow.FillRectangle(345, 21, 35, 35)
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox1()
fBox2()
fBox3()
fBox4()
fBox5()
fBox6()
fBox7()
fBox8()
fBox9()
fBox10()
LineOne = 2
Deletebox = 2
If (LineOne = 2) then
SelectBox2()
EndIf
endif
endif

If (xpos > 102 And xpos < (102 + 38)) then
If (ypos > 21 And ypos < (21 + 35)) Then
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 36, 35)
GraphicsWindow.FillRectangle(62, 21, 38, 35)
GraphicsWindow.FillRectangle(143, 21, 39, 35)
GraphicsWindow.FillRectangle(184, 21, 40, 35)
GraphicsWindow.FillRectangle(226, 21, 35, 35)
GraphicsWindow.FillRectangle(264, 21, 37, 35)
GraphicsWindow.FillRectangle(303, 21, 40, 35)
GraphicsWindow.FillRectangle(345, 21, 35, 35)
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox1()
fBox2()
fBox3()
fBox4()
fBox5()
fBox6()
fBox7()
fBox8()
fBox9()
fBox10()
LineOne = 3
Deletebox = 3
If (LineOne = 3) then
SelectBox3()
EndIf
endif
endif

If (xpos > 143 And xpos < (143 + 38)) then
If (ypos > 22 And ypos < (22 + 33)) Then
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
GraphicsWindow.FillRectangle(62, 21, 38, 35)
GraphicsWindow.FillRectangle(102, 21, 38, 35)
GraphicsWindow.FillRectangle(184, 21, 40, 35)
GraphicsWindow.FillRectangle(226, 21, 35, 35)
GraphicsWindow.FillRectangle(264, 21, 37, 35)
GraphicsWindow.FillRectangle(303, 21, 40, 35)
GraphicsWindow.FillRectangle(345, 21, 35, 35)
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox1()
fBox2()
fBox3()
fBox4()
fBox5()
fBox6()
fBox7()
fBox8()
fBox9()
fBox10()
LineOne = 4
Deletebox = 4
If (LineOne = 4) then
SelectBox4()
EndIf
endif
endif

If (xpos > 185 And xpos < (185 + 38)) then
If (ypos > 22 And ypos < (22 + 33)) Then
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
GraphicsWindow.FillRectangle(62, 21, 38, 35)
GraphicsWindow.FillRectangle(102, 21, 38, 35)
GraphicsWindow.FillRectangle(184, 21, 40, 35)
GraphicsWindow.FillRectangle(143, 21, 39, 35)
GraphicsWindow.FillRectangle(226, 21, 35, 35)
GraphicsWindow.FillRectangle(264, 21, 37, 35)
GraphicsWindow.FillRectangle(303, 21, 40, 35)
GraphicsWindow.FillRectangle(345, 21, 35, 35)
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox1()
fBox2()
fBox3()
fBox4()
fBox5()
fBox6()
fBox7()
fBox8()
fBox9()
fBox10()
LineOne = 5
Deletebox = 5
If (LineOne = 5) then
SelectBox5()
EndIf
endif
endif

If (xpos > 227 And xpos < (227 + 33)) then
If (ypos > 22 And ypos < (22 + 33)) Then
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
GraphicsWindow.FillRectangle(62, 21, 38, 35)
GraphicsWindow.FillRectangle(102, 21, 38, 35)
GraphicsWindow.FillRectangle(184, 21, 40, 35)
GraphicsWindow.FillRectangle(143, 21, 39, 35)
GraphicsWindow.FillRectangle(264, 21, 37, 35)
GraphicsWindow.FillRectangle(303, 21, 40, 35)
GraphicsWindow.FillRectangle(345, 21, 35, 35)
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox1()
fBox2()
fBox3()
fBox4()
fBox5()
fBox6()
fBox7()
fBox8()
fBox9()
fBox10()
LineOne = 6
Deletebox = 6
If (LineOne = 6) then
SelectBox6()
EndIf
endif
endif

If (xpos > 265 And xpos < (265 + 35)) then
If (ypos > 22 And ypos < (22 + 33)) Then
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
GraphicsWindow.FillRectangle(62, 21, 38, 35)
GraphicsWindow.FillRectangle(102, 21, 38, 35)
GraphicsWindow.FillRectangle(143, 21, 39, 35)
GraphicsWindow.FillRectangle(184, 21, 40, 35)
GraphicsWindow.FillRectangle(226, 21, 35, 35)
GraphicsWindow.FillRectangle(264, 21, 37, 35)
GraphicsWindow.FillRectangle(303, 21, 40, 35)
GraphicsWindow.FillRectangle(345, 21, 35, 35)
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox1()
fBox2()
fBox3()
fBox4()
fBox5()
fBox6()
fBox7()
fBox8()
fBox9()
fBox10()
LineOne = 7
Deletebox = 7
If (LineOne = 7) then
SelectBox7()
EndIf
endif
endif

If (xpos > 304 And xpos < (304 + 38)) then
If (ypos > 22 And ypos < (22 + 33)) Then
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
GraphicsWindow.FillRectangle(62, 21, 38, 35)
GraphicsWindow.FillRectangle(102, 21, 38, 35)
GraphicsWindow.FillRectangle(143, 21, 39, 35)
GraphicsWindow.FillRectangle(184, 21, 40, 35)
GraphicsWindow.FillRectangle(226, 21, 35, 35)
GraphicsWindow.FillRectangle(264, 21, 37, 35)
GraphicsWindow.FillRectangle(303, 21, 40, 35)
GraphicsWindow.FillRectangle(345, 21, 35, 35)
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox1()
fBox2()
fBox3()
fBox4()
fBox5()
fBox6()
fBox7()
fBox8()
fBox9()
fBox10()
LineOne = 8
Deletebox = 8
If (LineOne = 8) then
SelectBox8()
EndIf
endif
endif

If (xpos > 346 And xpos < (346 + 33)) then
If (ypos > 22 And ypos < (22 + 33)) Then
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
GraphicsWindow.FillRectangle(62, 21, 38, 35)
GraphicsWindow.FillRectangle(102, 21, 38, 35)
GraphicsWindow.FillRectangle(143, 21, 39, 35)
GraphicsWindow.FillRectangle(184, 21, 40, 35)
GraphicsWindow.FillRectangle(226, 21, 35, 35)
GraphicsWindow.FillRectangle(264, 21, 37, 35)
GraphicsWindow.FillRectangle(303, 21, 40, 35)
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox1()
fBox2()
fBox3()
fBox4()
fBox5()
fBox6()
fBox7()
fBox8()
fBox9()
fBox10()
LineOne = 9
Deletebox = 9
If (LineOne = 9) then
SelectBox9()
EndIf
endif
endif

If (xpos > 23 And xpos < (23 + 37)) then
If (ypos > 58 And ypos < (58 + 38)) Then
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
GraphicsWindow.FillRectangle(62, 21, 38, 35)
GraphicsWindow.FillRectangle(102, 21, 38, 35)
GraphicsWindow.FillRectangle(143, 21, 39, 35)
GraphicsWindow.FillRectangle(184, 21, 40, 35)
GraphicsWindow.FillRectangle(226, 21, 35, 35)
GraphicsWindow.FillRectangle(264, 21, 37, 35)
GraphicsWindow.FillRectangle(303, 21, 40, 35)
GraphicsWindow.FillRectangle(345, 21, 35, 35)
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox1()
fBox2()
fBox3()
fBox4()
fBox5()
fBox6()
fBox7()
fBox8()
fBox9()
fBox10()
LineOne = 10
Deletebox = 10
If (LineOne = 10) then
SelectBox10()
EndIf
endif
endif
Endsub

'Create the Grid
Sub CreateGrid
GraphicsWindow.PenColor = "Black"
GraphicsWindow.PenWidth = 6
GraphicsWindow.DrawRectangle(20, 18, 363, 360)
GraphicsWindow.PenWidth = 2

For Box = 1 To 3
GraphicsWindow.DrawRectangle(- 100 + Box * 121, 20, 120, 120)
GraphicsWindow.DrawRectangle(- 100 + Box * 121, 138, 120, 120)
GraphicsWindow.DrawRectangle(- 100 + Box * 121, 256, 120, 120)
EndFor

For LineX = 1 To 2
GraphicsWindow.DrawLine(20, 15 + LineX * 42, 380, 15 + LineX * 42)
GraphicsWindow.DrawLine(20, 134 + LineX * 42, 380, 134 + LineX * 42)
GraphicsWindow.DrawLine(20, 253 + LineX * 42, 380, 253 + LineX * 42)
EndFor

For LineY = 1 To 2
GraphicsWindow.DrawLine(21 + LineY * 40, 380, 21 + LineY * 40, 20)
GraphicsWindow.DrawLine(141 + LineY * 42, 380, 141 + LineY * 42, 20)
GraphicsWindow.DrawLine(260 + LineY * 42, 380, 260 + LineY * 42, 20)
EndFor
Endsub

LineOne = 0
Deletebox = 0

Sub SelectBox1
GraphicsWindow.PenWidth = 2
GraphicsWindow.PenColor = "Blue"
GraphicsWindow.DrawRectangle(24, 22, 35, 33)
endsub

Sub SelectBox2
GraphicsWindow.PenWidth = 2
GraphicsWindow.PenColor = "Blue"
GraphicsWindow.DrawRectangle(63, 22, 36, 33)
endsub

Sub SelectBox3
GraphicsWindow.PenWidth = 2
GraphicsWindow.PenColor = "Blue"
GraphicsWindow.DrawRectangle(103, 22, 36, 33)
endsub

Sub SelectBox4
GraphicsWindow.PenWidth = 2
GraphicsWindow.PenColor = "Blue"
GraphicsWindow.DrawRectangle(144, 22, 37, 33)
endsub

Sub SelectBox5
GraphicsWindow.PenWidth = 2
GraphicsWindow.PenColor = "Blue"
GraphicsWindow.DrawRectangle(185, 22, 38, 33)
endsub

Sub SelectBox6
GraphicsWindow.PenWidth = 2
GraphicsWindow.PenColor = "Blue"
GraphicsWindow.DrawRectangle(227, 22, 33, 33)
endsub

Sub SelectBox7
GraphicsWindow.PenWidth = 2
GraphicsWindow.PenColor = "Blue"
GraphicsWindow.DrawRectangle(265, 22, 35, 33)
endsub

Sub SelectBox8
GraphicsWindow.PenWidth = 2
GraphicsWindow.PenColor = "Blue"
GraphicsWindow.DrawRectangle(304, 22, 38, 33)
Endsub

Sub SelectBox9
GraphicsWindow.PenWidth = 2
GraphicsWindow.PenColor = "Blue"
GraphicsWindow.DrawRectangle(346, 22, 33, 33)
EndSub

Sub SelectBox10
GraphicsWindow.PenWidth = 2
GraphicsWindow.PenColor = "Blue"
GraphicsWindow.DrawRectangle(24, 59, 35, 38)
EndSub

box1 = ""
box2 = ""
box3 = "4"
box4 = "9"
box5 = "1"
box6 = ""
box7 = ""
box8 = ""
box9 = ""
box10 = ""

Sub fBox1
GraphicsWindow.FontSize = 25
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.DrawText(34,22, box1)
GraphicsWindow.BrushColor = "White"
endsub

Sub fBox2
GraphicsWindow.FontSize = 25
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.DrawText(74,22, box2)
GraphicsWindow.BrushColor = "White"
endsub

Sub fBox3
GraphicsWindow.FontSize = 25
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.DrawText(114,22, box3)
GraphicsWindow.BrushColor = "White"
endsub

Sub fBox4
GraphicsWindow.FontSize = 25
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.DrawText(155,22, box4)
GraphicsWindow.BrushColor = "White"
endsub

Sub fBox5
GraphicsWindow.FontSize = 25
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.DrawText(196,22, box5)
GraphicsWindow.BrushColor = "White"
endsub

Sub fBox6
GraphicsWindow.FontSize = 25
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.DrawText(235,22, box6)
GraphicsWindow.BrushColor = "White"
endsub

Sub fBox7
GraphicsWindow.FontSize = 25
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.DrawText(275,22, box7)
GraphicsWindow.BrushColor = "White"
endsub

Sub fBox8
GraphicsWindow.FontSize = 25
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.DrawText(315,22, box8)
GraphicsWindow.BrushColor = "White"
endsub

Sub fBox9
GraphicsWindow.FontSize = 25
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.DrawText(355,22, box9)
GraphicsWindow.BrushColor = "White"
endsub

Sub fBox10
GraphicsWindow.FontSize = 25
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.DrawText(34,62, box10)
GraphicsWindow.BrushColor = "White"
EndSub

GraphicsWindow.KeyDown = KeyPress
Sub KeyPress
key = GraphicsWindow.LastKey
If (key = "NumPad1" Or key = "D1") Then
If (LineOne = 1) then
LineOne = 0
Deletebox = 1
box1 = "1"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
fBox1()
endif
If (LineOne = 2) then
LineOne = 0
Deletebox = 1
box2 = "1"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(62, 21, 38, 35)
fBox2()
endif
If (LineOne = 6) then
LineOne = 0
Deletebox = 1
box6 = "1"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(226, 21, 35, 35)
fBox6()
endif
If (LineOne = 7) then
LineOne = 0
Deletebox = 1
box7 = "1"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(264, 21, 37, 35)
fBox7()
endif
If (LineOne = 8) then
LineOne = 0
Deletebox = 1
box8 = "1"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(303, 21, 40, 35)
fBox8()
endif
If (LineOne = 9) then
LineOne = 0
Deletebox = 1
box9 = "1"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(345, 21, 35, 35)
fBox9()
endif
If (LineOne = 10) then
LineOne = 0
Deletebox = 1
box10 = "1"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox10()
endif
EndIf

If (key = "NumPad2" Or key = "D2") Then
If (LineOne = 1) then
LineOne = 0
Deletebox = 2
box1 = "2"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
fBox1()
endif
If (LineOne = 2) then
LineOne = 0
Deletebox = 2
box2 = "2"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(62, 21, 38, 35)
fBox2()
endif
If (LineOne = 6) then
LineOne = 0
Deletebox = 2
box6 = "2"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(226, 21, 35, 35)
fBox6()
endif
If (LineOne = 7) then
LineOne = 0
Deletebox = 2
box7 = "2"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(264, 21, 37, 35)
fBox7()
endif
If (LineOne = 8) then
LineOne = 0
Deletebox = 2
box8 = "2"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(303, 21, 40, 35)
fBox8()
endif
If (LineOne = 9) then
LineOne = 0
Deletebox = 2
box9 = "2"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(345, 21, 35, 35)
fBox9()
endif
If (LineOne = 10) then
LineOne = 0
Deletebox = 2
box10 = "2"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox10()
endif
EndIf

If (key = "NumPad3" Or key = "D3") Then
If (LineOne = 1) then
LineOne = 0
Deletebox = 3
box1 = "3"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
fBox1()
endif
If (LineOne = 2) then
LineOne = 0
Deletebox = 3
box2 = "3"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(62, 21, 38, 35)
fBox2()
endif
If (LineOne = 6) then
LineOne = 0
Deletebox = 3
box6 = "3"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(226, 21, 35, 35)
fBox6()
endif
If (LineOne = 7) then
LineOne = 0
Deletebox = 3
box7 = "3"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(264, 21, 37, 35)
fBox7()
endif
If (LineOne = 8) then
LineOne = 0
Deletebox = 3
box8 = "3"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(303, 21, 40, 35)
fBox8()
endif
If (LineOne = 9) then
LineOne = 0
Deletebox = 3
box9 = "3"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(345, 21, 35, 35)
fBox9()
endif
If (LineOne = 10) then
LineOne = 0
Deletebox = 3
box10 = "3"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox10()
endif
EndIf

If (key = "NumPad4" Or key = "D4") Then
If (LineOne = 1) then
LineOne = 0
Deletebox = 4
box1 = "4"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
fBox1()
endif
If (LineOne = 2) then
LineOne = 0
Deletebox = 4
box2 = "4"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(62, 21, 38, 35)
fBox2()
endif
If (LineOne = 6) then
LineOne = 0
Deletebox = 4
box6 = "4"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(226, 21, 35, 35)
fBox6()
endif
If (LineOne = 7) then
LineOne = 0
Deletebox = 4
box7 = "4"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(264, 21, 37, 35)
fBox7()
endif
If (LineOne = 8) then
LineOne = 0
Deletebox = 4
box8 = "4"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(303, 21, 40, 35)
fBox8()
endif
If (LineOne = 9) then
LineOne = 0
Deletebox = 4
box9 = "4"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(345, 21, 35, 35)
fBox9()
endif
If (LineOne = 10) then
LineOne = 0
Deletebox = 4
box10 = "4"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox10()
endif
EndIf

If (key = "NumPad5" Or key = "D5") Then
If (LineOne = 1) then
LineOne = 0
Deletebox = 5
box1 = "5"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
fBox1()
endif
If (LineOne = 2) then
LineOne = 0
Deletebox = 5
box2 = "5"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(62, 21, 38, 35)
fBox2()
endif
If (LineOne = 6) then
LineOne = 0
Deletebox = 5
box6 = "5"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(226, 21, 35, 35)
fBox6()
endif
If (LineOne = 7) then
LineOne = 0
Deletebox = 5
box7 = "5"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(264, 21, 37, 35)
fBox7()
endif
If (LineOne = 8) then
LineOne = 0
Deletebox = 5
box8 = "5"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(303, 21, 40, 35)
fBox8()
endif
If (LineOne = 9) then
LineOne = 0
Deletebox = 5
box9 = "5"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(345, 21, 35, 35)
fBox9()
endif
If (LineOne = 10) then
LineOne = 0
Deletebox = 5
box10 = "5"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox10()
endif
EndIf

If (key = "NumPad6" Or key = "D6") Then
If (LineOne = 1) then
LineOne = 0
Deletebox = 6
box1 = "6"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
fBox1()
endif
If (LineOne = 2) then
LineOne = 0
Deletebox = 6
box2 = "6"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(62, 21, 38, 35)
fBox2()
endif
If (LineOne = 6) then
LineOne = 0
Deletebox = 6
box6 = "6"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(226, 21, 35, 35)
fBox6()
endif
If (LineOne = 7) then
LineOne = 0
Deletebox = 6
box7 = "6"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(264, 21, 37, 35)
fBox7()
endif
If (LineOne = 8) then
LineOne = 0
Deletebox = 6
box8 = "6"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(303, 21, 40, 35)
fBox8()
endif
If (LineOne = 9) then
LineOne = 0
Deletebox = 6
box9 = "6"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(345, 21, 35, 35)
fBox9()
endif
If (LineOne = 10) then
LineOne = 0
Deletebox = 6
box10 = "6"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox10()
endif
EndIf

If (key = "NumPad7" Or key = "D7") Then
If (LineOne = 1) then
LineOne = 0
Deletebox = 7
box1 = "7"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
fBox1()
endif
If (LineOne = 2) then
LineOne = 0
Deletebox = 7
box2 = "7"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(62, 21, 38, 35)
fBox2()
endif
If (LineOne = 6) then
LineOne = 0
Deletebox = 7
box6 = "7"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(226, 21, 35, 35)
fBox6()
endif
If (LineOne = 7) then
LineOne = 0
Deletebox = 7
box7 = "7"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(264, 21, 37, 35)
fBox7()
endif
If (LineOne = 8) then
LineOne = 0
Deletebox = 7
box8 = "7"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(303, 21, 40, 35)
fBox8()
endif
If (LineOne = 9) then
LineOne = 0
Deletebox = 7
box9 = "7"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(345, 21, 35, 35)
fBox9()
endif
If (LineOne = 10) then
LineOne = 0
Deletebox = 7
box10 = "7"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox10()
endif
EndIf

If (key = "NumPad8" Or key = "D8") Then
If (LineOne = 1) then
LineOne = 0
Deletebox = 8
box1 = "8"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
fBox1()
endif
If (LineOne = 2) then
LineOne = 0
Deletebox = 8
box2 = "8"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(62, 21, 38, 35)
fBox2()
endif
If (LineOne = 6) then
LineOne = 0
Deletebox = 8
box6 = "8"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(226, 21, 35, 35)
fBox6()
endif
If (LineOne = 7) then
LineOne = 0
Deletebox = 8
box7 = "8"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(264, 21, 37, 35)
fBox7()
endif
If (LineOne = 8) then
LineOne = 0
Deletebox = 8
box8 = "8"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(303, 21, 40, 35)
fBox8()
endif
If (LineOne = 9) then
LineOne = 0
Deletebox = 8
box9 = "8"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(345, 21, 35, 35)
fBox9()
endif
If (LineOne = 10) then
LineOne = 0
Deletebox = 8
box10 = "8"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox10()
endif
EndIf

If (key = "NumPad9" Or key = "D9") Then
If (LineOne = 1) then
LineOne = 0
Deletebox = 9
box1 = "9"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
fBox1()
endif
If (LineOne = 2) then
LineOne = 0
Deletebox = 9
box2 = "9"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(62, 21, 38, 35)
fBox2()
endif
If (LineOne = 6) then
LineOne = 0
Deletebox = 9
box6 = "9"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(226, 21, 35, 35)
fBox6()
endif
If (LineOne = 7) then
LineOne = 0
Deletebox = 9
box7 = "9"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(264, 21, 37, 35)
fBox7()
endif
If (LineOne = 8) then
LineOne = 0
Deletebox = 9
box8 = "9"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(303, 21, 40, 35)
fBox8()
endif
If (LineOne = 9) then
LineOne = 0
Deletebox = 9
box9 = "9"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(345, 21, 35, 35)
fBox9()
endif
If (LineOne = 10) then
LineOne = 0
Deletebox = 9
box10 = "9"
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox10()
endif
EndIf

'Delete number in box

If (key = "Delete" Or key = "Space") then
If (LineOne = 1 And Deletebox = 1) Then
LineOne = 0
Deletebox = 0
box1 = ""
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 21, 37, 35)
fBox1()
EndIf
If (LineOne = 2 And Deletebox = 2) Then
LineOne = 0
Deletebox = 0
box2 = ""
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(62, 21, 38, 35)
fBox2()
EndIf
If (LineOne = 6 And Deletebox = 6) then
LineOne = 0
Deletebox = 0
box6 = ""
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(226, 21, 35, 35)
fBox6()
endif
If (LineOne = 7 And Deletebox = 7) then
LineOne = 0
Deletebox = 0
box7 = ""
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(264, 21, 37, 35)
fBox7()
endif
If (LineOne = 8 And Deletebox = 8) then
LineOne = 0
Deletebox = 0
box8 = ""
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(303, 21, 40, 35)
fBox8()
endif
If (LineOne = 9 And Deletebox = 9) then
LineOne = 0
Deletebox = 0
box9 = ""
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(345, 21, 35, 35)
fBox9()
endif
If (LineOne = 10 And Deletebox = 10) then
LineOne = 0
Deletebox = 0
box10 = ""
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FillRectangle(23, 58, 37, 40)
fBox10()
endif
endif
endsub

fBox1()
fBox2()
fBox3()
fBox4()
fBox5()
fBox6()
fBox7()
fBox8()
fBox9()
fBox10()

'Section (choise the background color)
GraphicsWindow.BrushColor = "GainsBoro"
GraphicsWindow.FillRectangle(403, 51, 139, 119)
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.FillRectangle(402, 25, 142, 25)
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FontSize = 13
GraphicsWindow.DrawText(440, 30, "Background")
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(403, 50, 140, 120)

'Section (choise the grid color)
GraphicsWindow.BrushColor = "GainsBoro"
GraphicsWindow.FillRectangle(402, 205, 139, 119)
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.FillRectangle(402, 180, 142, 25)
GraphicsWindow.BrushColor = "White"
GraphicsWindow.FontSize = 13
GraphicsWindow.DrawText(463, 185, "Grid")
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(403, 205, 140, 120)

'Background color buttons
'White
GraphicsWindow.BrushColor = "WhiteSmoke"
GraphicsWindow.FillRectangle(420, 60, 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(419, 59, 21, 21)
'Blue
GraphicsWindow.BrushColor = "RoyalBlue"
GraphicsWindow.FillRectangle(465, 60, 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(464, 59, 21, 21)
'Red
GraphicsWindow.BrushColor = "IndianRed"
GraphicsWindow.FillRectangle(508, 60, 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(507, 59, 21, 21)
'Orange
GraphicsWindow.BrushColor = "Tomato"
GraphicsWindow.FillRectangle(420, 100, 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(419, 99, 21, 21)
'Green
GraphicsWindow.BrushColor = "SeaGreen"
GraphicsWindow.FillRectangle(465, 100 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(464, 99, 21, 21)
'Magenta
GraphicsWindow.BrushColor = "Orchid"
GraphicsWindow.FillRectangle(508, 100, 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(507, 99, 21, 21)
'Yellow (Gold)
GraphicsWindow.BrushColor = "Gold"
GraphicsWindow.FillRectangle(420, 140, 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(419, 139, 21, 21)
'Gray (DarkGray)
GraphicsWindow.BrushColor = "Gray"
GraphicsWindow.FillRectangle(465, 140, 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(464, 139, 21, 21)
'Brown (Peru)
GraphicsWindow.BrushColor = "Chocolate"
GraphicsWindow.FillRectangle(508, 140, 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(507, 139, 21, 21)

'Grid color buttons
'White
GraphicsWindow.BrushColor = "WhiteSmoke"
GraphicsWindow.FillRectangle(420, 215, 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(419, 214, 21, 21)
'Blue
GraphicsWindow.BrushColor = "CornFlowerBlue"
GraphicsWindow.FillRectangle(465, 215, 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(464, 214, 21, 21)
'Red
GraphicsWindow.BrushColor = "Salmon"
GraphicsWindow.FillRectangle(508, 215, 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(507, 214, 21, 21)
'Orange
GraphicsWindow.BrushColor = "Coral"
GraphicsWindow.FillRectangle(420, 255, 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(419, 254, 21, 21)
'Green
GraphicsWindow.BrushColor = "MediumSeaGreen"
GraphicsWindow.FillRectangle(465, 255 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(464, 255, 21, 21)
'Magenta
GraphicsWindow.BrushColor = "Violet"
GraphicsWindow.FillRectangle(508, 255, 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(507, 255, 21, 21)
'Yellow
GraphicsWindow.BrushColor = "Khaki"
GraphicsWindow.FillRectangle(420, 295, 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(419, 294, 21, 21)
'Gray (DarkGray)
GraphicsWindow.BrushColor = "DarkGray"
GraphicsWindow.FillRectangle(465, 295, 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(464, 295, 21, 21)
'Brown (Peru)
GraphicsWindow.BrushColor = "Peru"
GraphicsWindow.FillRectangle(508, 295, 20, 20)
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(507, 295, 21, 21)

'Game Timer
'Variables
'(sec, min, hour)
CountSec = 0
CountMin = 0
CountHour = 0
'Zero numbers
sZero = 0
mZero = 0
hZero = 0
'Sec positions
sSecX = 235
sSecY = 412
'Min positions
mMinX = 153
mMinY = 412
'Hour positions
hHourX = 0
hHourY = 0

'Background Timer
GraphicsWindow.FontSize = 13
GraphicsWindow.PenWidth = 4
GraphicsWindow.PenColor = "Black"
GraphicsWindow.DrawRectangle(20, 415, 264, 58)
GraphicsWindow.DrawRectangle(295, 415, 88, 58)
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.FillRectangle(18, 390, 367, 25)
GraphicsWindow.BrushColor = "White"
GraphicsWindow.DrawText(321,397, "Timer")
GraphicsWindow.BrushColor = "GainsBoro"
GraphicsWindow.FillRectangle(22, 417, 260, 54)
GraphicsWindow.FillRectangle(297, 417, 84, 54)
GraphicsWindow.BrushColor = "LemonChiffon"
GraphicsWindow.FillRectangle(297, 417, 42, 27)
GraphicsWindow.BrushColor = "LightSkyBlue"
GraphicsWindow.FillRectangle(339, 417, 42, 27)
GraphicsWindow.BrushColor = "Lime"
GraphicsWindow.FillRectangle(297, 444, 84, 27)
GraphicsWindow.PenColor = "black"
GraphicsWindow.DrawRectangle(297, 417, 42, 27)
GraphicsWindow.DrawRectangle(297, 444, 84, 27)
GraphicsWindow.DrawRectangle(297, 444, 84, 27)
GraphicsWindow.DrawRectangle(339, 417, 42, 27)
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.FontSize = 13
GraphicsWindow.DrawText(325, 450, "Start")
GraphicsWindow.DrawText(311, 423, "||")
GraphicsWindow.DrawText(356, 423, ">")

'Create the Timer
Timer.Interval = 1000

Sub CountSeconds
CountSec = CountSec + 1
GraphicsWindow.BrushColor = "GainsBoro"
GraphicsWindow.FillRectangle(22, 417, 260, 54)
GraphicsWindow.BrushColor = "Black"

GraphicsWindow.FontSize = "50"

If (CountSec = 10) Then
sZero = ""
sSecX = 203
sSecY = 412
EndIf

If (CountMin > 9) Then
mZero = ""
mMinX = 119
mMinY = 412
EndIf

If (CountSec = 60) Then
CountMin = CountMin + 1
CountSec = 0
sZero = "0"
sSecX = 235
sSecY = 412
EndIf

If (CountMin = 60) Then
CountHour = CountHour + 1
CountMin = 0
mMinX = 153
mZero = "0"
EndIf

GraphicsWindow.DrawText(102, 407, ":")
GraphicsWindow.DrawText(185, 407, ":")

GraphicsWindow.DrawText(sSecX,sSecY,CountSec)
GraphicsWindow.DrawText(203, 412, sZero)

GraphicsWindow.DrawText(mMinX,mMinY,CountMin)
GraphicsWindow.DrawText(119, 412, mZero)

GraphicsWindow.DrawText(69,412,CountHour)
GraphicsWindow.DrawText(35, 412, "0")

endsub