eod
This commit is contained in:
		
							parent
							
								
									82120ea3db
								
							
						
					
					
						commit
						6ea1eec07a
					
				| @ -1,25 +0,0 @@ | ||||
| return { | ||||
|     problem = { | ||||
|         {5, 3, 0, 0, 7, 0, 0, 0, 0}, | ||||
|         {6, 0, 0, 1, 9, 5, 0, 0, 0}, | ||||
|         {0, 9, 8, 0, 0, 0, 0, 6, 0}, | ||||
|         {8, 0, 0, 0, 6, 0, 0, 0, 3}, | ||||
|         {4, 0, 0, 8, 0, 3, 0, 0, 1}, | ||||
|         {7, 0, 0, 0, 2, 0, 0, 0, 6}, | ||||
|         {0, 6, 0, 0, 0, 0, 2, 8, 0}, | ||||
|         {0, 0, 0, 4, 1, 9, 0, 0, 5}, | ||||
|         {0, 0, 0, 0, 8, 0, 0, 7, 9}, | ||||
|     } | ||||
| 
 | ||||
|     solution = { | ||||
|         {5, 3, 4, 6, 7, 8, 9, 1, 2}, | ||||
|         {6, 7, 2, 1, 9, 5, 3, 4, 8}, | ||||
|         {1, 9, 8, 3, 4, 2, 5, 6, 7}, | ||||
|         {8, 5, 9, 7, 6, 1, 4, 2, 3}, | ||||
|         {4, 2, 6, 8, 5, 3, 7, 9, 1}, | ||||
|         {7, 1, 3, 9, 2, 4, 8, 5, 6}, | ||||
|         {9, 6, 1, 5, 3, 7, 2, 8, 4}, | ||||
|         {2, 8, 7, 4, 1, 9, 6, 3, 5}, | ||||
|         {3, 4, 5, 2, 8, 6, 1, 7, 9}, | ||||
|     } | ||||
| } | ||||
| @ -7,3 +7,13 @@ | ||||
| 0 0 0 0 0 9 8 4 0 | ||||
| 0 8 0 0 0 0 7 0 0 | ||||
| 9 0 7 8 0 0 0 0 3 | ||||
| 
 | ||||
| 4 5 8 9 7 2 3 1 6 | ||||
| 7 1 6 4 5 3 9 8 2 | ||||
| 3 9 2 1 8 6 4 5 7 | ||||
| 2 7 3 5 1 4 6 9 8 | ||||
| 8 4 9 2 6 7 5 3 1 | ||||
| 1 6 5 3 9 8 2 7 4 | ||||
| 6 3 1 7 2 9 8 4 5 | ||||
| 5 8 4 6 3 1 7 2 9 | ||||
| 9 2 7 8 4 5 1 6 3 | ||||
|  | ||||
							
								
								
									
										19
									
								
								boards/easy/03.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								boards/easy/03.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| 0 0 4 6 0 9 0 0 0 | ||||
| 0 8 1 7 0 0 9 0 0 | ||||
| 0 7 9 0 4 0 0 0 1 | ||||
| 0 0 0 0 7 5 0 0 4 | ||||
| 0 0 0 0 9 0 3 0 2 | ||||
| 0 0 0 8 6 0 0 5 0 | ||||
| 0 9 0 0 8 0 4 2 0 | ||||
| 0 2 0 9 0 6 0 0 0 | ||||
| 7 0 0 3 0 4 5 8 0 | ||||
| 
 | ||||
| 5 3 4 6 1 9 2 7 8 | ||||
| 6 8 1 7 3 2 9 4 5 | ||||
| 2 7 9 5 4 8 6 3 1 | ||||
| 1 6 3 2 7 5 8 9 4 | ||||
| 8 5 7 4 9 1 3 6 2 | ||||
| 9 4 2 8 6 3 1 5 7 | ||||
| 3 9 5 1 8 7 4 2 6 | ||||
| 4 2 8 9 5 6 7 1 3 | ||||
| 7 1 6 3 2 4 5 8 9 | ||||
							
								
								
									
										19
									
								
								boards/hard/01.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								boards/hard/01.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| 7 0 0 3 0 1 0 0 0 | ||||
| 0 0 8 9 0 0 0 0 5 | ||||
| 0 0 0 0 2 5 0 0 8 | ||||
| 9 1 0 0 5 0 2 0 3 | ||||
| 0 0 6 0 0 0 8 0 0 | ||||
| 8 0 2 0 9 0 0 5 1 | ||||
| 1 0 0 5 6 0 0 0 0 | ||||
| 4 0 0 0 0 2 9 0 0 | ||||
| 0 0 0 1 0 4 0 0 6 | ||||
| 
 | ||||
| 7 5 4 3 8 1 6 2 9 | ||||
| 3 2 8 9 4 6 1 7 5 | ||||
| 6 9 1 7 2 5 3 4 8 | ||||
| 9 1 7 4 5 8 2 6 3 | ||||
| 5 3 6 2 1 7 8 9 4 | ||||
| 8 4 2 6 9 3 7 5 1 | ||||
| 1 7 3 5 6 9 4 8 2 | ||||
| 4 6 5 8 3 2 9 1 7 | ||||
| 2 8 9 1 7 4 5 3 6 | ||||
							
								
								
									
										19
									
								
								boards/hard/02.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								boards/hard/02.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| 0 9 0 1 3 0 0 0 0 | ||||
| 0 1 0 6 0 0 2 4 0 | ||||
| 0 5 0 0 0 0 0 0 0 | ||||
| 0 0 0 0 1 9 7 3 0 | ||||
| 0 0 2 0 0 0 0 0 0 | ||||
| 0 0 0 0 5 2 0 1 4 | ||||
| 7 0 1 9 0 0 0 8 3 | ||||
| 0 0 0 0 0 0 0 0 0 | ||||
| 3 6 0 0 2 0 0 0 0 | ||||
| 
 | ||||
| 2 9 7 1 3 4 8 6 5 | ||||
| 8 1 3 6 9 5 2 4 7 | ||||
| 4 5 6 2 8 7 3 9 1 | ||||
| 6 4 5 8 1 9 7 3 2 | ||||
| 1 7 2 4 6 3 9 5 8 | ||||
| 9 3 8 7 5 2 6 1 4 | ||||
| 7 2 1 9 4 6 5 8 3 | ||||
| 5 8 9 3 7 1 4 2 6 | ||||
| 3 6 4 5 2 8 1 7 9 | ||||
							
								
								
									
										9
									
								
								boards/hard/03.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								boards/hard/03.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| 0 0 1 0 2 0 0 6 0 | ||||
| 5 3 0 0 0 0 0 0 0 | ||||
| 0 2 4 5 0 0 0 8 0 | ||||
| 4 0 0 0 3 0 2 0 0 | ||||
| 0 7 0 8 6 0 0 1 0 | ||||
| 3 0 0 0 7 2 0 0 0 | ||||
| 0 0 0 0 0 0 0 0 0 | ||||
| 0 0 0 9 0 0 1 0 8 | ||||
| 8 4 0 0 0 0 7 2 0 | ||||
							
								
								
									
										19
									
								
								boards/medium/01.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								boards/medium/01.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| 0 2 1 3 0 7 0 0 0 | ||||
| 0 5 0 0 0 1 9 0 0 | ||||
| 0 0 3 6 0 9 0 0 0 | ||||
| 0 7 0 0 0 0 0 5 1 | ||||
| 8 0 0 0 4 3 7 0 0 | ||||
| 0 0 0 0 0 0 0 9 0 | ||||
| 0 0 8 1 0 0 0 0 0 | ||||
| 0 0 0 0 0 8 4 0 9 | ||||
| 7 0 0 0 0 0 0 1 0 | ||||
| 
 | ||||
| 9 2 1 3 8 7 5 4 6 | ||||
| 6 5 7 4 2 1 9 8 3 | ||||
| 4 8 3 6 5 9 1 2 7 | ||||
| 2 7 4 8 9 6 3 5 1 | ||||
| 8 1 9 5 4 3 7 6 2 | ||||
| 5 3 6 7 1 2 8 9 4 | ||||
| 3 9 8 1 6 4 2 7 5 | ||||
| 1 6 5 2 7 8 4 3 9 | ||||
| 7 4 2 9 3 5 6 1 8 | ||||
							
								
								
									
										19
									
								
								boards/medium/02.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								boards/medium/02.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| 5 1 0 0 0 9 0 0 0 | ||||
