Example #1
0
        if input(t_.CONTINUE_GAME).strip().upper() == t_.SHORT_YES:
            level_name, position = game.saved_game_data(
                settings.SAVE_FILE_NAME)
            Game.level = level_name
            Game.level.player_position = position
        else:
            os.unlink(settings.SAVE_FILE_NAME)

    if not Game.level:
        Game.notification(t_.CHOOSE_MAP)
        for i, _ in enumerate(Game.levels):
            Game.notification("[{}] {}".format(i + 1,
                                               _.name.replace('.txt', '')))
        Game.level = input("> ")


if __name__ == "__main__":

    t_ = languages.get_language(settings.LANGUAGE)

    with game.Game() as Game:

        if not len(Game.levels):
            raise Game.NoMapsFound

        main()

        Game.level.draw()
        while Game.execute_input(input(t_.GAME_INPUT_PROMPT)):
            Game.level.draw()
Example #2
0
            #print(target_f[0])
            #print(" ")
            target_f[0][action] = target
            self.model.fit(state, target_f, epochs=1, verbose=0)
        if self.epsilon > self.epsilon_min:
            self.epsilon *= self.epsilon_decay

    def load(self, name):
        self.model.load_weights(name)

    def save(self, name):
        self.model.save_weights(name)


if __name__ == "__main__":
    env = game.Game()
    state_size = env.observation_space
    action_size = env.action_space
    agent = DQNAgent(state_size, action_size)
    agent.load("./snake-cnn-weights.h5")
    done = False
    batch_size = 32
    stepList = []
    scoreList = []
    for e in range(EPISODES):
        state = env.reset()
        # print(state)
        for step in range(500):
            env.render()
            action = agent.act(state)
            # print(state)
Example #3
0
import sys
import codejail


def create_player(player_id, fname):
    return game.Player(player_id, open(fname).read())


if __name__ == '__main__':
    if len(sys.argv) < 3:
        print 'usage: python run.py <usercode1.py> <usercode2.py> [<map file>]'
        sys.exit()

    try:
        players = [create_player(i, x) for i, x in enumerate(sys.argv[1:3])]
        g = game.Game(*players)

        map_name = 'maps/default.py'
        if len(sys.argv) > 3 and sys.argv[3] != '--render':
            map_name = sys.argv[3]

        game.load_map(map_name)

        if '--render' in sys.argv:
            game.Render(g)
        else:
            for i in range(game.settings.max_turns):
                g.run_turn()
            print g.get_scores()

    except codejail.SecurityError as e:
Example #4
0
        parser = Parser(prog='lunch break rl')
        _, unknown_args = parser.parse_known_args()

        for i, arg in enumerate(unknown_args):
            # Only add arguments
            if arg.startswith(('-', '--')):
                next_is_value = False
                if i + 1 < len(unknown_args):
                    next_is_value = not unknown_args[i + 1].startswith(
                        ('-', '--'))

                # If argument is followed by a value, add it as a vanilla
                # argument.
                if next_is_value:
                    parser.add_argument(arg)

                # Otherwise add it as a flag
                else:
                    parser.add_argument(arg, action='store_true')

        self._args = parser.parse_args().__dict__

    def __getattr__(self, item):
        return self._args.get(item)


if __name__ == '__main__':
    arg = ArgHelper()
    g = game.Game(arg)
    g.run()
Example #5
0
# Swervin' Mervin
# (c) Andrew Buntine
# https://github.com/buntine/SwervinMervin

import pygame
import game as g
import settings as s

pygame.init()

pygame.display.set_caption("Swervin' Mervin")
s.FULLSCREEN = False
if s.FULLSCREEN:
    w_flag = pygame.FULLSCREEN
    pygame.mouse.set_visible(False)
else:
    w_flag = 0

fps_clock = pygame.time.Clock()
window = pygame.display.set_mode(s.DIMENSIONS, w_flag)
game = g.Game(window, fps_clock)

while True:
    if game.waiting:
        game.wait()
    else:
        game.play()
Example #6
0
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

import game
import ui

game = game.Game()
ui = ui.Ui(game)

ui.show()

while game.hasMovesAvailable():
    if not ui.getInput():
        break
    ui.show()

print "Game Over"
import pygame
import pygame.mouse
from pygame.locals import *
import sys
import directions
import game


