Beispiel #1
0
def deal_with_rooms(Bin_T, lines, roomss, adjrooms, room_adjroom_descs,
                    room_adjrooms, descs):
    i = 1

    while i < len(lines):
        room_adjroom_desc = lines[i] + "," + lines[i + 1]
        room_adjrooms.append(room_adjroom_desc)
        i += 2

    i = 0
    while i < len(room_adjrooms):
        room_adjroom_descs.append(room_adjrooms[i].split(","))
        i += 1

    i = 0

    while i < len(room_adjroom_descs):
        room_adj = room_adjroom_descs[i][0]
        descs.append(room_adjroom_descs[i][1])
        roomss.append(room_adj.split(' ', 1)[0])

        #print(room_adj)
        adjrooms.append(room_adj.split(' ', 1)[1])
        i += 1

    i = 0
    while i < (len(roomss) and len(adjrooms)):
        room = roomss[i]
        adjroom = adjrooms[i]
        Rooms.store_adj_rooms(Bin_T, room, adjroom)
        i += 1
Beispiel #2
0
def play(Bin_T, room_count, room_wumpus_in, spider_rooms, pit_rooms, bat_room,
         resupply_room, descs):

    play = True
    room = 1
    arrows = 3
    wumpus_is_in = False

    while play:
        desc = Rooms.get_desc(room, descs)
        adjrooms = Rooms.get_adj_rooms(Bin_T, room)
        adjroomss = adjrooms.split()
        adjroom1 = adjroomss[0]
        adjroom2 = adjroomss[1]
        adjroom3 = adjroomss[2]

        print(
            "You are in room {0}.\nYou have {1} arrows left.\n{2}\nThere are tunnels to {3}, {4}, and {5}"
            .format(room, arrows, desc, adjroom1, adjroom2, adjroom3))

        Rooms.check_adjrooms_trap(room, adjrooms, room_count, room_wumpus_in,
                                  bat_room, resupply_room, spider_rooms,
                                  pit_rooms, arrows, wumpus_is_in)
        inputs = input("Do you want to move or shoot?")

        if inputs.lower().startswith("m") or inputs.lower() == "move":
            inputs = input("Which room?")
            if inputs in adjroomss:
                room = int(inputs)
                if inputs == room_wumpus_in:
                    print(
                        "The wumpus ate you and you could not escape in time.")
                    continue
            else:
                #can't reach
                print("Please enter a valid input.")
        elif inputs.lower().startswith("s") or inputs.lower() == "shoot":
            inputs = input("Which room?")
            if inputs in adjrooms:
                arrows -= 1
                if inputs == room_wumpus_in:
                    print(
                        "You slayed the mighty wumpus and you go home as a hero."
                    )
                    continue
            else:
                print("Please enter a valid input.")
        else:
            print("Please enter a valid input.")
Beispiel #3
0
    def setup(self):
        """ Set up the game and initialize the variables. """
        # Set up the player
        if self.game_start:
            self.player_sprite = Player()
            self.player_sprite.center_x = 100
            self.player_sprite.center_y = 100
            self.player_list = arcade.SpriteList()
            self.player_list.append(self.player_sprite)
            self.bullet_list = arcade.SpriteList()
            self.explosions_list = arcade.SpriteList()
            self.itemone = False
            self.itemtwo = False
            self.itemthree = False

            # List of Enemy
            self.enemy_list = Enemy.create()

            # Our list of rooms
            self.rooms = Rooms.create()

            # Our starting room number
            self.current_room = 0

            # Create a physics engine for this room
            self.physics_engine = arcade.PhysicsEngineSimple(
                self.player_sprite, self.rooms[self.current_room].wall_list)
