def check_map_choice(map_files, map_directory, map_extension): file_map_length = len(map_files) user_input_s = input( "Entrez un numéro de labyrinthe pour commencer à jouer : ") try: user_input_i = int(user_input_s) except ValueError: print("Merci de choisir un chiffre entre 1 et {0}".format( file_map_length)) return check_map_choice(map_files, map_directory, map_extension) if user_input_i < 1 or (user_input_i - 1) >= file_map_length: print("Merci de choisir un chiffre entre 1 et {0}".format( file_map_length)) return check_map_choice(map_files, map_directory, map_extension) print("Vous avez choisi la carte", user_input_i) with open(map_directory + map_files[user_input_i - 1] + map_extension, 'r') as f: labyrinth = Labyrinth(f.read()) if len(labyrinth.exits) < 1: print( "!!!!!!!!! carte invalide, il n'y a pas de sortie !!!!!!!!!!!!!!!") return check_map_choice(map_files, map_directory, map_extension) if not labyrinth.robot: print( "!!!!!!!!! carte invalide, il n'y a pas de robot !!!!!!!!!!!!!!!") return check_map_choice(map_files, map_directory, map_extension) return labyrinth
def main(): """ Main function """ pg.init() pg.display.set_caption("Projet 3 : Aidez Macgyver à s'échapper !") window = pg.display.set_mode((cst.WINDOW_HEIGHT, cst.WINDOW_WIDTH)) laby = Labyrinth("map.txt") while laby.mac_gyver.game: """I choose module pygame for the move I can to change my destination (Top, Left, Up or Right)""" laby.show_labyrinth(window) pg.display.flip() for event in pg.event.get(): if event.type == pg.QUIT: laby.mac_gyver.game = False pg.quit() elif event.type == pg.KEYDOWN: if event.key == pg.K_LEFT: laby.mac_gyver.move_to("L") elif event.key == pg.K_RIGHT: laby.mac_gyver.move_to("R") elif event.key == pg.K_UP: laby.mac_gyver.move_to("U") elif event.key == pg.K_DOWN: laby.mac_gyver.move_to("D")
def input(self): events = pygame.event.get() for event in events : if event.type == KEYDOWN : if event.key == K_RIGHT : if self.Astar() : self.winner = 2 else: self.winner = 3 if event.key == K_SPACE : if self.Astar() : self.winner = 1 else: self.winner = 3 if event.key == K_r : self.Lab = Labyrinth(self.size, self.style) self.winner = 0 if event.type == QUIT : sys.exit() if event.type == KEYUP: if event.key == K_RIGHT: self.Lab.stopDestroyWalls() if event.key == K_SPACE: self.Lab.stopDestroyWalls()
def game(): level = Labyrinth() level.open_csv(constants.CSV_LEVEL, constants.NSPRITE) hero = Macgyver() hero.create(level.structure) guard = Guard() guard.create(level.structure) ether = Item() ether.create(level.ground_list, level.structure, 'E') thumb = Item() thumb.create(level.ground_list, level.structure, 'T') needle = Item() needle.create(level.ground_list, level.structure, 'N') screen = View() screen.load() screen.create(level.structure) return level, hero, guard, ether, thumb, needle, screen
def main(): lab = Labyrinth("../map.txt") y, x = lab.find_player() point = 0 display = Display() display.display_labyrinthe(lab.lab) while True: for event in pygame.event.get(): if event.type == pygame.QUIT: exit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_UP: if lab.check_move(y - 1, x): point = lab.collect_item(y - 1, x, point) lab.update_character(y - 1, x) y = y - 1 elif event.key == pygame.K_RIGHT: if lab.check_move(y, x + 1): point = lab.collect_item(y, x + 1, point) lab.update_character(y, x + 1) x = x + 1 elif event.key == pygame.K_DOWN: if lab.check_move(y + 1, x): point = lab.collect_item(y + 1, x, point) lab.update_character(y + 1, x) y = y + 1 elif event.key == pygame.K_LEFT: if lab.check_move(y, x - 1): point = lab.collect_item(y, x - 1, point) lab.update_character(y, x - 1) x = x - 1 display.display_labyrinthe(lab.lab)
def test_str(self): map_ = ["...", "#.#", "###"] layer = Labyrinth(map_) labyrinth = Labyrinth3d([map_, map_]) self.assertEqual(str(labyrinth), str(layer) + "\n" + str(layer))
def main(): labyrinth = Labyrinth("labyrinth_test.json") macgyver = MacGyver(labyrinth) print("Collected_syringe_elements : {}". format(macgyver.collected_syringe_elements)) # returns [] print("Starting position : {}". format((macgyver.position.x, macgyver.position.y))) # returns (0, 1) macgyver.move("r") print("New position : {}". format((macgyver.position.x, macgyver.position.y))) # returns (1, 1) macgyver.move("r") print("New position : {}". format((macgyver.position.x, macgyver.position.y))) # returns (2, 1) macgyver.move("r") print("New position : {}". format((macgyver.position.x, macgyver.position.y))) # returns "Can't # move ..." then (2, 1) macgyver.move("d") print("New position : {}". format((macgyver.position.x, macgyver.position.y))) # returns (2, 2) macgyver.move("d") print("New position : {}". format((macgyver.position.x, macgyver.position.y))) # returns (2, 3) for i in range(11): macgyver.move("r") # returns "MacGyver failed ..." print("New position : {}". format((macgyver.position.x, macgyver.position.y))) # returns (13, 3)
def initialization(self, window): """ Initialise new objects when call """ self.labyrinth = Labyrinth() self.mac_gyver = Player( MAC_GYVER_IMAGE, FLOOR_IMAGE, self.labyrinth, self.window ) self.mac_gyver.position = [0, 0] self.objects = Objects( SYRINGE_IMAGE, ETHER_IMAGE, NEEDLE_IMAGE, self.labyrinth, self.window ) # Labyrinth self.labyrinth.labyrinth_construction() self.labyrinth.display_level(window) # Player self.mac_gyver.blit(self.mac_gyver.position) # Objects self.objects.generate_random_position() self.objects.display_objects() self.objects.objects_collected = 0 self.run = True self.response = None
def test_in_range(self): map_ = ["...", "###"] location = Location(1, 2) out_of_range_location = Location(0, 3) labyrinth = Labyrinth(map_) self.assertTrue(labyrinth.in_range(location)) self.assertFalse(labyrinth.in_range(out_of_range_location))
def test_init(self): map_ = ["#..", "..."] labyrinth = Labyrinth(map_) expected_map = [[LabyrinthObject(True), LabyrinthObject(False), LabyrinthObject(False)], [LabyrinthObject(False), LabyrinthObject(False), LabyrinthObject(False)]] self.assertEqual(labyrinth.width, 2) self.assertEqual(labyrinth.height, 3) self.assertEqual(labyrinth.map, expected_map)
def __init__(self, json_file="labyrinth.json"): """ GameText constructor. Instantiates objects from Labyrinth, MacGyver and Syringe classes. """ self.labyrinth = Labyrinth(json_file) self.macgyver = MacGyver(self.labyrinth) self.syringe = Syringe(self.labyrinth)
def main(): internal_labyrinth_dict = { (0, 0): Cell(True, True, True, True), (1, 0): Cell(True, True, False, True), (0, 1): Cell(True, True, True, True), (1, 1): Cell(True, True, True, False) } # labyrinth in labyrinth labyrinth_dict = { (0, 0): Cell(True, True, True, True), (1, 0): Cell(True, True, True, True), (0, 1): Cell(True, True, True, True), (1, 1): Labyrinth(internal_labyrinth_dict) } multi_labyrinth = Labyrinth(labyrinth_dict) print("labyrinth ", multi_labyrinth.get_labyrinth_dict()) print_labyrinth(multi_labyrinth) # 1. Count closed cells closed_number = get_number_of_closed_cells(multi_labyrinth) print("Initial number of closed cells in the labyrinth: ", closed_number) # 2. Close all cells wall_visitor = CloseCellsVisitor() wall_visitor.visit(False, multi_labyrinth) print("Closing all cells...") print_labyrinth(multi_labyrinth) # 3. Count closed in the updated labyrinth closed_number = get_number_of_closed_cells(multi_labyrinth) print("Updated number of closed cells in the labyrinth: ", closed_number) # 4. Open all cells wall_visitor.visit(True, multi_labyrinth) print("Open all cells...") print_labyrinth(multi_labyrinth) # 5. Count closed in the updated labyrinth closed_number = get_number_of_closed_cells(multi_labyrinth) print("Updated number of closed cells in the labyrinth: ", closed_number)
def test_init(self): map_ = ["...", "#.#", "###"] layer = Labyrinth(map_) labyrinth = Labyrinth3d([map_, map_]) self.assertEqual(labyrinth.depth, 2) self.assertEqual(labyrinth.width, 3) self.assertEqual(labyrinth.height, 3) self.assertEqual(labyrinth.map, [layer, layer])
def test_explore_single_unreachable(self): # Same as the previous test, except we require filter type 3 to go from B to D. rooms = ['A', 'B', 'C', 'D'] corridors = [('A', 'B', 0), ('B', 'D', 3), ('B', 'C', 0), ('C', 'D', 3)] filters = [('A', 0), ('C', 2), ('D', 3), ('D', 1)] start = 'A' goal = 'D' labyrinth = Labyrinth(rooms, corridors, filters, start, goal) self.assertEqual(explore_single(labyrinth), None)
def test_explore_single_basic_1(self): rooms = ['A', 'B', 'C', 'D', 'E', 'F'] corridors = [('A', 'B', 0), ('B', 'D', 2), ('B', 'C', 0), ('C', 'D', 3), ('C', 'E', 1), ('C', 'E', 3), ('C', 'F', 1)] filters = [('A', 0), ('C', 2), ('D', 3), ('E', 1)] start = 'A' goal = 'F' labyrinth = Labyrinth(rooms, corridors, filters, start, goal) self.assertEqual(explore_single(labyrinth), 8)
def test_explore_multiple_unreachable(self): # Same as the previous test, except filter type 2 is unreachable. rooms = ['S', 'L', 'R', 'D', 'G'] corridors = [('S', 'L', 0), ('S', 'R', 1), ('S', 'D', 2), ('D', 'G', 3)] filters = [('S', 0), ('S', 1), ('D', 2), ('L', 3)] start = 'S' goal = 'G' labyrinth = Labyrinth(rooms, corridors, filters, start, goal) self.assertEqual(explore_multiple(labyrinth, 18), None)
def main(): """This function is the main function to be executed to play the game.""" pygame.init() # we build the labyrinth, with the player and the tools to be found csv_path = os.path.join("data", "grid.csv") game_laby = Labyrinth(LabyViewer.LABY_WIDTH, LabyViewer.LABY_HEIGHT, csv_path) game_laby.initialize_player_location() game_player = game_laby.player game_tools = game_laby.tools # we initialize the main window with our game interface window = pygame.display.set_mode( (Interface.SCREEN_WIDTH, Interface.SCREEN_HEIGHT)) game_back = pygame.image.load("sprites\\backs\\blue_sky.png").convert() game_labyviewer = LabyViewer(game_laby) game_dashboard = Dashboard("game") game_interface = Interface(game_back, game_labyviewer, game_dashboard) window.blit(game_back, Interface.SCREEN_ORIGIN) # we load our sprites m_gyver = pygame.image.load("sprites\\laby\\m_gyver.png").convert() m_gyver.set_colorkey((255, 255, 255)) # set white as transparent sand_path = pygame.image.load("sprites\\laby\\path.png").convert() wall = pygame.image.load("sprites\\laby\\wall.png").convert() guard = pygame.image.load("sprites\\laby\\guard.png").convert() guard.set_colorkey((255, 255, 255)) # set white as transparent # we improve our window mac_g_a = pygame.image.load("sprites\\laby\\m_gyver.png").convert_alpha() mac_g_a.set_colorkey((255, 255, 255)) # set white as transparent pygame.display.set_icon(mac_g_a) pygame.display.set_caption("Mac Gyverinth - game mode - by etienne86") pygame.display.flip() # we display our labyrinth with walls, paths, guard and player sprites_dict = { "wall": wall, "sand_path": sand_path, "guard": guard, "m_gyver": m_gyver } game_labyviewer.display_labyrinth(window, sprites_dict) # we display our tools in the labyrinth game_labyviewer.display_tools_in_labyrinth(window) # we display our dashboard game_interface.display_dashboard(window, game_tools) # we execute our game loop game_loop(window, game_interface, game_laby, game_player, sprites_dict) pygame.quit()
def __init__(self): pygame.init() # The labyrinth self.lab = Labyrinth() # Map construction self.lab.build_map("maze.txt") # Random positions for the accessories self.lab.random_position() # Replace the start en finish position in the path self.lab.start_finish_to_path() # Creating the Hero self.hero = MacGyver(self.lab) # Creating the information title self.title_score = TitleScore() # Creating the score countdown self.score = Score() # The windows of the game self.window = pygame.display.set_mode((BOARD_SIZE_X, BOARD_SIZE_Y)) self.window.fill(BLACK) self.background = pygame.Surface((750, 750)) self.background.fill(BLACK) # Walls positioning self.wall = pygame.image.load("pics/wall50.png").convert() for walls in self.lab.walls: self.background.blit( self.wall, (walls.posx * SPRITE_SIZE_X, walls.posy * SPRITE_SIZE_Y)) # Paths positioning self.path = pygame.image.load("pics/path50.png").convert() for paths in self.lab.paths: self.background.blit( self.path, (paths.posx * SPRITE_SIZE_X, paths.posy * SPRITE_SIZE_Y)) # Starting point positioning self.start_point = pygame.image.load("pics/start50.png").convert() self.background.blit(self.start_point, (self.lab.start_pos.posx * SPRITE_SIZE_X, self.lab.start_pos.posy * SPRITE_SIZE_Y)) # Finish point positioning self.finish_point = pygame.image.load("pics/finish50.png").convert() self.background.blit(self.finish_point, (self.lab.finish_pos.posx * SPRITE_SIZE_X, self.lab.finish_pos.posy * SPRITE_SIZE_Y)) # Coordinate assignment to the accessories. gel_position, ether_position, syringe_position = self.lab.rand_pos # Creation of the sprites group self.sprites = pygame.sprite.Group( AccessorySprite(self.lab, gel_position, "tub"), AccessorySprite(self.lab, ether_position, "ether"), AccessorySprite(self.lab, syringe_position, "syringe"), HeroSprite(self.hero), ScoreSprite(self.hero, self.score), TitleScoreSprite(self.hero, self.title_score))
def test_explore_single_basic(self): rooms = ['A', 'B', 'C', 'D'] corridors = [('A', 'B', 0), ('B', 'D', 2), ('B', 'C', 0), ('C', 'D', 3)] filters = [('A', 0), ('C', 2), ('D', 3), ('D', 1)] start = 'A' goal = 'D' labyrinth = Labyrinth(rooms, corridors, filters, start, goal) # There are two edges leading to the goal room, D. However the filter of type 3 cannot be obtained # without reaching the goal room itself. So the explorer must first go to C to pick up the filter # of type 2. Thus the fastest sequence of actions is: # pick up filter 0, go from A to B, go from B to C, pick up filter 2, go from C to B, go from B to D. self.assertEqual(explore_single(labyrinth), 4)
def main(): """This function is the main function to be executed to edit the map.""" pygame.init() # we build the labyrinth csv_path = os.path.join("data", "grid.csv") edit_laby = Labyrinth(LabyViewer.LABY_WIDTH, LabyViewer.LABY_HEIGHT, csv_path) # we initialize the main window with our game interface window = pygame.display.set_mode( (Interface.SCREEN_WIDTH, Interface.SCREEN_HEIGHT)) edit_back = pygame.image.load("sprites\\backs\\sea.png").convert() edit_labyviewer = LabyViewer(edit_laby) edit_dashboard = Dashboard("edit") edit_interface = Interface(edit_back, edit_labyviewer, edit_dashboard) window.blit(edit_back, Interface.SCREEN_ORIGIN) # we load our sprites m_gyver = pygame.image.load("sprites\\laby\\m_gyver.png").convert() m_gyver.set_colorkey((255, 255, 255)) # set white as transparent sand_path = pygame.image.load("sprites\\laby\\path.png").convert() wall = pygame.image.load("sprites\\laby\\wall.png").convert() guard = pygame.image.load("sprites\\laby\\guard.png").convert() guard.set_colorkey((255, 255, 255)) # set white as transparent # we improve our window mac_g_a = pygame.image.load("sprites\\laby\\m_gyver.png").convert_alpha() mac_g_a.set_colorkey((255, 255, 255)) # set white as transparent pygame.display.set_icon(mac_g_a) pygame.display.set_caption("Mac Gyverinth - edit mode - by etienne86") pygame.display.flip() # we display our labyrinth with walls, paths, guard and player sprites_dict = { "wall": wall, "sand_path": sand_path, "guard": guard, "m_gyver": m_gyver } edit_labyviewer.display_labyrinth(window, sprites_dict) # we display our dashboard edit_interface.display_dashboard(window) # we execute our edit loop edit_loop(window, edit_interface, edit_laby, sprites_dict, csv_path) pygame.quit()
def __init__(self, size, disp_size, style): self.disp_size = disp_size self.style = style self.BLOCK_SIZE = self.disp_size // size self.size = size self.screen = pygame.display.set_mode((self.disp_size, self.disp_size)) pygame.display.set_caption('Splash Labyrinth') pygame.time.Clock().tick(30) self.Lab = Labyrinth(size, style) # this var keeps track of winners situation # 0 means the game is still running # 1 means p1 wins, 2 means p2 wins # 3 means the player who pushed the button lost self.winner = 0
def main(): labyrinth = Labyrinth() labyrinth.load_labyrinth_from_file("labyrinth.txt") macgyver = MacGyver(labyrinth) running = True while running: print(labyrinth.display()) response = input("Where do you want to go ? ( Q to quit the game)") if response == "q" or response == "Q": running = False elif response in ("h", "b", "d", "g"): macgyver.move(directions[response])
def test_getitem(self): map_ = [".#.", "##.", ".#."] labyrinth = Labyrinth(map_) wall = LabyrinthObject(True) empty = LabyrinthObject(False) for x in range(3): for y in range(3): current = labyrinth[Location(x, y)] if y == 1 or x == 1 and y == 0: self.assertEqual(current, wall) else: self.assertEqual(current, empty) self.assertRaises(TypeError, labyrinth.__getitem__, 1) self.assertRaises(IndexError, labyrinth.__getitem__, Location(-1, 1))
def test_next_state(self): map_ = ["...", "#.#", "###"] labyrinth = Labyrinth(map_) location = Location(1, 1) out_of_range_location = Location(0, 4) state = State(out_of_range_location, 1) self.check_next_state(labyrinth, state, []) expected_next_states = [State(Location(0, 1), 1), State(Location(1, 0), 0), State(Location(1, 2), 0), State(Location(2, 1), 0)] state = State(location, 1) self.check_next_state(labyrinth, state, expected_next_states) state = State(Location(0, 0), 1) self.check_next_state(labyrinth, state, expected_next_states[0:2])
def __init__(self): """Class constructor""" self.lab = Labyrinth('map.txt') # -tc- Même classe pour MacGyver et Murdoc? MacGyver peut se déplacer, pas Murdoc macgyver = Character('M', 1, 3) # -tc- Attention, il me semble plus logique que la position de départ de MacGyver soit définie dans map.txt guardian = Character('G', 13, 13) # -tc- il me semble plus logique que la position finale soit définie dans map.txt self.lab.set_character_position(macgyver) self.lab.set_character_position(guardian) self.lab.set_tool_positions(constants.TOOLS) view = pygame_.Pygame(*self.lab.get_size()) # view = CLI() # -tc- jeu en CLI pas possible. Votre classe Labyrinthe dépend de pygame view.display_lab(self.lab.lablist) game_loop = True while game_loop: # -tc- attention à cadencer votre boucle 30-40 tours par second à l'aide de pygame.time.Clock direction = view.get_direction() if direction is None: # exit key pressed exit() for d in direction: move = self.lab.move_macgyver(macgyver, guardian, d) if move['event'] in ['CONTINUE', 'ADD_TOOL']: view.display_lab(self.lab.lablist) elif move['event'] == 'NO_MOVE': continue elif move['event'] == 'WIN': view.win() game_loop = False break # -tc- si game_loop = False, éviter le break elif move['event'] == 'LOSE': view.lose() game_loop = False # -tc- si game_loop = False, éviter le break break
def test_explore_multiple_basic(self): # L -- S -- R # | # D # | # G rooms = ['S', 'L', 'R', 'D', 'G'] corridors = [('S', 'L', 0), ('S', 'R', 1), ('S', 'D', 2), ('D', 'G', 3)] filters = [('S', 0), ('S', 1), ('R', 2), ('L', 3)] start = 'S' goal = 'G' labyrinth = Labyrinth(rooms, corridors, filters, start, goal) # A single explorer needs 6 timesteps to get to the goal. self.assertEqual(explore_multiple(labyrinth, 20), 1) self.assertEqual(explore_multiple(labyrinth, 6), 1) # Two explorers can make it in 5 timesteps. One explorer goes right, picks up filter 2, goes back and drops it at S. # Meanwhile, the other explorer goes left, picks up filter 3, goes back to S, picks up filter 2, # and finally proceeds to D and G. self.assertEqual(explore_multiple(labyrinth, 5), 2) # No matter how many explorers you have, it's not possible to reach the goal in 4 or fewer timesteps. self.assertEqual(explore_multiple(labyrinth, 4), None)
def main(): """ Main function """ pygame.init() # Initialize pygame window = pygame.display.set_mode( DISPLAY_MODE) # Set the window size of the screen pygame.display.set_caption(DISPLAY_GAME_TITLE) # Set title of screen labyrinth = Labyrinth(window) labyrinth.load_level_from_file("level/level1.map") # Load level one Item(labyrinth.grid, ITEM_TOTAL) labyrinth.draw() score = Score(window, ITEM_TOTAL) score.draw() player = Player(window, labyrinth.grid, labyrinth.player_position, ITEM_TOTAL) # Loop until the user clicks the close button. done = False while not done: pygame.time.Clock().tick(1000) # Update the clock for event in pygame.event.get(): # User did something if event.type == pygame.QUIT: # If user clicked close done = True # Flag that we are done so we exit this loop elif event.type == pygame.KEYDOWN and player.is_finish is None: player.move(event.key) # Move player labyrinth.draw() # Update labyrinth score.draw(player.score) # Update score player.game_over() # Show Game Over pygame.display.update()
def main(): screen = pygame.display.set_mode((15 * sp_size, 15 * sp_size)) Lab = Labyrinth("mappy.txt", sp_size) Lab.convert_file_txt() Lab.get_pos() objects = Objects(Lab) objects.random() macgyver = MacGyver("mappy.txt", sp_size, objects, Lab) guardian = Guardian(sp_size) pygame.display.flip() current_game = True while current_game: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() elif event.type == pygame.KEYDOWN: if event.key == pygame.K_RIGHT: macgyver.move_right() elif event.key == pygame.K_LEFT: macgyver.move_left() elif event.key == pygame.K_UP: macgyver.move_up() elif event.key == pygame.K_DOWN: macgyver.move_down() macgyver.get_objects() Lab.get_pos() arbitror(macgyver, guardian) objects.display_objects() screen.blit(guardian.image, (guardian.rect.x, guardian.rect.y)) screen.blit(macgyver.image, (macgyver.rect.x, macgyver.rect.y)) macgyver.score_count() pygame.display.flip()
#!/usr/bin/python from pool import Pool from input_output import IO from labyrinth import Labyrinth from access import Access pool = Pool() pool.fill() io = IO() labyrinth = Labyrinth() access = Access() io.fill() labyrinth.fill() access.fill() while True: labyrinth.process(pool) access.process(pool) io.process(pool)
continue_game = 0 loop_loose = 0 elif event.type == KEYDOWN and event.key == K_F1: # Labyrinth launch continue_home = 0 # quitt home continue_game = 'L1' # Labyrinth launch finish_game = 0 loop_loose = 0 if continue_game != 0: # display background background = pygame.image.load(c.PICTURE_BACKGROUND).convert() # Generate a labyrinth from the file labyrinth = Labyrinth(continue_game) labyrinth.generate() labyrinth.display(window) # Create characteres mac_gyver = Character(c.PICTURE_MAC_GYVER_RIGHT, c.PICTURE_MAC_GYVER_LEFT, c.PICTURE_MAC_GYVER_UP, c.PICTURE_MAC_GYVER_DOWN, labyrinth) # Generat Items in labyrinth Item1 = Item(c.PICTURE_ETHER, labyrinth) Item2 = Item(c.PICTURE_NEEDLE, labyrinth) Item3 = Item(c.PICTURE_PLASTIC_TUBE, labyrinth) # display Items in labyrinth