pygame.mixer.pre_init(22050, -16, 2, 256)
pygame.init()
pygame.mixer.init()

screen_size = (640, 480) 
screen = pygame.display.set_mode([screen_size[0] - 1, screen_size[1] - 1])
g = game.Game(screen_size, screen)

while True:
	g.clock.tick(1000/30)

	btn_d = False
	btn_s = False
	btn_a = False

	for event in pygame.event.get():
		# Pay attention if the user clicks the X to quit.
		if event.type == pygame.QUIT:
			sys.exit()

		# Watch for mouse movement.  Tell the earth where the mouse is pointing.
		if event.type == pygame.MOUSEMOTION:
Example #8
0
from browser import document, timer
import browser
import game

print = browser.console.log

thegame = game.Game(document)
thegame.buildings.proffice.built += 1

timer.set_interval(thegame.tick, 100)
Example #9
0
                            player_data_for_turn[i] = data
                            playerConnections[i].sendall(
                                json.dumps(player_data_for_turn[i],
                                           ensure_ascii=True) + "\n")
                        except IOError:
                            pass
                #log what infomation is sent to the clients
                self.logger.print_stuff(json.dumps(player_data_for_turn))

                #clear turn objects
                validTurns = 0
                for i in range(0, self.maxPlayers):
                    turnObjects[i] = None
                for i in range(0, self.maxPlayers):
                    recval[i] = ""
                errors = [[] for i in turnObjects]
                #reset endtime
                currTime = time.time()
                endTime = time.time() + self.timeLimit
            else:
                currTime = time.time()
        #Close connections
        for conn in playerConnections:
            conn.close()
        serversocket.close()


if __name__ == "__main__":
    serv = MMServer(constants["players"], game.Game(constants["map"]))
    serv.run(constants["port"])
Example #10
0
import sqlite3
from bimbotconfig import *

import game
import betyourbimbo as bimbo

description = '''Welcome to the Bimbonator 3001x!  \nYou may use the following commands:'''

TEST = True

CMD_PREFIX = '!'

bot = commands.Bot(command_prefix=CMD_PREFIX, description=description)
bimbo = bimbo.BetYourBimbo(bot)

game = game.Game(bot)
idleSince = int(time.time())

def removeUserFormatting(userid):
	if userid[0:2] == "<@":
		userid = userid[2:]
	if userid[-1] == ">":
		userid = userid[:-1]
	return userid



def playerStatus(player):
	return "<@{}> is up...\nYour hand is {} for {}".format(player.name, player.getHand(), player.getBJCount())

