Exemple #1
0
    async def rating(self, ctx, platform: Platform, *, username):
        """Returns player ranks.

        `<platform>` - The platform of the player to get ranks for.
        `<username>` - The username of the player to get ranks for.

        Platforms
        - pc (bnet)
        - playstation (ps, psn, play)
        - xbox (xbl)
        - nintendo-switch (nsw, switch)

        Username formatting
        - pc: BattleTag (format: name#0000)
        - playstation: Online ID
        - xbox: Gamertag
        - nintendo-switch: Nintendo Switch ID (format: name-code)

        BattleTag example: Timmy#22340
        Nintendo Switch ID example: name-7alf327e36d5d1d8f507e765u5a2ech7
        """
        try:
            message = await ctx.send(embed=self.bot.loading_embed())
            data = await Request(platform=platform, username=username).get()
        except RequestError as e:
            await self.bot.cleanup(message)
            return await ctx.send(e)

        profile = Player(data, platform=platform, username=username)
        if profile.is_private:
            embed = profile.private()
        else:
            embed = await profile.get_ratings(ctx)
        await message.edit(embed=embed)
    def _get_players(self):
        players = []
        for P in self.replaydata['blue']['players']:
            kwargs = {
                "team": "blue",
                "name": P.get('name', None),
                "steam": P['id']['id'] if P['id']['platform'] == 'steam' else None,
                "game": self,
                "score": P['stats']['core']['score'],
                "goals": P['stats']['core']['goals'],
                "saves": P['stats']['core']['saves'],
                "camera": P.get('camera'),
                "rank": P.get('rank'),
                "platform": P['id']['platform']
            }
            p = Player(**kwargs)
            players.append(p)


        for P in self.replaydata['orange']['players']:
            kwargs = {
                "team": "orange",
                "name": P.get('name', None),
                "steam": P['id']['id'] if P['id']['platform'] == 'steam' else None,
                "game": self,
                "score": P['stats']['core']['score'],
                "goals": P['stats']['core']['goals'],
                "saves": P['stats']['core']['saves'],
                "camera": P.get('camera', None)
            }
            p = Player(**kwargs)
            players.append(p)
        return players
Exemple #3
0
    async def hero(
        self,
        ctx,
        hero: Hero,
        platform: Platform,
        *,
        username,
    ):
        """Returns player both quick play and competitive statistics for a given hero.

        `<hero>` - The name of the hero you want to see stats for.
        `<platform>` - The platform of the player to get stats for.
        `<username>` - The username of the player to get stats for.

        Platforms
        - pc (bnet)
        - playstation (ps, psn, play)
        - xbox (xbl)
        - nintendo-switch (nsw, switch)

        Username formatting
        - pc: BattleTag (format: name#0000)
        - playstation: Online ID
        - xbox: Gamertag
        - nintendo-switch: Nintendo Switch ID (format: name-code)

        BattleTag example: Timmy#22340
        Nintendo Switch ID example: name-7alf327e36d5d1d8f507e765u5a2ech7
        """
        try:
            message = await ctx.send(embed=self.bot.loading_embed())
            data = await Request(platform=platform, username=username).get()
        except RequestError as e:
            await self.bot.cleanup(message)
            return await ctx.send(e)

        profile = Player(data, platform=platform, username=username)
        if profile.is_private:
            embed = profile.private()
        else:
            try:
                embed = profile.get_hero(ctx, hero)
            except PlayerException as e:
                await self.bot.cleanup(message)
                return await ctx.send(e)

        await self.bot.cleanup(message)
        await self.bot.paginator.Paginator(pages=embed).start(ctx)
 def __init__(self, players: list):
     self.players = list()
     for name in players:
         self.players.append(Player(name))  #add name in self.players list
     self.turn_count = 0
     self.active_cards = list()
     self.history_cards = list()
Exemple #5
0
    def get_player(self, ctx):
        try:
            player = self.players[ctx.guild.id]

        except KeyError:
            player = Player(ctx)
            self.players[ctx.guild.id] = player

        return player