| 0 0 3 1 0 0 4 2 0 | ||||
| 0 0 0 0 0 4 6 9 1 | ||||
| 8 5 0 0 0 0 0 0 0 | ||||
| 0 2 9 0 0 0 7 4 0 | ||||
| 0 0 0 0 0 0 0 5 3 | ||||
| 4 3 8 9 0 0 0 0 0 | ||||
| 0 7 5 0 0 6 8 0 0 | ||||
| 0 0 0 8 0 0 0 7 9 | ||||
| 
 | ||||
| 5 1 4 6 2 9 3 8 7 | ||||
| 6 9 3 1 8 7 4 2 5 | ||||
| 7 8 2 3 5 4 6 9 1 | ||||
| 8 5 7 4 3 2 9 1 6 | ||||
| 3 2 9 5 6 1 7 4 8 | ||||
| 1 4 6 7 9 8 2 5 3 | ||||
| 4 3 8 9 7 5 1 6 2 | ||||
| 9 7 5 2 1 6 8 3 4 | ||||
| 2 6 1 8 4 3 5 7 9 | ||||
							
								
								
									
										19
									
								
								boards/medium/03.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								boards/medium/03.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| 0 0 4 0 0 7 0 0 0 | ||||
| 0 8 1 0 0 5 4 0 0 | ||||
| 5 0 0 0 0 0 0 0 7 | ||||
| 0 4 9 0 0 0 6 0 0 | ||||
| 0 2 0 0 0 0 1 0 4 | ||||
| 0 0 0 3 0 0 7 8 0 | ||||
| 1 0 0 9 4 0 0 0 0 | ||||
| 0 0 0 8 6 0 3 0 0 | ||||
| 0 0 0 0 0 2 0 0 0 | ||||
| 
 | ||||
| 2 9 4 6 8 7 5 1 3 | ||||
| 7 8 1 2 3 5 4 9 6 | ||||
| 5 6 3 4 1 9 8 2 7 | ||||
| 3 4 9 1 7 8 6 5 2 | ||||
| 8 2 7 5 9 6 1 3 4 | ||||
| 6 1 5 3 2 4 7 8 9 | ||||
| 1 5 6 9 4 3 2 7 8 | ||||
| 9 7 2 8 6 1 3 4 5 | ||||
| 4 3 8 7 5 2 9 6 1 | ||||
							
								
								
									
										19
									
								
								boards/medium/04.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								boards/medium/04.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| 0 0 0 3 0 0 0 0 0 | ||||
| 0 0 5 0 4 8 0 0 0 | ||||
| 0 4 8 1 0 0 0 7 9 | ||||
| 0 0 0 0 0 4 0 0 0 | ||||
| 5 8 4 0 0 0 9 0 1 | ||||
| 1 9 0 2 0 0 0 0 6 | ||||
| 0 0 0 0 2 6 5 0 0 | ||||
| 0 0 9 5 0 0 3 0 0 | ||||
| 2 0 0 0 0 0 0 0 0 | ||||
| 
 | ||||
| 6 1 2 3 9 7 4 5 8 | ||||
| 9 7 5 6 4 8 2 1 3 | ||||
| 3 4 8 1 5 2 6 7 9 | ||||
| 7 2 6 9 1 4 8 3 5 | ||||
| 5 8 4 7 6 3 9 2 1 | ||||
| 1 9 3 2 8 5 7 4 6 | ||||
| 8 3 1 4 2 6 5 9 7 | ||||
| 4 6 9 5 7 1 3 8 2 | ||||
| 2 5 7 8 3 9 1 6 4 | ||||
							
								
								
									
										19
									
								
								boards/medium/05.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								boards/medium/05.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| 0 0 0 5 8 0 0 0 4 | ||||
| 4 0 8 2 0 1 3 0 0 | ||||
| 0 0 0 6 3 0 0 7 0 | ||||
| 0 5 3 0 0 0 6 0 9 | ||||
| 0 0 0 0 0 0 0 0 0 | ||||
| 8 0 7 0 0 0 2 3 0 | ||||
| 0 7 0 0 5 8 0 0 0 | ||||
| 0 0 1 4 0 7 8 0 2 | ||||
| 5 0 0 0 2 6 0 0 0 | ||||
| 
 | ||||
