I'm trying to brute force all the possible solution of the minesweeper game for my homework but I don't know how to pass the characters in the string inside of the list to the list of lists.
[['1', '0'], ['1', '0']]
[[' ', ' '], [' ', ' ']]
['0000', '0001', '0010', '0011', '0100', '0101', '0110', '0111', '1000', '1001', '1010', '1011', '1100', '1101', '1110', '1111']
The first one is my aim solution board, the second one is my empty board, the third one is my binary list. I want to pass all of the numbers to the empty board and if it is not equal to the aim board I have to pass the next binary number
try something like this. change the names of the variables if you wish. I just did a quick code. Please mark this as accepted answer if it works for you.
x=['0000', '0001', '0010', '0011', '0100', '0101', '0110', '0111', '1000', '1001', '1010', '1011', '1100', '1101', '1110', '1111']
# pick one item at a time
for item in x:
finList = []
l1 = []
l2 = []
count = 1
# get individual digits from the string, like from '0001' you will get 0 then 0 then 0 then 1
for digit in item:
if count<=2:
l1.append(digit)
count += 1
else:
l2.append(digit)
finList.append(l1)
finList.append(l2)
print(finList)