Exemple #6
0
    def start_game(self):

        print("Are you ready The game will start " )
        number_of_players = int(input("How many wants to play "))
        number_cards4eachp = 52 // number_of_players

        for i in range(1, number_of_players + 1):
            player_name = input("Please enter the name of player " + str(i) )
            pname = Player(player_name)
            Deck.distribute(pname, number_cards4eachp, )
Exemple #7
0
    async def hero(
        self, ctx, hero: Hero, index: Index = None, member: discord.Member = None
    ):
        """Shows a member's Overwatch both quick play and competitive statistics for a given hero.

        `<hero>` - The name of the hero you want to see stats for.
        `[index]` - The profile's index you want to see the ranks for.
        `[member]` - The mention or the ID of a Discord member of the current server.

        If no index is given then the profile used will be the main one.
        If no member is given then the statistics returned will be yours.

        If you want to see a member's stats, you must enter both the index and the member.
        """
        async with ctx.typing():
            member = member or ctx.author

            try:
                _, platform, username = await self.get_profile(member, index=index)
            except MemberHasNoProfile as e:
                return await ctx.send(e)
            except IndexError:
                return await ctx.send(
                    f'Invalid index. Use "{ctx.prefix}help profile hero" for more info.'
                )

            try:
                data = await Request(platform=platform, username=username).get()
            except RequestError as e:
                return await ctx.send(e)

            profile = Player(data, platform=platform, username=username)
            if profile.is_private:
                embed = profile.private()
            else:
                try:
                    embed = profile.get_hero(ctx, hero)
                except NoHeroStatistics as e:
                    return await ctx.send(e)
            await self.bot.paginator.Paginator(pages=embed).start(ctx)
Exemple #8
0
    async def rating(self, ctx, index: Index = None, member: discord.Member = None):
        """Shows a member's Overwatch ranks.

        `[index]` - The profile's index you want to see the ranks for.
        `[member]` - The mention or the ID of a Discord member of the current server.

        If no index is given then the profile used will be the main one.
        If no member is given then the ranks returned will be yours.

        If you want to see a member's stats, you must enter both the index and the member.
        """
        async with ctx.typing():
            member = member or ctx.author

            try:
                id, platform, username = await self.get_profile(member, index=index)
            except MemberHasNoProfile as e:
                return await ctx.send(e)
            except IndexError:
                return await ctx.send(
                    f'Invalid index. Use "{ctx.prefix}help profile rating" for more info.'
                )

            try:
                data = await Request(platform=platform, username=username).get()
            except RequestError as e:
                return await ctx.send(e)

            profile = Player(data, platform=platform, username=username)
            if profile.is_private:
                embed = profile.private()
            else:
                embed = await profile.get_ratings(ctx, save=True, profile_id=id)
                # if the index is None that means it's the main profile
                if not index and member.id == ctx.author.id:
                    await self.update_nickname_sr(ctx.author, profile=profile)
            await self.bot.paginator.Paginator(pages=embed).start(ctx)
def main(config, modelParam):
    if config['network'] == 'CartPole_v1_image':
        env = EnvironmentWrapper_image(modelParam)
    else:
        env = EnvironmentWrapper(modelParam)

    # create an instance of the model you want
    model = Model(config, modelParam, env)

    # create an instacne of the saver and resoterer class
    saveRestorer = SaverRestorer(config, modelParam)
    model        = saveRestorer.restore(model)

    # here you train your model
    if modelParam['play'] == False:
        trainer = Trainer(model, modelParam, config, saveRestorer, env)
        trainer.train()

    #play
    if modelParam['play'] == True:
        player = Player(model, modelParam, config, saveRestorer, env)
        player.play_episode()

    return
