Post by B+ on Sept 28, 2018 14:38:50 GMT
Here is the Game to bluatigro's 01 Puzzle.
While he tries to get his SOLVER to work, you can play the game yourself here and now!
Thanks to B+ ;-))
Hint: the first most obvious change is to get rid of the 3 ones probably by changing one of the 1's to a 0.
So here is the million dollar question, what is the least amount of turns needed to solve this baby?
I don't know but I will bet real money it can be determined from the row and column sums.
While he tries to get his SOLVER to work, you can play the game yourself here and now!
Thanks to B+ ;-))
'bluatigro 01 Puzzle 2018-09-28 B+ attempt
'This is solved when an equal amout of 0's and 1' are in each row and col
'AND there are no more than 2 0's or 1's in each row or col.
'I think it might be also assumed that at least a 0, 1 pair exist in each row and column.
'puzzle data
data "1.0....."
data ".....0.."
data "....1..1"
data ".11....."
data "0......."
data "....0..1"
data "..00...1"
data ".1....1."
'read in puzzle to numeric array
dim p(8, 8)
for row = 1 to 8
read dLine$
for col = 1 to 8
select case mid$(dLine$, col, 1)
case "1" : p(col, row) = 1
case "0" : p(col, row) = -1
case "." : p(col, row) = 0
end select
next
next
global SOLVED
while 1
call drawP
if SOLVED = 16 then
print "Congratulations!!! You solved the puzzle."
end
else
print
print "To quit: Enter other than 1 to 8 for row,"
print " enter other than 1 to 8 for col,"
print " or enter other than -1, 0, 1 for array."
print
input " Enter a row to change > "; dr
dr = int(dr)
if dr < 1 or dr > 8 then end
input "Enter a column to change > "; dc
dc = int(dc)
if dc < 1 or dc > 8 then end
input "Enter 0 for a dot, -1 for a zero, or enter 1 for a 1 > "; dn
dn = int(dn)
if dn < -1 or dn > 1 then end
p(dc, dr) = dn
end if
wend
sub drawP
SOLVED = 0
print
for row = 1 to 8
for col = 1 to 8
select case p(col, row)
case 0 : print " . ";
case 1 : print " 1 ";
case -1: print " 0 ";
end select
next
print " Row ";row;" = ";sumRow(row)
if sumRow(row) = 0 then SOLVED = SOLVED + 1
next
print
for i = 1 to 8
print "C";i;" ";
next
print
for i = 1 to 8
print right$(" ";sumCol(i);" ", 3);
if sumCol(i) = 0 then SOLVED = SOLVED + 1
next
print:print
print "There are ";16 - SOLVED;" rows and columns remaining unsolved."
end sub
function sumRow(row)
for i = 1 to 8
sumRow = sumRow + p(i, row)
next
end function
function sumCol(col)
for i = 1 to 8
sumCol = sumCol + p(col, i)
next
end function
Hint: the first most obvious change is to get rid of the 3 ones probably by changing one of the 1's to a 0.
So here is the million dollar question, what is the least amount of turns needed to solve this baby?
I don't know but I will bet real money it can be determined from the row and column sums.