Skip to content

Commit

Permalink
Clean project
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelGoncalvesUA committed Jan 25, 2023
1 parent bff178e commit ba40f6d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 31 deletions.
51 changes: 23 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
# ia-rush
# "Rush Hour" - Agente Inteligente

Projecto de Inteligência Artificial 2022 - Rush Hour
No projeto prático de Inteligência Artificial, os alunos foram desafiados a implementar um agente inteligente, capaz de resolver autonomamente os níveis do jogo Rush Hour, cujo código fonte foi disponibilizado pelo Prof. Diogo Gomes.

## How to install
Este jogo 2D consiste num quebra-cabeças de blocos deslizantes, em que o objetivo é mover o "carro" vermelho para "fora da garagem", isto é, mover o bloco para o limite direito da área de jogo (de dimensão variável). Para esse efeito, é necessário desimpedir o caminho, alterando a posição dos outros carros.

Make sure you are running Python 3.7 or higher
<div style="text-align:center">
<img src="https://www.michaelfogleman.com/static/rush/top15.png?bust=1531758494" width="300">
</div>

`$ pip install -r requirements.txt`

_Tip: you might want to create a virtualenv first_

## How to play

open 3 terminals:
**Fonte**: [https://www.michaelfogleman.com/static/rush/](https://www.michaelfogleman.com/static/rush/)

`$ python3 server.py`

`$ python3 viewer.py`

`$ python3 client.py`
## Explicação dos algoritmos implementados
Encontra-se no ficheiro [presentation.pdf](presentation.pdf)

to play using the sample client make sure the client pygame window has focus
## Instalação de dependências

### Keys

Directions: arrows

## Debug Installation

Make sure pygame is properly installed:
`$ pip install -r requirements.txt`

python -m pygame.examples.aliens
_Recomenda-se a criação de um ambiente virtual (virtualenv)._

# Tested on:
## Execução do projeto
Servidor:
`$ python3 server.py`

- OSX Monterey 12.5.1
*Viewer*:
`$ python3 viewer.py`

# Tested on:
Cliente:
- `$ python3 client.py` (para jogar manualmente com as setas)
- `$ python3 student.py` (para correr o agente inteligente)

- OSX Monterey 12.5.1
## Créditos
- Rafael Gonçalves (102534)
- André Butuc (103530)
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions tree_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def main():
SKIP_CONTEXTS = {} # ex.: SKIP_CONTEXTS = [("levels2", "depth"")]

for LEVELS_PACK in LEVELS_PACKS:
with open(LEVELS_PACK + ".txt", "r") as f, open(f"benchmarks/{LEVELS_PACK}/hybrid.csv", "w") as fout:
with open("levels/" + LEVELS_PACK + ".txt", "r") as f, open(f"benchmarks/{LEVELS_PACK}/hybrid.csv", "w") as fout:
levels = f.readlines()
total_time = 0.0
total_moves = 0
Expand All @@ -377,7 +377,7 @@ def main():
for STRATEGY in STRATEGIES:
if (LEVELS_PACK, STRATEGY) in SKIP_CONTEXTS:
continue
with open(LEVELS_PACK + ".txt", "r") as f, open(f"benchmarks/{LEVELS_PACK}/{STRATEGY}.csv", "w") as fout:
with open("levels/" + LEVELS_PACK + ".txt", "r") as f, open(f"benchmarks/{LEVELS_PACK}/{STRATEGY}.csv", "w") as fout:
levels = f.readlines()
total_time = 0.0
total_moves = 0
Expand Down Expand Up @@ -415,4 +415,4 @@ def main():
print()

if __name__ == "__main__":
main()
main()

0 comments on commit ba40f6d

Please sign in to comment.