Exemple #10
0
def login():
    id = request.values['_id']
    if id.startswith('16DRL_'):
        if id not in PLAYER_DB['player']:
            abort(404)
    else:
        # Init Map
        map = Map(13)
        player = Player(id)
        map.reset(player)
        showMap = map.show_map(player)
        level = map.show_total_map(player)

        # Save Map
        save(player, map)
        id = player.hashID
    return redirect("/map/" + id, code=303)
Exemple #11
0
    def start_game(self) -> None:
        """
        Start the game,
        Fill a Deck,
        Distribute the cards of the Deck to the players.
        Make each Player play() a Card , where each player should only play 1 card per turn, and all players have to play at each turn until they have no cards left.
        At the end of each turn, print:
        The turn count.
        The list of active cards.
        The number of cards in the history_cards.
        """
        # Start board & player setup
        name = " "
        names = []
        while name or len(names) < 2:
            name = input("Write player name (ENTER when done): ")
            if name and name not in names:
                names.append(name)
                self.players.append(Player(name))
        # Shuffle players
        shuffle(self.players)
        deck = Deck()
        deck.fill_deck()
        deck.shuffle()
        self.players = deck.distribute(self.players)

        # Start game loop
        nb_cards_in_hands = 52
        while nb_cards_in_hands > 0:
            print(nb_cards_in_hands)
            nb_cards_in_hands = 0
            for player in self.players:
                # If one turn has passed (cards in self.active_cards), put old cards to graveyard
                if self.turn_count > 0:
                    self.history_cards.append(self.active_cards.pop(0))
                # Check if user has still cards left. If true, play one
                if player.number_of_cards > 0:
                    self.active_cards.append(player.play())
                nb_cards_in_hands += player.number_of_cards
            self.turn_count += 1
            active_cards_str = [card.__str__() for card in self.active_cards]
            print(f"Turn: {self.turn_count}\n\
Cards on board: {active_cards_str}\n\
Graveyard: {len(self.history_cards)}")
Exemple #12
0
    def __init__(self):
        self.version = 1.27
        self.uptime = datetime.now()

        # free disk space
        self.disk = Player.free_space()

        # initialise database
        self.db = SQLite(options.db)

        # initialise alerts
        self.alerts = Alert()

        # initialise playlist
        sql = 'SELECT id, artist, title, length, enabled FROM songs WHERE processed = 1 ORDER BY RANDOM()'
        self.playlist = Playlist((x.id, x.artist, x.title, x.length, x.enabled) for x in self.db.query(sql))

        # initialise player
        self.player = Player(self.playlist)

        # initialise WSO
        self.wso = WSO(self.player)

        # initialise application
        super(Application, self).__init__(
            [
                (r'/', MainHandler),
                (r'/login', LoginHandler),
                (r'/logout', LogoutHandler),
                (r'/upload', UploadHandler),
                (r'/songs/(\d+)', SongHandler),
                (r'/users(?:/([^/]+))?', UserHandler),
                (r'/list', ListHandler),
                (r'/wso', WSOHandler),
            ],
            login_url='/login',
            cookie_secret='xWP6dkmS489K14Uaj16w416P8Y7b2L474807tjwJ',
            template_path=os.path.join(os.path.dirname(__file__), 'templates'),
            static_path=os.path.join(os.path.dirname(__file__), 'static'),
            debug=options.debug,
            xsrf_cookies=True,
            gzip=True,
        )
Exemple #13
0
    async def nickname(self, ctx):
        """Update your server nickname and set it to your SR.

        The nickname can only be set in one server.

        The nickname will automatically be updated everytime `-profile rating` is used
        and the profile is the main one.
        """
        if not await self.has_nickname(ctx.author.id):
            if not await ctx.prompt("Do you want to display your SR in your nickname?"):
                return

            if ctx.guild.me.top_role < ctx.author.top_role:
                return await ctx.send(
                    "This server's owner needs to move the `OverBot` role higher, so I will "
                    "be able to update your nickname. If you are this server's owner, there's "
                    "not way for me to change your nickname, sorry!"
                )

            id, platform, username = await self.get_profile(ctx.author, index=None)
            try:
                data = await Request(platform=platform, username=username).get()
            except RequestError as e:
                return await ctx.send(e)

            profile = Player(data, platform=platform, username=username)
            if profile.is_private:
                return await ctx.send(
                    f"{str(profile)}'s profile is set to private. Profiles must be "
                    "set to public in order for me to retrieve their data."
                )

            try:
                await self.set_or_remove_nickname(ctx, profile=profile, profile_id=id)
            except Exception as e:
                await ctx.send(e)
        else:
            if await ctx.prompt("Do you want to **remove** your SR in your nickname?"):
                try:
                    await self.set_or_remove_nickname(ctx, remove=True)
                except Exception as e:
                    await ctx.send(e)
Exemple #14
0
def parse_input_file():
    file = open('input.txt', 'r')
    __input = file.read()
    file.close()

    player_list = []
    snake_list = []
    ladder_list = []

    __input = __input.split('\n')
    __snake_cnt = int(__input[0])
    __line_no = 1
    while(__snake_cnt!=0):
        _source, _destination = __input[__line_no].split()
        snake_list.append(Movable(int(_source), int(_destination)))

        __line_no += 1 
        __snake_cnt -= 1

    __ladder_cnt = int(__input[__line_no])
    __line_no += 1
    while(__ladder_cnt!=0):
        _source, _destination = __input[__line_no].split()
        ladder_list.append(Movable(int(_source), int(_destination)))

        __line_no += 1
        __ladder_cnt -= 1

    __player_cnt = int(__input[__line_no])
    __line_no += 1
    while(__player_cnt!=0):
        _name = __input[__line_no]
        player_list.append(Player(_name))

        __line_no += 1
        __player_cnt -= 1

    return player_list, snake_list, ladder_list
Exemple #15
0
        def callback(success, artist, title, song_id, path):
            if success:
                try:
                    # read mp3
                    mf = Player.open(path)
                    length = mf.total_time()

                    sql = 'UPDATE songs SET length = ?, bitrate = ?, samplerate = ?, processed = 1 WHERE id = ?'
                    self.db.execute(sql, length, mf.bitrate() / 1000, mf.samplerate(), song_id)

                    # update lists
                    self.player.playlist.append(song_id, artist, title, length)
                    self.application.wso.new(song_id)

                    # update free space
                    self.application.disk = self.player.free_space()
                    self.application.wso.disk(self.application.disk)

                    message = u'Song "%s \u2014 %s" was added to the playlist' % (artist, title)
                    return self.alert(message, self.ALERT_SUCCESS)
                except: pass

            self.db.execute('DELETE FROM songs WHERE id = ?', song_id)
            self.alert(u'File for song "%s \u2014 %s" is broken' % (artist, title))
Exemple #16
0
    def post(self):
        artists = self.get_body_arguments('artist[]')
        titles = self.get_body_arguments('titles[]')
        mp3s = self.request.files.get('mp3[]', [])

        lame = LAME()
        for i, mp3 in enumerate(mp3s):
            try:
                artist, title = artists[i][:64], titles[i][:128].title()
                if not artist or not title:
                    raise Exception('Song %s should have artist and title' % (i + 1))
                if os.path.splitext(mp3['filename'])[1].lower() != '.mp3':
                    raise Exception('Song %s should have MP3 format' % (i + 1))

                sql = 'INSERT INTO songs (user, artist, title) VALUES (?, ?, ?)'
                song_id = self.db.execute(sql, self.current_user.login, artist, title)

                path = Player.song2path(song_id)
                with open(path, 'wb') as fp:
                    fp.write(mp3['body'])

                lame.add(path, artist, title, song_id, path)
            except ValueError:
                return self.send_error(400)
            except Exception as e:
                self.alert(e)

        if not lame.queue:
            return self.redirect('/upload')

        def callback(success, artist, title, song_id, path):
            if success:
                try:
                    # read mp3
                    mf = Player.open(path)
                    length = mf.total_time()

                    sql = 'UPDATE songs SET length = ?, bitrate = ?, samplerate = ?, processed = 1 WHERE id = ?'
                    self.db.execute(sql, length, mf.bitrate() / 1000, mf.samplerate(), song_id)

                    # update lists
                    self.player.playlist.append(song_id, artist, title, length)
                    self.application.wso.new(song_id)

                    # update free space
                    self.application.disk = self.player.free_space()
                    self.application.wso.disk(self.application.disk)

                    message = u'Song "%s \u2014 %s" was added to the playlist' % (artist, title)
                    return self.alert(message, self.ALERT_SUCCESS)
                except: pass

            self.db.execute('DELETE FROM songs WHERE id = ?', song_id)
            self.alert(u'File for song "%s \u2014 %s" is broken' % (artist, title))

        lame.start(callback)

        total = len(lame.queue)
        self.alert('%s song%s uploaded, now processing...' %
            (total, ' was' if total == 1 else 's were'), self.ALERT_INFO)

        self.redirect('/upload')
