Beispiel #1
0
def holdem():
    #display game banner
    Menu.start()
    input('\nPress any key to start.')
    #start
    os.system('clear')
    #set pot
    player_pots = [BUY_IN, BUY_IN]
    total_pot = 0
    while player_pots[0] > 0 or player_pots[1] > 0:
        Menu.start()
        #initalize deck
        deck = Deck()
        deck.shuffle()
        #set hold cards
        player_hand = deck.deal('player_hand')
        computer_hand = deck.deal('computer_hand')
        #set board cards
        flop = deck.deal('flop')
        turn = deck.deal('turn')
        river = deck.deal('river')
        graphics.game_board(player_pots, player_hand)
        option = input('\nEnter Option: ')
        if option == 1:
            pass
        elif option == 2:
            pass
        elif option == 3:
            break
Beispiel #2
0
    def __init__(self):
        socket.setdefaulttimeout(2)

        pygame.init()
        pygame.display.set_caption('Multiplayer Agar.io')

        self.screen = pygame.display.set_mode(
            (View.SCREEN_WIDTH, View.SCREEN_HEIGHT))

        connection = Connection(self.screen)
        self.menu = Menu(self.MENU_WIDTH, self.MENU_HEIGHT)
        # set callback
        self.menu.update_start_menu(connection.connect_to_game)
        self.clock = pygame.time.Clock()
Beispiel #3
0
 def __init__(self):
     themed_tk.ThemedTk.__init__(self)
     style.theme.apply(self)
     self.nav = Nav(self)
     self.horizontal_panel = ttk.PanedWindow(self, orient="horizontal")
     self.vertical_panel = ttk.PanedWindow(self, orient="vertical")
     self.top_view = Notebook(self, labels=False)
     self.bottom_view = Notebook(self, labels=False)
     self.treenotebook = Notebook(self, **style.theme.treenotebook)
     self.projecttree = ProjectTree(self)
     self.objecttree = ObjectTree(self)
     self.editor = Editor(self)
     self.console = Console(self)
     self.docviewer = DocViewer(self)
     self.output = Output(self)
     self.workspace = WorkSpace(self)
     self.menu = Menu(self)
     self.modules = ObjectContainer(getitem=self.getmodule,
                                    setitem=self.projecttree.addmodule)
     self.objects = ObjectContainer(setitem=self.on_set_object,
                                    delitem=self.on_delete_object)
     self.selected = None
     self.treenotebook.add("Project", self.projecttree,
                           **style.theme.treenotebook_tab)
     self.treenotebook.add("Objects", self.objecttree,
                           **style.theme.treenotebook_tab)
     self.horizontal_panel.add(self.treenotebook)
     self.horizontal_panel.add(self.vertical_panel)
     self.vertical_panel.add(self.top_view)
     self.vertical_panel.add(self.bottom_view)
     self.savedata = SaveData(self)
     self.savedata.load(firstload=True)
     self.nav.pack(side="left", fill="both")
     self.horizontal_panel.pack(side="left", fill="both", expand=True)
Beispiel #4
0
 def _music_sites(self):
     " List, Remove, Update music sites "
     if len(self.config["local_music"].get_dir_list()) < 1:
         Message.err("You must have at least one local dir to move music.")
         return False
     while True:
         action, index = Menu.display_sites(self.config["sites"])
         if action == "q":
             return
         if action == "n":
             code, data = Input.site_data()
             if not code:
                 continue
             site = RemoteSite(data["name"], data["username"], data["hostname"], data["port"])
             self.config["sites"].append(site)
             continue
             # existing site actions
         if index < 1:
             Message.err("You must specify a site to perform the action on.")
             continue
         index -= 1
         remote_site = self.config["sites"][index]
         if action == "d":
             if Input.confirm_delete():
                 self.config["sites"].pop(index)
         elif action == "l":
             self._remote_dirs(remote_site)
         elif action == "b":
             self._remote_blocks(remote_site)
         elif action == "m":
             if len(remote_site.get_dir_list()) < 1:
                 Message.err("Remote sites must have at least 1 dir to move music.")
                 continue
             self._move_music(remote_site)
