This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
SIZE = 4 | |
import sys | |
import dbhash | |
import random | |
from time import time | |
from multiprocessing import Process, Queue | |
from term2048.game import Game |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class maybe(object): | |
def __init__(self, original): | |
self.original = original | |
def __getattr__(self, attr): | |
if hasattr(self.original, attr): | |
return maybe(getattr(self.original, attr)) | |
return maybe(None) | |
def __call__(self): | |
return self.original |