| 7 3 6 5 8 9 1 2 4 | ||||
| 4 9 8 2 7 1 3 6 5 | ||||
| 2 1 5 6 3 4 9 7 8 | ||||
| 1 5 3 7 4 2 6 8 9 | ||||
| 6 2 9 8 1 3 5 4 7 | ||||
| 8 4 7 9 6 5 2 3 1 | ||||
| 9 7 2 3 5 8 4 1 6 | ||||
| 3 6 1 4 9 7 8 5 2 | ||||
| 5 8 4 1 2 6 7 9 3 | ||||
							
								
								
									
										19
									
								
								boards/medium/06.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								boards/medium/06.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| 4 0 7 0 0 0 2 0 0 | ||||
| 0 0 0 0 0 3 6 0 0 | ||||
| 0 0 2 0 4 1 0 0 3 | ||||
| 0 0 5 0 0 0 0 0 8 | ||||
| 2 6 0 0 0 8 4 0 0 | ||||
| 8 0 0 0 0 2 0 0 0 | ||||
| 0 0 0 7 0 0 0 0 5 | ||||
| 0 0 0 3 0 0 0 0 6 | ||||
| 0 1 6 0 0 5 7 0 0 | ||||
| 
 | ||||
| 4 3 7 5 6 9 2 8 1 | ||||
| 5 8 1 2 7 3 6 9 4 | ||||
| 6 9 2 8 4 1 5 7 3 | ||||
| 1 4 5 6 9 7 3 2 8 | ||||
| 2 6 9 1 3 8 4 5 7 | ||||
| 8 7 3 4 5 2 1 6 9 | ||||
| 9 2 4 7 1 6 8 3 5 | ||||
| 7 5 8 3 2 4 9 1 6 | ||||
| 3 1 6 9 8 5 7 4 2 | ||||
| @ -67,9 +67,11 @@ function check(board) | ||||
|             local ok, r = checkCT(ct) | ||||
|             if not ok then | ||||
|                 for _, p in ipairs(r) do | ||||
|                     local x1 = ((p[1] - 1) // 3 + 1) + i * 3 | ||||
|                     -- local x1 = ((p[1] - 1) // 3 + 1) + i * 3 | ||||
|                     local x1 = math.floor((p[1] - 1) / 3 + 1) + i * 3 | ||||
|                     local y1 = ((p[1] - 1) % 3 + 1) + j * 3 | ||||
|                     local x2 = ((p[2] - 1) // 3 + 1) + i * 3 | ||||
|                     -- local x2 = ((p[2] - 1) // 3 + 1) + i * 3 | ||||
|                     local x2 = math.floor((p[2] - 1) / 3 + 1) + i * 3 | ||||
|                     local y2 = ((p[2] - 1) % 3 + 1) + j * 3 | ||||
|                     local t = {x1, y1, x2, y2, board[x1][y1]} | ||||
|                     if not findThisTable(t, rr) then | ||||
| @ -114,3 +116,17 @@ function pcheck(board) | ||||
|         print(S("(%d, %d) = (%d, %d) = %d", unpack(p))) | ||||
|     end | ||||
| end | ||||
| 
 | ||||
| function scheck(board) | ||||
|     local msg = {} | ||||
|     local ok, r = check(board) | ||||
|     if ok then | ||||
|         return {"No Error!"} | ||||
|     end | ||||
|     for _, p in ipairs(r) do | ||||
|         local s = string.format("(%d, %d) = (%d, %d) = %d", unpack(p)) | ||||
|         print(s) | ||||
|         table.insert(msg, s) | ||||
|     end | ||||
|     return msg | ||||
| end | ||||
|  | ||||
| @ -1,4 +1,5 @@ | ||||
| require "utils" | ||||
| require "sudoku.utils" | ||||
| require "sudoku.check" | ||||
| 
 | ||||
| function calValidOptions(b, x, y) | ||||
|     if b[x][y] ~= 0 then return {} end | ||||
| @ -15,8 +16,10 @@ function calValidOptions(b, x, y) | ||||
|             table.insert(u, elm) | ||||
|         end | ||||
|     end | ||||
|     local xc = ((x - 1) // 3) * 3 | ||||
|     local yc = ((y - 1) // 3) * 3 | ||||
|     -- local xc = ((x - 1) // 3) * 3 | ||||
|     -- local yc = ((y - 1) // 3) * 3 | ||||
|     local xc = math.floor((x - 1) / 3) * 3 | ||||
|     local yc = math.floor((y - 1) / 3) * 3 | ||||
|     for i = 1, 3 do | ||||
|         for j = 1, 3 do | ||||
|             elm = b[i+xc][j+yc] | ||||
|  | ||||
| @ -15,7 +15,7 @@ fonts.smallNum = love.graphics.newFont(24) | ||||
| fonts.info = love.graphics.newFont(24) | ||||
| 
 | ||||
| colors.smallNumbersDisabled = "EEEEEE" | ||||
| colors.smallNumbersEnabled = "00FF00" | ||||
| colors.smallNumbersEnabled = "FFA500" | ||||
| colors.bigNumbersOriginal = "000000" | ||||
| colors.bigNumbersPlayer = "0000FF" | ||||
| colors.cursorActiveSmall = "00FF00" | ||||
| @ -26,6 +26,6 @@ colors.messagesText = "000000" | ||||
| colors.boardThinLines = "808080" | ||||
| colors.boardThikLines = "000000" | ||||
| 
 | ||||
| cursor.editMode = false | ||||
| 
 | ||||
| board.fn = "boards/veryhard/01.txt" | ||||
| board.fn = "boards/easy/03.txt" | ||||
| board.fn = "boards/hard/03.txt" | ||||
|  | ||||
| @ -71,6 +71,8 @@ function drawCursor() | ||||
| end | ||||
| 
 | ||||
| function drawMessages() | ||||
|     setColor(colors.backGround) | ||||
|     love.graphics.rectangle("fill", 25, 150, grid.x1- 25 - 2, grid.y2 - grid.y1) | ||||
|     setColor(colors.messagesText) | ||||
|     love.graphics.setFont(fonts.info) | ||||
|     for i, msg in ipairs(messages) do | ||||
|  | ||||
| @ -81,4 +81,6 @@ function initUI() | ||||
|     initSmallNumbers() | ||||
|     initGrid() | ||||
|     cursor.x, cursor.y = findFirstEmptyCell() | ||||
|     cursor.editMode = false | ||||
|     cursor.lastEditMode = false | ||||
| end | ||||
|  | ||||
| @ -1,3 +1,6 @@ | ||||
| require "sudoku.sudoku" | ||||
| require "ui.logic" | ||||
| 
 | ||||
| local function iterBoardLine(start, step) | ||||
|     local step = step or 1 | ||||
|     local i = start | ||||
| @ -80,6 +83,14 @@ function love.keypressed(key, scancode) | ||||
|         handleDown(shift) | ||||
|     elseif key == "up" or key == "k" then | ||||
|         handleUp(shift) | ||||
|     elseif key == "s" then | ||||
|         displaySearchSpace() | ||||
|     elseif key == "c" then | ||||
|         checkBoard() | ||||
|     elseif key == "f2" then | ||||
|         saveCurrentBoard() | ||||
|     elseif key == "f3" then | ||||
|         loadLastBoard() | ||||
|     elseif uiBoard[1][cursor.y][cursor.x] == 0 then | ||||
|         local n = tonumber(key) or -1 | ||||
|         if n > 0 and n < 10 then | ||||
| @ -92,6 +103,7 @@ function love.keypressed(key, scancode) | ||||
|                 --     smallNumbersVal[cursor.x][cursor.y][i] = false | ||||
|                 -- end | ||||
|                 uiBoard[2][cursor.y][cursor.x] = n | ||||
|                 uiBoard[3][cursor.y][cursor.x] = n | ||||
|             end | ||||
|         elseif key == "delete" or key == "0" then | ||||
|             if uiBoard[2][cursor.y][cursor.x] ~= 0 then | ||||
|  | ||||
							
								
								
									
										42
									
								
								ui/logic.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								ui/logic.lua
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,42 @@ | ||||
| function displaySearchSpace() | ||||
|     local s = buildSearchSpace(uiBoard[2]) | ||||
|     for x = 1, 9 do | ||||
|         for y = 1, 9 do | ||||
|             for z = 1, 9 do | ||||
|                 smallNumbersVal[x][y][z] = false | ||||
|             end | ||||
|             for _, v in ipairs(s[y][x]) do | ||||
|                 smallNumbersVal[x][y][v] = true | ||||
|             end | ||||
|         end | ||||
|     end | ||||
|     messages = scheck(uiBoard[2]) | ||||
| end | ||||
| 
 | ||||
| function checkBoard() | ||||
|     messages = scheck(uiBoard[2]) | ||||
| end | ||||
| 
 | ||||
| function loadLastBoard() | ||||
|     board = {} | ||||
|     board[1], board[2] = loadBoard("lastBoard.txt") | ||||
|     uiBoard[1] = cloneBoard(board[1]) | ||||
|     uiBoard[2] = cloneBoard(board[2]) | ||||
|     uiBoard[3] = cloneBoard(board[2]) | ||||
|     messages[1] = 'loaded: "lastBoard.txt"' | ||||
| end | ||||
| 
 | ||||
| function saveCurrentBoard() | ||||
|     local f = io.open("lastBoard.txt", "w") | ||||
|     for row = 1, 9 do | ||||
|         f:write(table.concat(uiBoard[1][row], " ")) | ||||
|         f:write("\n") | ||||
|     end | ||||
|     f:write("\n") | ||||
|     for row = 1, 9 do | ||||
|         f:write(table.concat(uiBoard[2][row], " ")) | ||||
|         f:write("\n") | ||||
|     end | ||||
|     f:close() | ||||
|     messages[1] = 'saved: "lastBoard.txt"' | ||||
| end | ||||
							
								
								
									
										26
									
								
								ui/mouse.lua
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								ui/mouse.lua
									
									
									
									
									
								
							| @ -15,25 +15,23 @@ function love.mousepressed(x, y, button, istouch) | ||||
|         mx = math.floor((x - grid[cx][cy].x1) / dx) + 1 | ||||
|         my = math.floor((y - grid[cx][cy].y1) / dy) + 1 | ||||
|         n = mx + 3 * (my - 1) | ||||
|     end | ||||
|     if inBoard then | ||||
|         if uiBoard[1][cy][cx] == 0 then canChange = true end | ||||
|     end | ||||
|     if inBoard and canChange then | ||||
|     if canChange then | ||||
|         if button == 1 then | ||||
|             cursor.editMode = false | ||||
|             uiBoard[2][cursor.y][cursor.x] = uiBoard[3][cursor.y][cursor.x] | ||||
|             if cursor.x == cx and cursor.y == cy then | ||||
|                 smallNumbersVal[cx][cy][n] = not smallNumbersVal[cx][cy][n] | ||||
|             else | ||||
|             uiBoard[2][cy][cx] = uiBoard[3][cy][cx] | ||||
|             cursor.lastEditMode = false | ||||
|         elseif button == 2 then | ||||
|             cursor.editMode = true | ||||
|             uiBoard[3][cy][cx] = uiBoard[2][cy][cx] | ||||
|             uiBoard[2][cy][cx] = 0 | ||||
|             -- if cursor.x == cx and cursor.y == cy and cursor.lastEditMode then | ||||
|             --     smallNumbersVal[cx][cy][n] = not smallNumbersVal[cx][cy][n] | ||||
|             -- end | ||||
|             cursor.lastEditMode = true | ||||
|         end | ||||
|         cursor.x = cx | ||||
|         cursor.y = cy | ||||
|     end | ||||
|         elseif button == 2 then | ||||
|             cursor.editMode = true | ||||
|             uiBoard[3][cursor.y][cursor.x] = uiBoard[2][cursor.y][cursor.x] | ||||
|             uiBoard[2][cursor.y][cursor.x] = 0 | ||||
|             smallNumbersVal[cx][cy][n] = not smallNumbersVal[cx][cy][n] | ||||
|         end | ||||
|     end | ||||
| end | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user