Beispiel #5
0
class Client:
    BACKGROUND_COLOR = (40, 0, 40)
    MENU_WIDTH = View.SCREEN_WIDTH * 0.9
    MENU_HEIGHT = View.SCREEN_HEIGHT * 0.9

    def __init__(self):
        socket.setdefaulttimeout(2)

        pygame.init()
        pygame.display.set_caption('Multiplayer Agar.io')

        self.screen = pygame.display.set_mode(
            (View.SCREEN_WIDTH, View.SCREEN_HEIGHT))

        connection = Connection(self.screen)
        self.menu = Menu(self.MENU_WIDTH, self.MENU_HEIGHT)
        # set callback
        self.menu.update_start_menu(connection.connect_to_game)
        self.clock = pygame.time.Clock()

    def run(self):
        while True:
            events = pygame.event.get()
            for event in events:
                if event.type == pygame.QUIT:
                    exit()

            self.screen.fill(self.BACKGROUND_COLOR)

            if self.menu.get_main_menu().is_enabled():
                self.menu.get_main_menu().draw(self.screen)
            self.menu.get_main_menu().update(events)
            pygame.display.flip()
            self.clock.tick(30)
Beispiel #6
0
 def _remote_blocks(self, remote_site):
     " Display and remote album blocks from a remote site "
     while True:
         action, index = Menu.display_blocks(remote_site.blocked_album_list)
         index -= 1
         if action == "q":
             return
         if action == "d":
             remote_site.blocked_album_list.pop(index)
Beispiel #7
0
 def run(self):
     " Run the program "
     while True:
         opt = Menu.main()
         if opt == 1:
             self._music_sites()
         elif opt == 2:
             # update local directories
             self._update_local()
         else:
             self.cleanup()
             return
Beispiel #8
0
 def _remote_dirs(self, remote_site):
     " List remote directories, and delete "
     while True:
         action, index = Menu.display_remote_list(remote_site.get_dir_list())
         if action == "q":
             return
         if action == "d":
             if Input.confirm_delete():
                 remote_site.del_dir(index - 1)
             continue
         if action == "a":
             dir = Input.prompt_add_remote_dir()
             remote_site.add_dir(dir)
Beispiel #9
0
 def create_views(cls):
     """Create Views, collect them in dictionary 'views'."""
     for option in cls.init_options_data:
         cls.views[option] = MenuOption(option,
                                        cls.init_options_data[option])
     for option in cls.main_options_data:
         cls.views[option] = MenuOption(option,
                                        cls.main_options_data[option])
     for option in cls.other_options_data:
         cls.views[option] = Other(option, cls.other_options_data[option])
     for menu in cls.menu_data:
         cls.views[menu] = Menu(menu,
                                choices=cls.menu_data[menu][0],
                                special_choices=cls.menu_data[menu][1],
                                is_main=cls.menu_data[menu][2])
Beispiel #10
0
 def _update_local(self):
     " Update local directories. "
     while True:
         action, index = Menu.display_list(
             self.config["local_music"].get_dir_list(), self.config["local_music"]._active_save_dir + 1
         )
         if action == "s":
             self.config["local_music"].set_save_dir(index - 1)
         elif action == "d":
             if Input.confirm_delete():
                 self.config["local_music"].del_dir(index - 1)
         elif action == "a":
             dir = Input.prompt_add_dir()
             if dir:
                 self.config["local_music"].add_dir(dir)
         else:
             return
Beispiel #11
0
import sys

screen = Core.initializeFrame("BEER COUNTER")
window = Core.initializeMainWindow()
curses.doupdate()

if len(sys.argv) == 2:
    game = Storage.load(str(sys.argv[1]))
    game, key = RunningGame.init(window, game)
else:
    game = None
    key = Constants.MENU

while True:
    if key == Constants.MENU:
        key = Menu.init(window)
    elif key == Constants.NEW_GAME:
        game = NewGame.init(window)
    elif key == Constants.RESUME_GAME:
        game, key = ResumeGame.init(window)
    else:
        key = window.getch()

    if game is not None:
        game, key = RunningGame.init(window, game)

    if Core.checkFinish(key):
        break

Core.resetTerminal()
Beispiel #12
0
from os import system
from view import Menu
from database import DataBase

DataBase.getInstance().loadDataBase()
while True:
    Menu.getInstance().out()
    command = Menu.getInstance().getCommand()
    getattr(command["controller"].getInstance(), command["action"])()
    # system('cls')