Example #11
0
 def start_game(self):
     # print(Guess.__doc__)
     print(
         'Just a word about rules:\n if you missed a guessed letter 2 points will be deducted\n '
         'if you missed a guessed word 10% will be deducted \n '
         'and if you quit or gave up you will loose all the points of the uncovered letters \n'
     )
     print('Lets start playing the guessing game! Are you ready?'.center(
         80, '#'))
     print('\nCurrent Guess: ----\n \nPlease enter a choice to begin')
     # choice = input('g = guess, t = tell me, l for a letter, and q to quit\n')
     current_guess = '----'
     game_obj = game.Game()
     string_obj = stringDatabase.StringDatabase()
     database = []
     new_word = string_obj.get_random_word()
     new_score = game_obj.get_first_score(new_word)
     current_game_statistics = {
         'game': 1,
         'word': new_word,
         'status': '',
         'bad_guess': 0,
         'missed_letters': 0,
         'score': new_score
     }
     while True:
         choice = input(
             'g = guess, t = tell me, l for a letter, and q to quit\n')
         print(new_word)
         if choice == 'l' or choice == 'L':
             result_l, hit, update_score = game_obj.current_game_choice_l(
                 new_word)
             current_game_statistics[
                 'score'] = current_game_statistics['score'] - update_score
             string = ''
             if hit:
                 counter = 0
                 for i in range(len(result_l)):
                     if result_l[i] == '-':
                         string = string + current_guess[i]
                     elif current_guess[i] == '-':
                         counter += 1
                         string = string + result_l[i]
                         # current_game_statistics['score'] = current_game_statistics['score'] - update_score
                     else:
                         string = string + current_guess[i]
                 current_guess = string
                 current_game_statistics['status'] = 'playing'
                 print("You have got {:d} hit(s)!\n".format(counter))
                 print("Current Guess: " + current_guess +
                       "\n \nPlease enter a choice")
                 if current_guess == new_word:
                     print("Letter by Letter!! You have guessed it right!".
                           center(80, '#') + '\n')
                     current_game_statistics['status'] = 'Success'
                     current_game_statistics[
                         'score'] = current_game_statistics['score'] + 5
                     current_guess = '----'
                     database.append(current_game_statistics)
                     game_no = current_game_statistics['game']
                     new_word = string_obj.get_random_word()
                     new_score = game_obj.get_first_score(new_word)
                     current_game_statistics = {
                         'game': game_no + 1,
                         'word': new_word,
                         'status': 'Started',
                         'bad_guess': 0,
                         'missed_letters': 0,
                         'score': new_score
                     }
                     print(' New Game '.center(80, '#') + "\n")
                     print(
                         'New Guess: ----\n \nPlease enter a choice to begin the new game'
                     )
             else:
                 print("Hard Luck! no match found!")
                 current_game_statistics['status'] = 'playing'
                 current_game_statistics[
                     'missed_letters'] = current_game_statistics[
                         'missed_letters'] + 1
                 # current_game_statistics['score'] = current_game_statistics['score'] - update_score
         elif choice == 'g' or choice == 'G':
             result_g = game_obj.current_game_choice_g(new_word)
             if result_g == 'success':
                 print("Yes!!! You have guessed it right!".center(80, '#') +
                       '\n')
                 current_game_statistics['status'] = 'Success'
                 current_guess = '----'
                 database.append(current_game_statistics)
                 game_no = current_game_statistics['game']
                 new_word = string_obj.get_random_word()
                 new_score = game_obj.get_first_score(new_word)
                 current_game_statistics = {
                     'game': game_no + 1,
                     'word': new_word,
                     'status': 'Started',
                     'bad_guess': 0,
                     'missed_letters': 0,
                     'score': new_score
                 }
                 print(' New Game '.center(80, '#') + "\n")
                 print(
                     'New Guess: ----\n \nPlease enter a choice to begin the new game'
                 )
             else:
                 print("Sorry, Wrong guess!!! Pls. Try again".center(
                     80, '#') + "\n")
                 current_game_statistics['status'] = 'playing'
                 current_game_statistics[
                     'bad_guess'] = current_game_statistics['bad_guess'] + 1
                 new_score = current_game_statistics['score']
                 new_score = 0.1 * new_score
                 current_game_statistics[
                     'score'] = current_game_statistics['score'] - new_score
         elif choice == 't' or choice == 'T':
             print('The word was : ' + new_word + '\n')
             update_score = game_obj.get_updated_score(
                 new_word, current_guess)
             current_game_statistics[
                 'score'] = current_game_statistics['score'] - update_score
             current_game_statistics['status'] = 'Gave up'
             current_guess = '----'
             database.append(current_game_statistics)
             game_no = current_game_statistics['game']
             new_word = string_obj.get_random_word()
             new_score = game_obj.get_first_score(new_word)
             current_game_statistics = {
                 'game': game_no + 1,
                 'word': new_word,
                 'status': 'Started',
                 'bad_guess': 0,
                 'missed_letters': 0,
                 'score': new_score
             }
             print(' New Game '.center(80, '#') + "\n")
             print(
                 'New Guess: ----\n \nPlease enter a choice to begin the new game'
             )
         elif choice == 'q' or choice == 'Q':
             if current_game_statistics['status'] == 'playing':
                 print('The word was : ' + new_word + '\n')
                 update_score = game_obj.get_updated_score(
                     new_word, current_guess)
                 current_game_statistics['score'] = current_game_statistics[
                     'score'] - update_score
                 current_game_statistics['status'] = 'Quit'
                 database.append(current_game_statistics)
             print(' Game Overview '.center(80, '#') + '\n')
             print(
                 "{: >10} {: >10} {: >10} {: >10} {: >15} {: >15}".format(*[
                     'Game', 'Word', 'Status', 'Bad Guess', 'Missed Letter',
                     'Score'
                 ]))
             print("{: >10} {: >10} {: >10} {: >10} {: >15} {: >15}".format(
                 *['-----', '-----', '-----', '-----', '-----', '-----']))
             for data in database:
                 print("{: >10} {: >10} {: >10} {: >10} {: >15} {: >15f}".
                       format(*data.values()))
             final_score = 0
             for data in database:
                 final_score = final_score + data['score']
             print('\nFinal Score : {: f}'.format(final_score))
             break
         else:
             print("\nCurrent Guess: " + current_guess +
                   "\n \nSorry,s Please enter a correct choice")