Beispiel #4
0
    def aiMover(self, player):

        self.myRooms = Rooms()
        print(player.location)
        list1 = self.myRooms.roomConnections(player.location)
        randloc = random.choice(list1)
        player.location = randloc
        newloc = self.myRooms.roomCoords(randloc)
        x = newloc[0]
        y = newloc[1]

        if player.name == 'Izzy':
            self.w.delete(self.token2)
            self.token2 = self.w.create_text(x, y+20, fill = 'red', font = 15, text = 'Izzy')
            self.text2.insert(END, '\nIzzy has moved to '+ player.location)
            self.player = self.player3
            self.aiMover(self.player)
        elif player.name == 'Jax':
            newloc = self.myRooms.roomCoords(randloc)
            x = newloc[0]
            y = newloc[1]
            self.w.delete(self.token3)
            self.token3 = self.w.create_text(x, y+40, fill = 'red', font = 15, text = 'Jax')
            self.text2.insert(END, '\nJax has moved to '+ player.location)
            self.player = self.player1
Beispiel #5
0
def init():
	global initialized
	if (initialized):
		return
	Dists.init()
	Parts.init()
	Rooms.init()
	for (shipType, typeAbbr) in TYPE_ABBRS.items():
		classes[shipType] = {}
		configPath = os.path.join(os.path.dirname(__file__), "data", "classes_%s.cfg" % typeAbbr)
		configDict = ConfigFile.readFile(configPath)
		for className in configDict.keys():
			if (type(configDict[className]) != type({})):
				continue
			classes[shipType][className] = ShipClass(shipType, configDict[className])
	initialized = True
Beispiel #6
0
    def moves(self,player):

        self.myRooms = Rooms()
        print(player.location)
        list1 = self.myRooms.roomConnections(player.location)

        for i in list1:
            self.lb1.insert(END, i)
Beispiel #7
0
    def first_run(self):

        new_player = input("What is your name? ")
        print(
            "Great to have you on board {name}! We're glad to have you join our team. You can put your stuff in the\n"
            "break room and get started. You're free to leave at any time just say the words I QUIT."
            .format(name=new_player))
        # global WAITING_ROOMS, PATIENT_ROOMS, BREAK_ROOM

        self.WAITING_ROOMS = [
            Rooms.WaitingRoom(i) for i in range(0, settings.max_waiting_rooms)
        ]
        self.PATIENT_ROOMS = [
            Rooms.PatientRoom(i) for i in range(0, settings.max_patient_rooms)
        ]
        self.BREAK_ROOM = Rooms.BreakRoom(1)
        self.AVAIL_ROOMS = [room for room in self.WAITING_ROOMS]
        self.AVAIL_ROOMS.append(self.BREAK_ROOM)

        return Player(self.BREAK_ROOM, new_player)
Beispiel #8
0
def main():
    Bin = BST()

    room_choices = []
    roomss = []
    adjrooms = []
    room_adjroom_descs = []
    room_adjrooms = []
    descs = []
    spider_rooms = []
    pit_rooms = []

    file = "Cave_Layout.txt"

    #    file = input("Please enter the name of the cave layout.")

    with open(file, 'r') as fil:
        lines = fil.read().splitlines()

        room_spiders_pits_count = lines[0]

        room_spider_pits_count = room_spiders_pits_count.split()
        room_count = int(room_spider_pits_count[0])
        amount_spiders = int(room_spider_pits_count[1])
        amount_pits = int(room_spider_pits_count[2])

    deal_with_rooms(Bin, lines, roomss, adjrooms, room_adjroom_descs,
                    room_adjrooms, descs)
    i = 2

    while i <= room_count:
        room_choices.append(i)
        i += 1

    random_rooms = Rooms.gen_traps_room(room_choices, amount_spiders,
                                        amount_pits)
    room_wumpus_in = random_rooms[0]
    bat_room = random_rooms[1]
    resupply_room = random_rooms[2]

    for x in range(len(random_rooms)):
        x = 3
        if amount_spiders >= 1:
            spider_rooms.append(random_rooms[x])
            amount_spiders -= 1
            x += 1
        if amount_spiders == 0:
            if amount_pits >= 1:
                pit_rooms.append(random_rooms[x])
                amount_pits -= 1

    play(Bin, room_count, room_wumpus_in, spider_rooms, pit_rooms, bat_room,
         resupply_room, descs)
