コード例 #1
0
ファイル: config_test.py プロジェクト: ishikota/pypoker
 def test_read(self):
     name_len = len("config_test.py")
     if __file__[-1] == 'c': # if __file__ is config.pyc
         name_len += 1
     path_to_file = __file__[:-name_len]
     C = Config()
     C.read(path_to_file+"config.txt")
     eq_(10, C.getRoundNum())
     eq_(5, C.getSBChip())
     players = C.getPlayers()
     name_ans = ["base1 san", "human2 san"]
     class_ans = [BasePlayer, Human]
     for i in range(C.getPlayerNum()):
         player = players[i]
         eq_(name_ans[i], player.getName())
         eq_(200, player.getStack())
         ok_(isinstance(player, class_ans[i]))
         ok_(not C.getIfAuto())
コード例 #2
0
ファイル: main.py プロジェクト: ishikota/pypoker
    If you put this root project to /Users/YourName/poker 
    then run below two command on your terminal.

    PYTHONPATH=/Users/YourName/poker:$PYTHONPATH
    export PYTHONPATH

"""
import sys, os, subprocess
import user_interface
from engine.ui.table import Table
from engine.ui.config import Config

# Display logo
subprocess.call('clear')
user_interface.logo()

# read game config
C = Config()
path_to_config = os.path.abspath(__file__)[:-len("main.py")]
C.read(path_to_config+"config.txt")

# set up the game
p = C.getPlayers()
t = Table()
t.setup(p, C.getSBChip())
t.AUTO = C.getIfAuto()

# start the game !!
t.start_game(C.getRoundNum())