Example #12
0
# Generate screen of game

pygame.display.set_caption(constant.game_name)
screen = pygame.display.set_mode((screen_width, screen_height))

banner_rect.x = math.ceil(screen.get_width() / 4)
banner_rect.y = math.ceil(screen.get_height() / 4 - 100)

# Generate button
play_button = pygame.image.load('assets/button.png')
play_button = pygame.transform.scale(play_button, (400, 150))
play_button_rect = play_button.get_rect()
play_button_rect.x = math.ceil(screen.get_width() / 3.33)
play_button_rect.y = math.ceil(screen.get_height() / 1.6)

game_var = game.Game()

while running:

    # Apply background to game
    screen.blit(background, (0, -200))

    # Start game if is_playing is true
    if game_var.is_playing:
        game_var.update(screen)
    else:
        screen.blit(play_button, play_button_rect)
        screen.blit(banner, banner_rect)

    # Update screen of game
    pygame.display.flip()
Example #13
0
 def __init__(self, id):
     self.id = id
     self.game_instance = game.Game()
     self.chatbot = Chatbot()
     self.chess_instance = chessbot.Game(id)
     self.last_conversation_lines = list()
Example #14
0
#! /bin/env python2

import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__),'src'))
import game
import mode


g = game.Game((1280, 720), os.path.join(sys.path[0], 'res'))
g.run(mode.AttractMode())
Example #15
0
    def test_buy_obvious_resources(self):
        # create some powerplants
        g = game.Game([self.player, player.Player('asdf')])

        self.player.power_plants = g.power_plant_market.visible[:4]
        self.player.buy_obvious_resources()
Example #16
0
def runGUI(layout):
    """
    Runs the GUI.
    :param layout:
    """
    # Create the Window
    window = sg.Window(APP_NAME, layout)
    game = None
    graph = None

    # Event Loop to process 'events' and get the 'values' of the inputs
    while True:
        event, values = window.read()

        # If user closes window, close the program
        if event == sg.WIN_CLOSED:
            break

        # If player selects file, update GUI to show file name
        if event == 'file_path':
            print('File selected:', values['file_path'])

            # Show file in GUI
            window['text_puzzle_name'](os.path.basename(values['file_path']))

            # Create game object
            xml_dict = ag.get_xml_from_path(values['file_path'])
            game = gm.Game(xml_dict)

            # Create board in GUI
            window['graph_board'].erase()
            graph = BoardGraph(window['graph_board'], game)

        # Start run the game with given parameters
        if event == 'button_run':
            start = time()
            print('button_run')

            if values['file_path'] != '':
                # Disable buttons on GUI while running the search
                toggle_gui(window, False)

                # Set game to run
                game.set_boards_generator(values['combo_search'], values['combo_variable'], values['combo_heuristic'])

                # Select search, we scarified here generality for performance, since this is the core to the search
                # and we wanted to avoid unnecessary 'if' statements each iteration
                if values['checkbox_show_animation']:
                    if values['combo_search'] == 'CSP':
                        run_paths_based_search_with_animation(window, graph, game)
                    else:
                        run_board_based_search_with_animation(window, graph, game)
                else:
                    if values['combo_search'] == 'CSP':
                        run_paths_based_search_without_animation(window, graph, game)
                    else:
                        run_board_based_search_without_animation(window, graph, game)
                end = time()
                print("Running Time ", end - start)
                window.finalize()
                window['button_reset'].update(disabled=False)

            else:
                print(FILE_NOT_SELECTED_MESSAGE)

        if event == 'button_reset':
            game.reset_game()
            graph.clear_board()

            window.finalize()
            toggle_gui(window, True)
            window['button_reset'].update(disabled=True)

        if event == 'graph_board':
            x, y = values["graph_board"]
            print(f'Clicked on x: {x}\t y: {y}')
            print(f'Figures in location {window["graph_board"].get_figures_at_location((x, y))}')

    window.close()