Beispiel #9
0
def main():
    # Create Game object
    Core.Game.config_create("config.json")

    # Load fonts
    font = sge.gfx.Font()

    #==New Shit To Look At=================================================
    # # create menu sprites
    # play_sprite = sge.gfx.Sprite("playButton.png", Core.IMG_PATH)
    # instructions_sprite = sge.gfx.Sprite("instructButton.png", Core.IMG_PATH)
    # credits_sprite = sge.gfx.Sprite("creditsButton.png", Core.IMG_PATH)
    #
    # # create menu objects
    # menu_objects = []
    # play_button = sge.dsp.Object(524, 400, play_sprite)
    # instructions_button = sge.dsp.Object(9, 400, instructions_sprite)
    # credits_button = sge.dsp.Object(984, 400, credits_sprite)
    #
    # menu_objects.append(play_button)
    # menu_objects.append(instructions_button)
    # menu_objects.append(credits_button)
    #
    # # create menu room
    # menu_room = sge.dsp.Room(menu_objects,
    #                          ROOM_WIDTH/2,
    #                          ROOM_HEIGHT,
    #                          sge.dsp.View,
    #                          #NEED_A_BACKGROUND
    #                          )
    #==New Shit To Look At=================================================

    # Create rooms
    for path in sorted(glob.iglob(os.path.join("rooms", "*.json"))):
        filename = os.path.basename(path)
        objects_path = os.path.join("objects", filename)
        if os.path.exists(objects_path):
            objects = create_objects(objects_path)
        else:
            objects = []

        room = Rooms.create_room(path,
                                 font=font,
                                 objects=objects,
                                 views=[sge.game.view])
        sge.game.rooms.append(room)

    sge.game.start_room = sge.game.next_room()
    sge.game.start()
Beispiel #10
0
class Map(object):

    rooms = {
        'corridor': Rooms.Corridor(),
        'startup': Rooms.Startup(),
        'death': Rooms.Death(),
        'panda': Rooms.Panda(),
        'ocean': Rooms.Ocean(),
        'ghost': Rooms.Ghost(),
        'minion': Rooms.Minion(),
        'cell': Rooms.Cell(),
        'fadafingling': Rooms.Fadafingling()
    }

    def __init__(self, start_room):
        self.start_room = start_room

    def next_room(self, room_name):
        return Map.rooms[room_name]

    def get_start_room(self):
        return self.next_room(self.start_room)
