Git Product home page Git Product logo

joueur.py's Introduction

Python 3 Joueur Client

This is the client for the Cadre AI framework. It can play multiple different games, though you will probably only be interested in one at a time.

In general, try to stay out of the joueur/ folder, it does most of the heavy lifting to play on our game servers. Your AI, and the game objects it manipulates are all in games/game_name/, with your very own AI living in Games/game_name/ai.py for you to make smarter.

How to Run

This client has been tested and confirmed to work on the Campus rc##xcs213 Linux machines, but it can work on your own Windows/Linux/Mac machines if you desire.

Linux

./testRun MyOwnGameSession

For Linux, a recent version of python3 should work. It has been tested on 3.4.3 extensively, but should work with >= 3.2. The normal 'python' usually refers to Python 2.7.X, so make sure you have the python3 installed.

Windows

On Windows you'll need some version of Python 3. As with the Linux version, 3.4.3 has been tested against extensively, however there's no none reason why it would not work on newer versions. Install that and ensure that python is set up in your Environmental Variables as 'python3', then

python3 main.py GAME_NAME -s game.siggame.io -r MyOwnGameSession

Make

There is a Makefile provided. Although Python is an interpreted language, we have added some useful default steps. By default it installs all pip packges you add to requirements.txt, and then runs the Python compiler on all .py files to make sure they are syntactically correct.

Other Notes

MST S-Drive

If you are using this on the Missouri S&T Campus, it is possible that on your Missouri S&T S-Drive this client will not run properly. This is not a fault with the client, but rather the school's S-Drive implementation changing some file permissions during run time. We cannot control this. Instead, we recommend cloning your repo outside the S-Drive and use an SCP program like WinSCP to edit the files in Windows using whatever IDE you want if you want to code in Windows, but compile in Linux.

Modifying Our Game Files

The only file you should ever modify to create your AI is the ai.py file. All the other files are needed for the game to work. In addition, you should never be creating your own instances of the Game's classes, nor should you ever try to modify their variables. Instead, treat the Game and its members as a read only structure that represents the game state on the game server. You interact with it by calling the game functions.

Importing new files for your AI

Because your AI lives in the games/game_name/ directory, if you add new files in that directory, then you must import them relative to the root of this directory. For example, this means if you add a new file games/game_name/foo.py, then you must import it via the python code:

import games.game_name.foo

Please do not try to import it via import foo, that will not work. (unless you add it to the root of this repo, then it will but that seems a bit strange).

joueur.py's People

Contributors

jacobfischer avatar jawbone999 avatar jeffreystrahm avatar jzaustin295 avatar reginaldjefferywatson avatar tarnasa avatar tehpers avatar user404d avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

joueur.py's Issues

Makefile doesn't see linked Python versions

So I installed the newest python version for the arena

wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
tar -xzvf Python-3.7.3.tgz
cd Python-3.7.3
mkdir build
cd build
../configure --enable-optimizations --with-ensurepip=install
make -j8
make altinstall
update-alternatives --install /usr/bin/python python /usr/local/bin/python3.7 50
alias pip=pip3.7
alias pip3=pip3.7
alias python3=python

but makefiles do not see the symbolic links that update-alternatives and alias provides -- therefore "make" will fail with

pip3: unknown command

What does work is if you replace pip3 in the makefile with

pip3.7

and python3 in the makefile with

python3.7

?? Is there a better way to get around this? I think for the competition I will tell people to change their make file.

Provide documentation on importing files

Users of the client have tried to import their own files locally, but imported files have to be pre-pended with games.GAME_NAME because it is relative to main.py's location. Adding clarification about this in the README or elsewhere would help to reduce the chance of this occurring.

Add syntax checking to makefile

Currently make is intended to "compile" the clients.

Python does not need this, but it could do basic syntax checking, as if the code is invalid it will not run when the time comes.

PEP8 compliant creer templates.

Currently there is no 80 width limiter for the creer templates. Use TextWrapper to wrap long lines. Then it should be full compliant.

If there are other PEP8 errors fix them too; though I think I already did that a while back.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.