Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- import time
- class State:
- def __init__(self, b, nm1, nc1, bp, nm2, nc2):
- self.b = b
- self.nm1 = nm1
- self.nc1 = nc1
- self.bp = bp
- self.nm2 = nm2
- self.nc2 = nc2
- def __eq__(self, other):
- if (self.b == other.b and self.nm1 == other.nm1 and self.nc1 == other.nc1 and self.bp == other.bp and self.nm2 == other.nm2 and self.nc2 == other.nc2):
- return True
- return False
- def __hash__(self):
- return (self.nm1 * self.nc1) - (self.nm2 * self.nc2)
- def __str__(self):
- return "nm1: " + str(self.nm1) + "\nnc1: " + str(self.nc1) + "\nnm2: " + str(self.nm2) + "\nnc2: " + str(self.nc2)
- def initialState(nm, nc, b):
- return State(b, nm, nc, 1, 0, 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement