Beispiel #1
0
 def __init__(self,nb_joueur=5):
     self.pile=pile.Pile()
     self.nb_joueur=nb_joueur
     self.joueurs=[]
     self.paquet=paquet.Paquet()
     self.classement=[]
     
     
     if self.nb_joueur==2:
         self.status=['Grand duc','Trou de chouette']
     elif self.nb_joueur==3:
         self.status=['Grand duc','Mi chouette','Trou de chouette']
     elif self.nb_joueur==4:
         self.status=['Grand duc','Duc','Chouette moisie','Trou de chouette']
     elif self.nb_joueur==5:
         self.status=['Grand duc','Duc','Mi chouette','Chouette moisie','Trou de chouette']
     elif self.nb_joueur==6:
         self.status=['Grand duc','Duc','Mi chouette','Mi chouette','Chouette moisie','Trou de chouette']
         
     i=0
     
     #Création des joueurs
     while i < nb_joueur:
         self.joueurs.append(joueur.Joueur(i,default_settings['Noms'][i]))
         i+=1
     
     #Melange et distribution en nb_joueurs tas
     self.paquet.melanger()
     mains = self.paquet.distribuer(nb_joueur)
     
     #Attribution des mains
     i=0
     for m in mains:
         self.joueurs[i].attributer_main(m)
         i+=1
Beispiel #2
0
    def get_pile(self):
        if self._pile is None:
            #fns = io.save( io.load(pjoin(self.tempdir, 'mini.seed')), pjoin(self.tempdir,
            #         'raw-%(network)s-%(station)s-%(location)s-%(channel)s.mseed'))
            fns = util.select_files([self.tempdir], regex=r'\.SAC$')
            self._pile = pile.Pile()
            self._pile.load_files(fns, fileformat='sac')

        return self._pile
Beispiel #3
0
    def __init__(self, basepile=None, tinc=360., tpad=0., storepath=None):
        pile.Pile.__init__(self)

        self._tinc = tinc
        self._tpad = tpad
        self._storepath = storepath
        self._blocks = {}

        if basepile is None:
            basepile = pile.Pile()

        self.set_basepile(basepile)
Beispiel #4
0
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# symbols

import struct
import pile

symbol_table = pile.Pile()

versionkey = 1

# class numbering as used in ORB.Mod

Head = 0
Const = 1
Var = 2
Par = 3
Fld = 4
Typ = 5
SProc = 6
SFunc = 7
Mod = 8
Beispiel #5
0
 def __init__(self):
     self.pile_gauche = pile.Pile()
     self.pile_droite = pile.Pile()
Beispiel #6
0
 def __init__(self, deck):
     super().__init__()
     self.piles.append(pile.Pile(location=(100, 50)))
     while not deck.is_empty:
         self.piles[0].add(deck.deal())
     self.piles.append(pile.Pile(location=(250, 50)))
Beispiel #7
0
def play_level(screen, player):
    background = pygame.Surface((c.SCREEN_WIDTH, c.SCREEN_HEIGHT))
    clock = pygame.time.Clock()

    # Make washers and dryers
    washer_group, dryer_group = level_utils.make_washers_and_dryers((0, 0), 2,
                                                                    2)

    # Images and sprites for player and laundry piles
    pile_images = image_utils.load_laundry_images('images/laundry/in_pile')
    pile_in = pile.Pile(15, 7, pile_images, c.LaundryState.UNWASHED)
    pile_out = pile.Pile(c.SCREEN_WIDTH - 105, 7, pile_images,
                         c.LaundryState.DRIED)

    # Labels for laundry piles
    # TODO: make more dynamic/adjustable labels based on position of piles
    pile_in_label, pile_in_rect = level_utils.make_label(WHITE, 'inbox')
    pile_in_rect.bottomleft = (10, c.SCREEN_HEIGHT)
    pile_out_label, pile_out_rect = level_utils.make_label(WHITE, 'outbox')
    pile_out_rect.bottomright = (c.SCREEN_WIDTH - PADDING, c.SCREEN_HEIGHT)

    daily_clock = level_utils.DailyClock()

    # Generating orders
    orders = level_utils.generate_orders(order_num_min=8,
                                         order_num_max=8,
                                         load_num_min=1,
                                         load_num_max=1)
    customers = level_utils.generate_customers(orders)
    inactive_customers = pygame.sprite.Group(
        customers)  # all customers start off inactive

    # Storing all sprites to master group
    all_sprites = pygame.sprite.Group(washer_group, dryer_group, pile_in,
                                      pile_out, player)
    logic = game_logic.GameLogic(orders, pile_in, pile_out, player)

    running = True
    while running:
        id = 0
        time_delta = clock.tick(FPS) / 1000.0
        mouse_up = False
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
                return c.GameState.QUIT
            if event.type == pygame.MOUSEBUTTONUP and event.button == 1:
                print("click!!!")
                print("the current time is: " + str(pygame.time.get_ticks()))
                mouse_up = True
            if event.type > pygame.USEREVENT:
                id = event.type - pygame.USEREVENT
                print(id)
            if event.type == c.FAIL_STATE:
                return c.GameState.GAME_OVER
            if event.type == c.GAME_LOGIC_EVENT:
                logic.handle_event(event.type)
            if event.type == c.NOON_EVENT:
                for customer in inactive_customers:
                    all_sprites.add(customer)
                    inactive_customers.remove(customer)

        if not customers:
            print("final score: " + str(logic.score))
            return c.GameState.GAME_OVER  # TODO: update/change

        # Updating objects
        all_sprites.update(time_delta, pygame.mouse.get_pos(), mouse_up, logic,
                           id)
        pile_in.update_y_pos()
        pile_out.update_y_pos()
        clock_text = daily_clock.get_updated_text(time_delta)
        clock_label, clock_rect = level_utils.make_label(WHITE, clock_text)
        clock_rect.topright = (c.SCREEN_WIDTH - PADDING, PADDING)

        # Drawing background, sprites, and labels
        screen.blit(background, (0, 0))
        screen.blit(pile_in_label, pile_in_rect)
        screen.blit(pile_out_label, pile_out_rect)
        screen.blit(clock_label, clock_rect)
        all_sprites.draw(screen)

        # Updating display with the latest
        pygame.display.update()