Exemplo n.º 1
0
from human import Human
h1 = Human("Deval", 5.5, 50)
print(f"Name is {h1.name} \nHeight is {h1.height} \nweight is {h1.weight}")
h1.play()
print(h1.__str__)
print(h1)
h2 = Human("Deval", 7.5, 49)
h3 = Human("Deval", 7.5, 49)
h4 = Human("Deval", 7.5, 49)
print(id(h1))
print(id(h2))
print(h1 == h2)
print(Human.getHeadCount())
Exemplo n.º 2
0
Arquivo: main.py Projeto: ericyd/2048
import sys
sys.path.append('./lib')

from human import Human
from bot import Bot
import operator

player_type = input("are you human? (y/n): ")
if player_type.strip() == 'y':
    player = Human()
    (highest_tile, score) = player.play()
else:
    player = Bot(
        'quiet')  # pass 'verbose' to print detailed info after each move

    # get number of games to play
    number_of_games = input(
        "how many games would you like to play? (default: 100) ")
    try:
        int(number_of_games)
    except:
        number_of_games = 100

    # get strategy to play with
    strategy = input(
        "what strategy would you like to use? (enter a number)\n{} \n".format(
            player.list_strategies()))
    strategy = player.set_strategy(strategy)

    # play number of games with desired strategy
    print("playing {} games with '{}' strategy".format(number_of_games,