Beispiel #11
0
class GameBoard(Frame):

    def __init__(self,root,player1,player2, player3):
        self.root = root
        self.player1 = player1
        self.player2 = player2
        self.player3 = player3

        #self.create_board(root, player1, player2, player3)
        #self.buildMap(root, player1, player2, player3)
        self.frame = Frame(root, height = 350, width = 100)
        self.frame.pack(expand = YES,fill = BOTH, side = BOTTOM)
        self.frame.propagate(False)
        self.frame2 = Frame(self.frame,width = 100 )
        self.frame2.pack(side = RIGHT, anchor = NE)


        self.pane = PanedWindow(self.frame, height = 350)
        self.pane.pack(anchor =NW)


        self.b = Button(self.pane, width = 10, text = 'Draw Card')
        self.b.pack( pady = 5, anchor = W)
        self.card = Label(self.frame2)
        self.card.pack(side = LEFT)
        self.text = Text(self.frame2,height = 8, width = 100)
        self.text.pack(padx = 50, pady = 10,anchor =E,  )
        self.text2 = Text(self.frame2,height = 3, width = 100)
        self.text2.pack(padx = 50, pady = 10, side = BOTTOM, anchor =SE)
        self.lb1 = Listbox(self.pane, selectmode = EXTENDED)

        self.player = player1
        self.b1 = Button(self.pane, width = 10,text = 'Move', command = lambda : self.runClick(self.player))
        self.b1.pack(pady = 5, anchor = W)

        self.b2 = Button(self.pane, width = 10,text = 'Play Card')
        self.b2.pack(pady=5, anchor = W)

        self.vscrollbar = Scrollbar(root)
        self.vscrollbar.pack(side = RIGHT, fill = Y)
        self.hscrollbar= Scrollbar(root, orient = HORIZONTAL)
        self.hscrollbar.pack(side = BOTTOM, fill = X)

        self.w = Canvas(root, width = 1670, height = 2000,yscrollcommand = self.vscrollbar.set, xscrollcommand = self.hscrollbar.set)
        self.w.config(scrollregion=(0,0,1670, 2000))
        self.w.background = PhotoImage(file = 'img1.gif')
        self.w.create_image(0,0, anchor = NW, image=self.w.background)

        self.token1 = self.w.create_text(825, 1350, fill = 'red', font = 15, text = player1.name)
        self.token2 = self.w.create_text(825, 1390, fill = 'red', font = 15, text = player2.name)
        self.token3 = self.w.create_text(825, 1430, fill = 'red', font = 15, text = player3.name)


        self.vscrollbar.config(command = self.w.yview)
        self.hscrollbar.config(command = self.w.xview)
        self.vscrollbar.pack()
        self.w.pack(expand = YES, side = LEFT, fill = BOTH)
        self.myRooms = Rooms()
        #print(player1.location)
        list1 = self.myRooms.roomConnections(player1.location)

        for i in list1:
            self.lb1.insert(END, i)
        #print (list1)




        self.lb1.pack(side = LEFT, anchor = SW)

    def moves(self,player):

        self.myRooms = Rooms()
        print(player.location)
        list1 = self.myRooms.roomConnections(player.location)

        for i in list1:
            self.lb1.insert(END, i)


    def aiMover(self, player):

        self.myRooms = Rooms()
        print(player.location)
        list1 = self.myRooms.roomConnections(player.location)
        randloc = random.choice(list1)
        player.location = randloc
        newloc = self.myRooms.roomCoords(randloc)
        x = newloc[0]
        y = newloc[1]

        if player.name == 'Izzy':
            self.w.delete(self.token2)
            self.token2 = self.w.create_text(x, y+20, fill = 'red', font = 15, text = 'Izzy')
            self.text2.insert(END, '\nIzzy has moved to '+ player.location)
            self.player = self.player3
            self.aiMover(self.player)
        elif player.name == 'Jax':
            newloc = self.myRooms.roomCoords(randloc)
            x = newloc[0]
            y = newloc[1]
            self.w.delete(self.token3)
            self.token3 = self.w.create_text(x, y+40, fill = 'red', font = 15, text = 'Jax')
            self.text2.insert(END, '\nJax has moved to '+ player.location)
            self.player = self.player1

    def runClick(self,player):

        items =self.lb1.curselection()
        value= self.lb1.get(items[0])
        print(player.name)
        #print (items)
        player.location = value
        newloc = self.myRooms.roomCoords(value)
        x = newloc[0]
        y = newloc[1]



        #self.token1 = self.w.create_text(x, y, fill = 'red', font = 15, text = 'Donny')
        self.lb1.delete(0, END)

        if player.name == 'Donny':
            self.w.delete(self.token1)
            self.token1 = self.w.create_text(x, y, fill = 'red', font = 15, text = 'Donny')
            self.moves(self.player)
            self.player = self.player2
            self.aiMover(self.player)
Beispiel #12
0
def start():
    Rooms.entrance().start()
    while True:
        room = Rooms.rand()
        room.start()
        Player.rooms += 1
def main():

    room_list = Rooms.rooms()

    current_room = room_list[0]

    pygame.init()

    screen = pygame.display.set_mode((1366, 768), pygame.FULLSCREEN)

    pygame.display.set_caption("The room")

    done = False

    clock = pygame.time.Clock()

    while not done:

        for event in pygame.event.get():

            if event.type == pygame.QUIT:

                done = True

            if event.type == pygame.KEYDOWN:

                if event.key == pygame.K_UP:

                    next_room = room_list[current_room][1]
                    if next_room is None:
                        continue

                    current_room = next_room

            if event.type == pygame.KEYDOWN:

                if event.key == pygame.K_RIGHT:

                    next_room = room_list[current_room][2]
                    if next_room is None:
                        continue

                    current_room = next_room

            if event.type == pygame.KEYDOWN:

                if event.key == pygame.K_DOWN:

                    next_room = room_list[current_room][3]
                    if next_room is None:
                        continue

                    current_room = next_room

            if event.type == pygame.KEYDOWN:

                if event.key == pygame.K_LEFT:

                    next_room = room_list[current_room][4]
                    if next_room is None:
                        continue

                    current_room = next_room

        img = pygame.image.load(current_room[5])
        screen.blit(img, (0, 0))

        pygame.display.flip()

    clock.tick(60)

    pygame.quit()
Beispiel #14
0
    def __init__(self,root,player1,player2, player3):
        self.root = root
        self.player1 = player1
        self.player2 = player2
        self.player3 = player3

        #self.create_board(root, player1, player2, player3)
        #self.buildMap(root, player1, player2, player3)
        self.frame = Frame(root, height = 350, width = 100)
        self.frame.pack(expand = YES,fill = BOTH, side = BOTTOM)
        self.frame.propagate(False)
        self.frame2 = Frame(self.frame,width = 100 )
        self.frame2.pack(side = RIGHT, anchor = NE)


        self.pane = PanedWindow(self.frame, height = 350)
        self.pane.pack(anchor =NW)


        self.b = Button(self.pane, width = 10, text = 'Draw Card')
        self.b.pack( pady = 5, anchor = W)
        self.card = Label(self.frame2)
        self.card.pack(side = LEFT)
        self.text = Text(self.frame2,height = 8, width = 100)
        self.text.pack(padx = 50, pady = 10,anchor =E,  )
        self.text2 = Text(self.frame2,height = 3, width = 100)
        self.text2.pack(padx = 50, pady = 10, side = BOTTOM, anchor =SE)
        self.lb1 = Listbox(self.pane, selectmode = EXTENDED)

        self.player = player1
        self.b1 = Button(self.pane, width = 10,text = 'Move', command = lambda : self.runClick(self.player))
        self.b1.pack(pady = 5, anchor = W)

        self.b2 = Button(self.pane, width = 10,text = 'Play Card')
        self.b2.pack(pady=5, anchor = W)

        self.vscrollbar = Scrollbar(root)
        self.vscrollbar.pack(side = RIGHT, fill = Y)
        self.hscrollbar= Scrollbar(root, orient = HORIZONTAL)
        self.hscrollbar.pack(side = BOTTOM, fill = X)

        self.w = Canvas(root, width = 1670, height = 2000,yscrollcommand = self.vscrollbar.set, xscrollcommand = self.hscrollbar.set)
        self.w.config(scrollregion=(0,0,1670, 2000))
        self.w.background = PhotoImage(file = 'img1.gif')
        self.w.create_image(0,0, anchor = NW, image=self.w.background)

        self.token1 = self.w.create_text(825, 1350, fill = 'red', font = 15, text = player1.name)
        self.token2 = self.w.create_text(825, 1390, fill = 'red', font = 15, text = player2.name)
        self.token3 = self.w.create_text(825, 1430, fill = 'red', font = 15, text = player3.name)


        self.vscrollbar.config(command = self.w.yview)
        self.hscrollbar.config(command = self.w.xview)
        self.vscrollbar.pack()
        self.w.pack(expand = YES, side = LEFT, fill = BOTH)
        self.myRooms = Rooms()
        #print(player1.location)
        list1 = self.myRooms.roomConnections(player1.location)

        for i in list1:
            self.lb1.insert(END, i)
        #print (list1)




        self.lb1.pack(side = LEFT, anchor = SW)
Beispiel #15
0
    print(str(warband))


loop_game = True