Exemple #17
0
from time import strftime, localtime
from configparser import ConfigParser

from utils.sheet import Sheet
from utils.steam import Steam
from utils.player import Player

config = ConfigParser()
config.read("config.ini")

sheet = Sheet(
    sheet_key=config.get("accmgr", "sheet_key"),
    credentials="credentials.json",
    url_column=config.get("accmgr", "url_column"),
    ban_column=config.get("accmgr", "ban_column"),
)
steam = Steam(config.get("accmgr", "steam_api"))

profile_urls = sheet.get_profile_links()
player_bans = steam.fetch_player_bans(profile_urls)
players = Player().from_dict(player_bans)
updated = sheet.update_game_bans(players)
print(
    strftime("%y-%m-%d %H:%M:%S", localtime()),
    "Updated Cells:",
    updated["updatedCells"],
)
Exemple #18
0
import av
import time
import numpy as np
import sounddevice as sd
from utils.player import Player

plr = Player()

cap = av.open("rtsp://*****:*****@192.168.100.1/cam1/h264")
stream = [s for s in cap.streams
          ][1]  # set stream to video stream, [1] is audio stream

for packet in cap.demux(stream):
    for frame in packet.decode():  # rate is 8000
        audio = np.frombuffer(frame.planes[0], dtype=np.int16)
        butter = np.array([1, -1, 1, -1, 1, -1, 1, -1])
        audio = np.array(np.convolve(audio, butter, mode="same"),
                         dtype=np.int16)
        # print(audio)
        if audio is not None:
            sd.play(audio, 8000)
print("Done")
from utils.game import Board
from utils.player import Player

if __name__ == "__main__":
    print("**************************************************")
    print("***             WE TAKE YOUR MONEY             ***")
    print("***            Enjoy your experience           ***")
    print("**************************************************")
    print("\n")

    player1 = Player("Alan Turing")
    player2 = Player("Rachel Thomas")
    player3 = Player("Tom Crasset")

    while True:
        take_a_seat = input("Do you want to take a seat (Y/N) :")
        if take_a_seat in ("Y", "y", "N", "n"):
            if take_a_seat in ("Y", "y"):
                player4 = Player(input("What's your name ? "), True)
            else:
                player4 = Player("Jérôme Coumont")
            break

    game = Board([player1, player2, player3, player4])
    game.start_game()
