ya2 · news · projects · code · about

fail condition
[pmachines.git] / pmachines / items / domino.py
index c50cb5d645c0f71eb033fe40ee306b25a5b57286..d43e73c68164345cc25094ac108347d9af37a032 100644 (file)
@@ -18,8 +18,8 @@ class UpStrategy(StillStrategy):
         self._tgt_degrees = tgt_degrees
         self._np = np
 
-    def end_condition(self):
-        return super().end_condition() and abs(self._np.get_r()) <= self._tgt_degrees
+    def win_condition(self):
+        return super().win_condition() and abs(self._np.get_r()) <= self._tgt_degrees
 
 
 class DownStrategy(StillStrategy):
@@ -29,5 +29,5 @@ class DownStrategy(StillStrategy):
         self._tgt_degrees = tgt_degrees
         self._np = np
 
-    def end_condition(self):
-        return super().end_condition() and abs(self._np.get_r()) >= self._tgt_degrees
+    def win_condition(self):
+        return self._np.get_z() < -10 or super().win_condition() and abs(self._np.get_r()) >= self._tgt_degrees