#Start game
while loop_game:

    #ask the user if they want to play
    ask_user_start = raw_input(
        'Welcome to Warhammer Roleplay. Would you like to play? Y/N: ')

    #iF yes
    if (ask_user_start == 'Y'):

        print('')
        print('You will play as ' + warhammer_factions[0])
        print('')
        print_warband(empire_units)
        Rooms.RoomOne(empire_units[3], empire_units[2], empire_units[1],
                      empire_units[0])

    elif (ask_user_start == 'N'):

        print('')
        print('Au Revoir!')

    else:

        print('')
        print('Response was invalid. Please try again')
Beispiel #16
0
                      open('services_schedules/' + kind + '.txt', 'w'))
        else:
            services[kind] = Services(
                kind, service[1][0], service[1][1], service[1][2],
                json.load(open('services_schedules/' + kind + '.txt', 'r')))
# rooms
rooms = {}
for i in range(36):
    if i < 16:
        size = 'single'
    elif 16 <= i < 32:
        size = 'double'
    else:
        size = 'quadruple'
    if not os.path.isfile('rooms_schedules/' + str(i) + '.txt'):
        rooms[i] = Rooms(i, size, [])
        json.dump(rooms[i].schedule,
                  open('rooms_schedules/' + str(i) + '.txt', 'w'))
    else:
        rooms[i] = Rooms(
            i, size, json.load(open('rooms_schedules/' + str(i) + '.txt',
                                    'r')))

################################################################################################
################################################################################################
################################################################################################
################################################################################################


def register():
    global services
Beispiel #17
0
 def setUp(self):
     context = zmq.Context()
     self.controller = Rooms.Controller(context)
Beispiel #18
0
                      indent=4)
        else:
            services[kind] = Services(kind, service[1][0], service[1][1], service[1][2], \
            json.load(open('services_schedules/' + kind + '.txt', 'r')))
# rooms
rooms = {}
for i in range(36):
    if i < 16:
        size = 'single'
    elif 16 <= i < 32:
        size = 'double'
    else:
        size = 'quadruple'
    room_number = ('0' * 3 + str(i))[-3:]
    if not os.path.isfile('rooms_schedules/' + room_number + '.txt'):
        rooms[i] = Rooms(room_number, size, [])
        json.dump(rooms[i].schedule,
                  open('rooms_schedules/' + room_number + '.txt', 'w'),
                  sort_keys=True,
                  indent=4)
    else:
        rooms[i] = Rooms(
            room_number, size,
            json.load(open('rooms_schedules/' + room_number + '.txt', 'r')))

################################################################################################
################################################################################################
################################################################################################
################################################################################################

Beispiel #19
0
def run_rooms(context):
    controller = Rooms.Controller(context)
    controller.run()
def main():

    room_list = Rooms.rooms()

    current_room = room_list[0]

    pygame.init()

    screen = pygame.display.set_mode((1366, 768), pygame.FULLSCREEN)

    pygame.display.set_caption("The room")

    done = False

    clock = pygame.time.Clock()

    while not done:

        for event in pygame.event.get():

            if event.type == pygame.QUIT:

                done = True

            if event.type == pygame.KEYDOWN:

                if event.key == pygame.K_UP:

                    next_room = room_list[current_room][1]
                    if next_room is None:
                        continue

                    current_room = next_room

            if event.type == pygame.KEYDOWN:

                if event.key == pygame.K_RIGHT:

                    next_room = room_list[current_room][2]
                    if next_room is None:
                        continue

                    current_room = next_room

            if event.type == pygame.KEYDOWN:

                if event.key == pygame.K_DOWN:

                    next_room = room_list[current_room][3]
                    if next_room is None:
                        continue

                    current_room = next_room

            if event.type == pygame.KEYDOWN:

                if event.key == pygame.K_LEFT:

                    next_room = room_list[current_room][4]
                    if next_room is None:
                        continue

                    current_room = next_room

        img = pygame.image.load(current_room[5])
        screen.blit(img, (0, 0))

        pygame.display.flip()

    clock.tick(60)

    pygame.quit()
Beispiel #21
0
 def rooms_function(self):
     self.rooms_window = tk.Toplevel()
     self.rooms = Rooms(self.rooms_window, self.master)
     self.master.withdraw()