Example #17
0
import pygame
from pygame import surface
from pygame.locals import *

screen = pygame.display.set_mode((960, 720), HWSURFACE | DOUBLEBUF)
import game

disp = surface.Surface((960, 720))

GAME = game.Game(disp, screen)
GAME.clock = pygame.time.Clock()
GAME.go = True


def main():
    while GAME.go:
        GAME.update(dt=float(GAME.clock.tick(30) * 1e-3))


if __name__ == "__main__":
    main()
Example #18
0
def gen_random_game():
    return game.Game(
        [[gen_random_board(),
          gen_random_board(),
          gen_random_board()] for _ in range(3)])
Example #19
0
def test_init():
    game.Game()
Example #20
0
import game

game.Game.show_help()
game.Game.show_top_score()

xiaoming = game.Game("xiaoming")






Example #21
0
BOX_WIDTH = 70
FPS = 40
font = pygame.font.SysFont(None, 90)

screen_width = BOX_WIDTH * 8
screen_icon = pygame.image.load('pieces/images/W_KING.png')
display_surface = pygame.display.set_mode((screen_width, screen_width))
pygame.display.set_caption('Chess')
pygame.display.set_icon(screen_icon)

clock = pygame.time.Clock()

player1 = User(PieceColor.WHITE)
player2 = SmartBot(PieceColor.BLACK)
game = game.Game([player1, player2], BOX_WIDTH)

while True:
    click = None
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()
        if event.type == pygame.MOUSEBUTTONDOWN:
            row = math.floor(event.pos[1] / BOX_WIDTH)
            column = math.floor(event.pos[0] / BOX_WIDTH)
            click = board.get_box(row, column)

    text_click = text_select.get_text_select()
    if text_click:
        click = text_click
    async def handle_request(self, reader, writer):
        try:
            addr = writer.get_extra_info('peername')
            data = await reader.read(4096)
            message = json.loads(data.decode('utf8'))
        except EOFError:
            # Ignore - probably a disconnect
            print('EOFError')
            return
        except ConnectionResetError:
            print('Connection Reset Error')
            return
        except OSError:
            print('OS Error')
            return
        except json.decoder.JSONDecodeError:
            # Probably empty message
            return
        # print('Received Message:', message)

        reply = self.prepare_message('null')
        try:
            id = message['connection_id']
            screen_name = message['screen_name']
            message_type = message['type']
            requested_status = message['requested_status']
            client_id = message['client_id']
            # print(id, screen_name, message_type)
            if message['type'] == 'request connection':
                if id in self.web_players:
                    new = self.web_players[id]
                    print('web player reconnected')
                else:
                    new = WebPlayer(addr, screen_name, client_id)
                    self.web_players[new.id] = new
                    print('new web player created')
                reply = self.prepare_message('connected', connection_id=new.id)
            elif id not in self.web_players:
                # Recently deleted
                pass

            elif message['type'] == 'update player data':
                if id != 'False':
                    self.web_players[id].screen_name = screen_name
                    self.web_players[id].decklist = message['decklist']
                    if self.web_players[id].actual_status != 'in_game':
                        self.web_players[id].actual_status = requested_status
                    actual_status = self.web_players[id].actual_status

                    # Purge Duplicate Connections
                    duplicate_connections = []
                    current_player = self.web_players[id]
                    for id2, p in self.web_players.items():
                        if p != current_player and p.client_id == current_player.client_id:
                            duplicate_connections.append(id2)
                    for i in duplicate_connections:
                        del self.web_players[i]
                        print('duplicate connection removed')

                    # Check for Opponents
                    if actual_status == 'searching':
                        for id2, p in self.web_players.items():
                            if id2 != id and p.actual_status == 'searching':
                                print('opponent found')
                                players = [p, current_player]
                                for p in players:
                                    p.actual_status = 'in_game'
                                    if players[0].game_id == False and players[
                                            1].game_id == False:
                                        game = gm.Game()
                                        player_ids = [p.id for p in players]
                                        game.setup_game(player_ids)
                                        print('game created')
                                        for i, p in enumerate(players):
                                            p.game_id = game.id
                                            game.web_players.append(p)
                                            self.games[game.id] = game
                                            p.opponent = players[i - 1]
                                            game.players[
                                                i].web_player_id = p.id
                                            game.players[
                                                i].screen_name = p.screen_name
                                        decks = [p.decklist for p in players]
                                        # print(decks)
                                        game.deal_cards(decks)
                                # Players will be notified of this when they request room info
                                break

                    snapshots = []
                    if current_player.actual_status == 'in_game':
                        if current_player.game_id:
                            current_game = self.games[current_player.game_id]
                            if 'data' in message:
                                player_actions = message['data']
                                # if player_actions:
                                # print('server received player actions', player_actions)
                                current_game.single_loop(player_actions)

                            game_player = current_game.players_by_id[
                                current_player.id]
                            snapshots = [s for s in game_player.snapshots]
                            game_player.snapshots = []

                    reply = self.prepare_message(
                        'game_status',
                        actual_status=current_player.actual_status,
                        game_id=current_player.game_id,
                        data=snapshots)
            elif message['type'] == 'update card data':
                data = import_card_library(
                )  # No need for global - reloaded when game starts
                reply = self.prepare_message('card_data', data=data)

            elif message['type'] == 'leave room':
                print('deactivating player')
                self.web_players[id].connected = False
                reply = self.prepare_message('leaving successful')
                print('Player Deactivated')

            else:
                print(message)

        except KeyError:
            reply = self.prepare_message('bad player id')
            raise

        finally:
            # print('Returning Reply:', reply)
            writer.write(json.dumps(reply).encode('utf8'))
            await writer.drain()
            writer.close()
