En este repositorio realizaré la tarea del laberinto.

Overview

Laberinto

Perfil de GitHub del autor de este proyecto:

  1. @jmedina28

En este repositorio queda resuelta la composición de un laberinto 5x5 con sus muros correspondientes y con su posterior resolución en Python. Para mayor claridad véase la foto que se muestra a continuación:



El diagrama de flujo empleado para resolver el ejercicio es el siguiente:

(Diagrama de flujo)

El código empleado para resolver el ejercicio es el siguiente:

# Creo la tupla del muro.
muro = (
    (0, 1),
    (0, 2),
    (0, 3),
    (0, 4),
    (1, 1),
    (2, 1),
    (2, 3),
    (3, 3),
    (4, 0),
    (4, 1),
    (4, 2),
    (4, 3),
)


def creacionlab(dimension, muros):
    """Ahora vamos a crear la función
    que genera el laberinto.
    Para ello incluyo 2 parámetros en la misma:
    - La dimensión que es un integer.
    - Los muros que es una lista formada por tuplas.
    Buscamos que esta función genere el laberinto.
    """
    # Creo una lista en la que se van a incluir las filas del laberinto.
    lab = []
    # Ahora vamos a crear el bucle que añade las filas anteriormente mencionadas.
    for x in range(dimension):
        fila = []
        # El siguiente bucle va a "rellenar" las filas anteriormente generadas.
        for y in range(dimension):
            if tuple([x, y]) in muro:
                # En caso de que la tupla aparezca en la lista de muros se añade una X en la misma.
                fila.append("X")
            else:
                # En caso contrario se añadirá un espacio.
                fila.append(" ")
        lab.append(fila)
    return lab


# En la parte donde se encuentra la dimensión sustituimos por el 5 ya que el laberinto dado es 5x5.
laberinto = creacionlab(5, muro)
""" El join() devuelve un string 
uniendo todos los elementos 
de una lista, tupla o string 
 con otro string que elijamos.
"""
for x in laberinto:
    print("".join(x))
Owner
Juan Medina
Mathematical Engineering Student.
Juan Medina
Python communism - A module for initiating the communist revolution in each of our python modules

Python communist revolution A man once said to abolish the classes or something

758 Jan 03, 2023
A Python module for decorators, wrappers and monkey patching.

wrapt The aim of the wrapt module is to provide a transparent object proxy for Python, which can be used as the basis for the construction of function

Graham Dumpleton 1.8k Jan 06, 2023
A patch and keygen tools for typora.

A patch and keygen tools for typora.

Mason Shi 1.4k Apr 12, 2022
Wagtail + Lottie is a Wagtail package for playing Adobe After Effects animations exported as json with Bodymovin.

Wagtail Lottie Wagtail + Lottie is a Wagtail package for playing Adobe After Effects animations exported as json with Bodymovin. Usage Export your ani

Alexis Le Baron 7 Aug 18, 2022
Python project that aims to discover CDP neighbors and map their Layer-2 topology within a shareable medium like Visio or Draw.io.

Python project that aims to discover CDP neighbors and map their Layer-2 topology within a shareable medium like Visio or Draw.io.

3 Feb 11, 2022
ThinkPHP全日志扫描工具,命令行版和BurpSuite插件版

ThinkPHP3和5日志扫描工具,提供命令行版和BurpSuite插件版,尽可能全的发掘网站日志信息 命令行版 安装 git clone https://github.com/r3change/TPLogScan.git cd TPLogScan/ pip install -r requireme

119 Dec 27, 2022
Telop - Encode and decode messages using an interpretation of the telegraphic code devised by José María Mathé

telop Telop (TELégrafoÓPtico) - Utilidad para codificar y descodificar mensajes de texto empleando una interpretación del código telegráfico ideado po

Ricardo F. 4 Nov 01, 2022
A pairs trade is a market neutral trading strategy enabling traders to profit from virtually any market conditions.

A pairs trade is a market neutral trading strategy enabling traders to profit from virtually any market conditions. This strategy is categorized as a statistical arbitrage and convergence trading str

Kanupriya Anand 13 Nov 27, 2022
Expense-manager - Expense manager with python

Expense_manager TO-DO Source extractor: Credit Card, Wallet Destination extracto

1 Feb 13, 2022
Automate your Microsoft Learn Student Ambassadors event certificate with Python

Microsoft Learn Student Ambassador Certificate Automation This repo simply use a template certificate docx file and generates certificates both docx a

Muhammed Oğuz 24 Aug 24, 2022
Commodore 64 OS running on Atari 8-bit hardware

This is the Commodre 64 KERNAL, modified to run on the Atari 8-bit line of computers. They're practically the same machine; why didn't someone try this 30 years ago?

Nick Bensema 133 Nov 12, 2022
An early stage integration of Hotwire Turbo with Django

Note: This is not ready for production. APIs likely to change dramatically. Please drop by our Slack channel to discuss!

Hotwire for Django 352 Jan 06, 2023
Customizable-menu-python - User customizable menu in Python

Menu personalizável pelo usuário em Python A minha ideia com esse projeto pessoa

Renan Barbosa 4 Oct 28, 2022
A basic DIY-project made using Python and MySQL

Banking-Using-Python-MySQL This is a basic DIY-project made using Python and MySQL. Pre-Requisite needed:-- MySQL command Line:- creating a database

ABHISHEK 0 Jul 03, 2022
Python programming language Test

Exercise You are tasked with creating a data-processing app that pre-processes and enriches the data coming from crawlers, with the following requirem

Monirul Islam Khan 1 Dec 13, 2021
ioztat is a storage load analysis tool for OpenZFS

ioztat is a storage load analysis tool for OpenZFS. It provides iostat-like statistics at an individual dataset/zvol level.

Jim Salter 116 Nov 25, 2022
Fithub is a website application for athletes and fitness enthusiasts of all ages and experience levels.

Fithub is a website application for athletes and fitness enthusiasts of all ages and experience levels. Our website allows users to easily search, filter, and sort our comprehensive database of over

Andrew Wu 1 Dec 13, 2021
Simple script to match riders with drivers.

theBestPooler Simple script to match riders with drivers. It's a greedy, unoptimised search, so no guarantees that it works. It just seems to work (ve

Devansh 1 Nov 22, 2021
Traditionally, there is considerable friction for developers when setting up development environments

This self-led, half-day training will teach participants the patterns and best practices for working with GitHub Codespaces

CSE Labs at Spark 12 Dec 02, 2022
Create standalone, installable R Shiny apps using Electron

WARNING This is still very much a work in progress and nothing can be assumed stable in any way Temp notes: Two types of created installer, based on w

Chase Clark 5 Dec 24, 2021