Skip to content

user-cube/AI_Pacman

Repository files navigation

Artificial Inteligence - Pacman

Client-Server PACMAN game using A*.

Install

  • Clone this repository
  • Create a virtual environment:
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
  • Intall xterm:

Ubuntu based:

$ sudo apt update
$ sudo apt install xterm

Fedora:

$ sudo dnf update
$ sudo dnf install xterm

Arch based:

$ yaourt xterm

How to run:

Run:

source venv/bin/actibate

After that execute:

$ ./run.sh

Multiple executions

Open 2 terminals and run:

Terminal 1:

$ ./deployServer.sh

Terminal 2:

$ python3 multiple.py

Runing into Raspberry Pi

If you are running into a Raspberry Pi you should consider use python 3.7.

Show me how to do it!

Upgrading to Python 3.7.0

First install the dependencies needed to build.

$ sudo apt-get update
$ sudo apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev

Compile (takes a while!)

$ wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
$ tar xf Python-3.7.0.tar.xz
$ cd Python-3.7.0
$ ./configure --prefix=/usr/local/opt/python-3.7.0
$ make -j 4

Install

$ sudo make altinstall

Make Python 3.7 the default version, make aliases.

$ sudo ln -s /usr/local/opt/python-3.7.0/bin/pydoc3.7 /usr/bin/pydoc3.7
$ sudo ln -s /usr/local/opt/python-3.7.0/bin/python3.7 /usr/bin/python3.7
$ sudo ln -s /usr/local/opt/python-3.7.0/bin/python3.7m /usr/bin/python3.7m
$ sudo ln -s /usr/local/opt/python-3.7.0/bin/pyvenv-3.7 /usr/bin/pyvenv-3.7
$ sudo ln -s /usr/local/opt/python-3.7.0/bin/pip3.7 /usr/bin/pip3.7

Now it's time to open .bashrc and make aliases.

$ vim ~/.bashrc

And add the following lines:

alias python='/usr/bin/python3.7'
alias python3='/usr/bin/python3.7'

Now you can delete the source folder of python.

$ cd ..
$ sudo rm -r Python-3.7.0
$ rm Python-3.7.0.tar.xz

Compile PyGame on Raspberry Pi

Install dependencies:

$ sudo apt-get install git python3-dev python3-setuptools python3-numpy python3-opengl \
    libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev \
    libsdl1.2-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev \
    libtiff5-dev libx11-6 libx11-dev fluid-soundfont-gm timgm6mb-soundfont \
    xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic fontconfig fonts-freefont-ttf libfreetype6-dev

Grab source

$ wget https://github.com/pygame/pygame/archive/1.9.4.zip
$ unzip 1.9.4.zip
$ mv pygame-1.9.4/ pygame

Finally build and install

$ cd pygame
$ python3.7 setup.py build
$ sudo python3 setup.py install

Now run (takes a while):

$ pip install -r requirements.txt

Credits

Sprites from https://github.com/rm-hull/big-bang/tree/master/examples/pacman/data

Releases

No releases published

Packages

No packages published