I'm making a game that uses a board of 4x4 and I want to check whether a card have already been pressed or not.
For that, I am using two boards. One that will be used for calculations (The variable I want to copy) and the other one that will be used for display in the game (Original board called status).
I have the following piece of code and I want to copy the status variable of TreasureHuntGrid and use it in another function of the same class. It should be independent from the variable it is being copied, so a change in the status variable won't affect the calculations variable.
I think the code I have here handles the status and calculations variable as it is the same.
How can I treat them both independently?
class TreasureHuntGrid(GridLayout):
Finish.shuffle()
status = ListProperty(Finish.board) #Return a random lists of lists with 1 and -1
calculations = status
def __init__(self, *args, **kwargs):
super(TreasureHuntGrid, self).__init__(*args, **kwargs)
def button_pressed(self, button):
if self.calculations[row][column] != 2: #Check if it is pressed or not
button.text = {-1: Finish.surrounded(row, column), 1: 'X'}[self.sta$
button.background_color = colours[self.status[row][column]]
self.calculations[row][column] = 2