Example #23
0
 def startGame(self):
     g = game.Game(self.c.START)
import game
import board
import adafruit_trellism4
import adafruit_adxl34x
import busio
from color_names import *


trellis = adafruit_trellism4.TrellisM4Express()
trellis.pixels.auto_write = False

i2c = busio.I2C(board.ACCELEROMETER_SCL, board.ACCELEROMETER_SDA)
accelerometer = adafruit_adxl34x.ADXL345(i2c)

the_game = game.Game(trellis, accelerometer)

for x in range(8):
    for y in range(4):
        if x > 3:
            trellis.pixels[x, y] = BLUE
        else:
            trellis.pixels[x, y] = YELLOW
trellis.pixels.show()

keys = []
while not keys:
    keys = trellis.pressed_keys

while True:
    the_game.play(keys[0][0] < 4)        # False = key, True = accel
Example #25
0
import game

if __name__ == "__main__":
    core_size = 200
    window_width_and_height = 700
    game = game.Game(core_size, window_width_and_height)
Example #26
0
 def setUp(self):
     self.game = game.Game()
     self.game.player = self.game._create_player(name="TestPlayer")
     self.game.enemies = characters.Enemies.generate(number_of_enemies=5)
Example #27
0
import colorama as cm  
import player
import game
import addons

if __name__ == "__main__":
    #init colorama
    print("\033[2J")
    cm.init()
    plyr = player.Player()
    enemy = addons.Bossenemy()
    gameBoard = game.Game(plyr,enemy)
    gameplay=1
    while(plyr.getlives() > 0 and gameplay):
        gameplay = gameBoard.render(plyr,enemy)
        plyr.move(gameBoard)
    gameBoard.gameover(plyr)
Example #28
0
pygame.init()

pygame.mixer.music.load("zombiedashtrack.mp3")
pygame.mixer.music.play(-1)

gameDisplay = pygame.display.set_mode((800, 600))

pygame.display.set_caption('Zombie Dash')

clock = pygame.time.Clock()

currentView = "main menu"

player1 = login.menu(gameDisplay)

multiplayerMenu = game.Game(player1)

currentView = main_menu.mainMenu(gameDisplay, player1)

while currentView != "quit":

    if currentView == "main menu":
        currentView = main_menu.mainMenu(gameDisplay, player1)

    if currentView == "play":
        #currentView = main_menu.mainMenu(gameDisplay, player1)

        selection = map_selection.mapSelect(gameDisplay, player1)

        if selection != 'main menu':
            #Play map music
Example #29
0
import game

g = game.Game()
g.start()

while (g.loop()):
    0
Example #30
0
def main():
	mem = memory.Memory()
	img_processor = processor.Processor()
	env = game.Game()
	model = dqn.DQN(env)
	env.play_game(mem, model, img_processor, training_mode=True)