def main():
    record = True
    plr = Player(colour=True, record=False)

    # initialize placeholder point clouds
    pc_left = rs.pointcloud()
    pc_right = rs.pointcloud()

    # create prefix and directories for naming files
    current_time = datetime.datetime.now()
    prefix = current_time.strftime("%Y-%m-%d:%H:%M")

    npy_dir = "data/" + prefix + "/npys/"
    ply_dir = "data/" + prefix + "/plys/"

    os.makedirs(npy_dir)
    os.makedirs(ply_dir)

    # initialise counters for naming files
    ply_counter = npy_counter = 0

    try:
        while True:
            [frame_left, frame_right] = plr.getFrames()
            if not frame_left or not frame_right:
                continue
            depth_frame_left = frame_left.get_depth_frame()
            depth_frame_right = frame_right.get_depth_frame()

            depth_color_frame_left = rs.colorizer().colorize(depth_frame_left)
            depth_color_frame_right = rs.colorizer().colorize(
                depth_frame_right)

            # Convert depth_frame to numpy array to render image
            depth_color_image_left = np.asanyarray(
                depth_color_frame_left.get_data())
            depth_color_image_right = np.asanyarray(
                depth_color_frame_right.get_data())

            depth_color_image = np.hstack(
                (depth_color_image_left, depth_color_image_right))

            # resize to fit screen, change as desired
            image = cv2.resize(depth_color_image, (1440, 720))

            # Render image in opencv window
            cv2.imshow("Depth Stream", image)
            key = cv2.waitKey(1)

            # if s is pressed save .npy
            if key == ord('s') and not record:

                points_left = pc_left.calculate(depth_frame_left)
                points_right = pc_right.calculate(depth_frame_right)

                np.save(npy_dir + str(npy_counter) + "left",
                        np.array(points_left.get_vertices()))
                print("File saved to " + npy_dir + str(npy_counter) +
                      "left.npy")

                np.save(npy_dir + str(npy_counter) + "right",
                        np.array(points_right.get_vertices()))
                print("File saved to " + npy_dir + str(npy_counter) +
                      "right.npy")

                npy_counter += 1
            if record:
                # convert and save left file
                points_left = pc_left.calculate(depth_frame_left)
                points_left = np.array(points_left.get_vertices())
                # print(points_left.shape)
                points_left = points_left[np.nonzero(points_left)]
                np.save(npy_dir + str(npy_counter) + "left", points_left)
                print("File saved to " + npy_dir + str(npy_counter) +
                      "left.npy")

                # convert and save right file
                points_right = pc_right.calculate(depth_frame_right)
                points_right = np.array(points_right.get_vertices())
                points_right = points_right[np.nonzero(points_right)]
                np.save(npy_dir + str(npy_counter) + "right", points_right)
                print("File saved to " + npy_dir + str(npy_counter) +
                      "right.npy")

                npy_counter += 1
                if npy_counter > 200:
                    raise Exception("finished recording")
                # time.sleep(0.1)

            # if a is pressed save .ply
            if key == ord('a'):

                color_frame_left = frame_left.get_color_frame()
                color_frame_right = frame_right.get_color_frame()

                # ply's require a colour mapping
                pc_left.map_to(color_frame_left)
                pc_right.map_to(color_frame_right)

                points_left = pc_left.calculate(depth_frame_left)
                points_right = pc_right.calculate(depth_frame_right)

                points_left.export_to_ply(
                    ply_dir + str(ply_counter) + "left.ply", color_frame_left)
                print("File saved to " + ply_dir + str(ply_counter) +
                      "left.ply")

                points_right.export_to_ply(
                    ply_dir + str(ply_counter) + "right.ply",
                    color_frame_right)
                print("File saved to " + ply_dir + str(ply_counter) +
                      "right.ply")

                ply_counter += 1

            # if pressed escape exit program
            if key == 27:
                cv2.destroyAllWindows()
                break
    finally:
        print("Stopping pipelines.")
        plr.stop()
        print("Compacting files.")
Exemple #21
0
 def set_table(self, names):
     self.player_names = names
     self.table = Table([Player(n) for n in self.player_names])
Exemple #22
0
import PyQt5
from utils.driver import Driver
from utils.neuron import Neuron
from utils.detector import Detector
from utils.player import Player

import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
import time
import keyboard
from brian2 import NeuronGroup, ms

# initialise classes
det = Detector("hand")
plr = Player()
drv = Driver()
time.sleep(0.1)
drv.lowerTurn()

