if t < 10:
                centerer.hits += 1
            total_time += t
        centerer.raw_fitness = total_time


def add(a,b): return a+b
add.__name__ = '+'
def sub(a,b): return a-b
sub.__name__ = '-'
def mul(a,b): return a*b
mul.__name__ = '*'
def div(a,b):
    if b == 0:
        return 1
    else:
        return a/b
div.__name__ = '%'
def gt(a,b): 
    return int(a<b)*2-1
def ABS(a): # cannot use abs because getargspec is weird with built-in functions
    return abs(a)

if __name__ == '__main__':
    hal(CartController)
    """
    cc = CartController()
    cc.test_all_generations()
    cc.display_fitness_curves()
    """
        for case in self.fitness_cases:
            if individual.run( *map(int,case) ) == target_function(*case):
                individual.raw_fitness += 1


def AND(a,b):
    return a and b
def OR(a,b):
    return a or b
def NOT(a):
    return not a
def IF(a,b,c):
    if a:
        return b
    else:
        return c

def target_function(*args):
    S = int(''.join(args[:3]), 2)
    bits = args[3:]
    return int(bits[S])

if __name__ == '__main__':
    """
    print 'will run without run-time-errors but has bugs'
    mc = MultiplexerController()
    mc.test_all_generations()
    mc.display_fitness_curves()
    """
    hal(MultiplexerController)