|
@@ -31,9 +31,9 @@ memory_Context memory_selectItem( |
|
|
if ( |
|
|
if ( |
|
|
c.selectedItems.size() == 2 |
|
|
c.selectedItems.size() == 2 |
|
|
) { |
|
|
) { |
|
|
c.selectedItems = []; |
|
|
|
|
|
|
|
|
c.selectedItems.clear(); |
|
|
} |
|
|
} |
|
|
c.selectedItems.append(c.selectedId); |
|
|
|
|
|
|
|
|
c.selectedItems.push_back(c.selectedId); |
|
|
c.recentField = "selectedItems"; |
|
|
c.recentField = "selectedItems"; |
|
|
return c; |
|
|
return c; |
|
|
} |
|
|
} |
|
@@ -62,7 +62,7 @@ memory_Context memory_shouldDeselectMismatchedItems( |
|
|
c.selectedItems[0] == c.selectedItems[1] |
|
|
c.selectedItems[0] == c.selectedItems[1] |
|
|
) { |
|
|
) { |
|
|
c.mismatchedItems.clear(); |
|
|
c.mismatchedItems.clear(); |
|
|
c.mismatchedItems.append(c.selectedItems[0]); |
|
|
|
|
|
|
|
|
c.mismatchedItems.push_back(c.selectedItems[0]); |
|
|
c.recentField = "mismatchedItems"; |
|
|
c.recentField = "mismatchedItems"; |
|
|
return c; |
|
|
return c; |
|
|
} |
|
|
} |
|
@@ -70,8 +70,8 @@ memory_Context memory_shouldDeselectMismatchedItems( |
|
|
c.playfieldItems[c.selectedItems[0]] != c.playfieldItems[c.selectedItems[1]] |
|
|
c.playfieldItems[c.selectedItems[0]] != c.playfieldItems[c.selectedItems[1]] |
|
|
) { |
|
|
) { |
|
|
c.mismatchedItems.clear(); |
|
|
c.mismatchedItems.clear(); |
|
|
c.mismatchedItems.append(c.selectedItems[0]); |
|
|
|
|
|
c.mismatchedItems.append(c.selectedItems[1]); |
|
|
|
|
|
|
|
|
c.mismatchedItems.push_back(c.selectedItems[0]); |
|
|
|
|
|
c.mismatchedItems.push_back(c.selectedItems[1]); |
|
|
c.recentField = "mismatchedItems"; |
|
|
c.recentField = "mismatchedItems"; |
|
|
return c; |
|
|
return c; |
|
|
} |
|
|
} |
|
@@ -88,9 +88,9 @@ memory_Context memory_shouldDetectVictory( |
|
|
) { |
|
|
) { |
|
|
if ( |
|
|
if ( |
|
|
c.recentField == "hiddenItems" && |
|
|
c.recentField == "hiddenItems" && |
|
|
c.hiddenItems.size() == len(c.playfieldItems) |
|
|
|
|
|
|
|
|
c.hiddenItems.size() == c.playfieldItems.size() |
|
|
) { |
|
|
) { |
|
|
c.victory = True; |
|
|
|
|
|
|
|
|
c.victory = true; |
|
|
c.recentField = "victory"; |
|
|
c.recentField = "victory"; |
|
|
return c; |
|
|
return c; |
|
|
} |
|
|
} |
|
@@ -110,8 +110,8 @@ memory_Context memory_shouldHideMatchingItems( |
|
|
c.selectedItems.size() == 2 && |
|
|
c.selectedItems.size() == 2 && |
|
|
c.playfieldItems[c.selectedItems[0]] == c.playfieldItems[c.selectedItems[1]] |
|
|
c.playfieldItems[c.selectedItems[0]] == c.playfieldItems[c.selectedItems[1]] |
|
|
) { |
|
|
) { |
|
|
c.hiddenItems.append(c.selectedItems[0]); |
|
|
|
|
|
c.hiddenItems.append(c.selectedItems[1]); |
|
|
|
|
|
|
|
|
c.hiddenItems.push_back(c.selectedItems[0]); |
|
|
|
|
|
c.hiddenItems.push_back(c.selectedItems[1]); |
|
|
c.recentField = "hiddenItems"; |
|
|
c.recentField = "hiddenItems"; |
|
|
return c; |
|
|
return c; |
|
|
} |
|
|
} |
|
|