## Comment to remove plottingqq
fig, ax = plt.subplots()
ax.set_ylim([-0.08, 0.07])
line1, = ax.plot(np.linspace(0, 10000, 10000), np.zeros(10000), 'r-')
line2, = ax.plot(np.linspace(0, 10000, 10000), np.zeros(10000), 'b-')
line3, = ax.plot(np.linspace(0, 10000, 10000), np.zeros(10000), 'g-')
plt.show(block=False)
fig.canvas.draw()
## /Comment to remove plotting

# Izhikevitch Neuron Model from http://brian2.readthedocs.io/en/stable/introduction/brian1_to_2/library.html
Exemple #23
0
 def add_player(self, p_name):
     self.players.append(Player(p_name))
Exemple #24
0
  device = AmazonBasics(array('B', [0x61, 0x8E, 0x9C, 0xCD, 0x03]), [3], array('B', [0x3C, 0x2A]))
  # device = Device(array('B', [0x61, 0x8E, 0x9C, 0xCD, 0x03]), [3], [], 'Test')
  device.status = 'Test'
  config.devices.append(device)
  device = Device(array('B', [0x98, 0xA3, 0x24, 0x69, 0x07]), [62], [], 'Test')
  device.status = 'Test'
  config.devices.append(device)
  device = LogitechMouse(array('B', [0x42, 0x66, 0x0A, 0xB1, 0x04]), [62], array('B', [0x00, 0xC2]), array('B', [0, 0x4F, 0, 0, 0x6E, 0, 0, 0, 0, 0x43]), 'Unencrypted')
  device.status = 'Test'
  config.devices.append(device)

  # for i in range(10):
  #   device = Device(array('B', [0x98, 0xA3, 0x24, 0x69, i]), [i], [], 'Test')
  #   device.status = 'Test'
  #   config.devices.append(device)


if __name__ == "__main__":
  # test_devices()
  init_commands()
  messager = Messager()
  messager.start()
  player = Player()
  player.start()
  try:
    while True:
      c = display.stdscr.getch()
      check_command(c)
      display.refresh()
  except KeyboardInterrupt:
    quit_app()
Exemple #25
0
from play.play_round import Round
from utils.player import Player
from utils.table import Table
import random

player_names = ['anil', 'pogo', 'mangal', 'ramya', 'harsha']
players = [Player(name) for name in player_names]
table = Table(players)

r = Round(table)
print(r.table)
r.table.move_player_to_front_by_name('ramya')
print(r.table)
r.table.move_player_to_front_by_name('harsha')
print(r.table)
# r.table.move_dealer()
# print(r.table)
r.table.remove_player("anil")
print(r.table)

print("Trump is : {}".format(r.trump_card))

# cards_played = {'anil': random.choice(players[0].hand.cards),
#                 'pogo': random.choice(players[1].hand.cards),
#                 'mangal': random.choice(players[2].hand.cards),
#                 'ramya': random.choice(players[3].hand.cards),
#                 'harsha': random.choice(players[4].hand.cards)}
#
# r.play_round(cards_played)
# print(r.players)
Exemple #26
0
from utils.player import Player
from utils.deck import Deck

p = Player(name='anil')
d = Deck()

for i in range(5):
    p.add_card_to_hand(d.get_random_card())

print(p.hand)
p.remove_card(p.hand.cards[3])
print(p.hand)
p.add_card_to_hand(d.get_random_card())
print(p.hand)
Exemple #27
0
from utils.game import Board
from utils.player import Player
from copy import deepcopy

all_player_names = []  # list of strings containing the names of all players
list_of_players = []  # list of all players of type Player
number_of_players = int(input('How may players?'))

for i in range(
        number_of_players):  # add name of players to list all_player_names
    all_player_names.append(input('What is your name?'))

for i in range(
        number_of_players):  # creating the list list_of_players of type Player
    k = Player(all_player_names[i])
    list_of_players.append(k)

player_board = Board(
    list_of_players)  #creating object of type Board from game.py
player_board.start_game()  #method start_game from class Board