SHARE
TWEET

Untitled

a guest Oct 21st, 2019 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from random import randint
  2. import time
  3.  
  4.  
  5. class State:
  6.  
  7.     def __init__(self, b, nm1, nc1, bp, nm2, nc2):
  8.         self.b = b
  9.         self.nm1 = nm1
  10.         self.nc1 = nc1
  11.         self.bp = bp
  12.         self.nm2 = nm2
  13.         self.nc2 = nc2
  14.  
  15.     def __eq__(self, other):
  16.         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):
  17.             return True
  18.         return False
  19.  
  20.     def __hash__(self):
  21.         return (self.nm1 * self.nc1) - (self.nm2 * self.nc2)
  22.  
  23.     def __str__(self):
  24.         return "nm1: " + str(self.nm1) + "\nnc1: " + str(self.nc1) + "\nnm2: " + str(self.nm2) + "\nnc2: " + str(self.nc2)
  25.  
  26.  
  27. def initialState(nm, nc, b):
  28.     return State(b, nm, nc, 1, 0, 0)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top