Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Le <vincent@ShadowPhoenix.(none)>2009-12-03 01:26:35 (GMT)
committer Vincent Le <vincent@ShadowPhoenix.(none)>2009-12-03 01:26:35 (GMT)
commitca7608cd92670ca59741796fe7c4977c0333544d (patch)
treede21ffe5f7369c55b97e3c52fd7a757ae8049278
parentad373d892efce251b9e99de2a46761487701715f (diff)
find_a_match new method commented, but index in card.py needs to be fixed first
-rw-r--r--window.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/window.py b/window.py
index 9056f65..e4fe941 100644
--- a/window.py
+++ b/window.py
@@ -235,6 +235,35 @@ def find_a_match(tw):
return True
return False
+"""
+def find_a_match(tw, size):
+ a = range(0, size)
+ cardarray = [tw.deck.grid[a[size-1]]]
+ for x in a:
+ indices.append(tw.deck.grid[x].index)
+ for i in range(0, size-1):
+ for j in find_third_card([tw.deck.grid[a[size-1]], tw.deck.grid[i]]):
+ if indices.count(j) > 0: return true
+ find_a_match(tw, size-1)
+ return false
+
+
+#
+# Given two cards, finds possibilities for third card
+#
+def find_third_card(cardarray):
+ cardindex = ((-cardarray[0].shape - cardarray[1].shape)%3)*4*3*3 \
+ +((-cardarray[0].num - cardarray[1].num)%3)*3 \
+ +((-cardarray[0].fill - cardarray[1].fill)
+ if cardarray[0].color == cardarray[1].color:
+ return [(cardindex + cardarray[0].color*3*3)]
+ else:
+ colors = [0, 1, 2, 3]
+ colors.remove(cardarray[0].color)
+ colors.remove(cardarray[1].color)
+ return [(cardindex + colors[0]*3*3, cardindex + colors[1]*3*3]
+"""
+
#
# Check whether three cards are a match based on the criteria that
# in all characteristics: