davide-ceretti / strategypy

A strategy game for Python bots with replaceable front ends
MIT License
36 stars 11 forks source link

Add Python3.4 compatibility #32

Closed raulcd closed 9 years ago

raulcd commented 9 years ago

Compatibility for Python3 to strategypy. ./play.sh currently works for both python2 and python3 with this changes Currently tox passes tests on both python2 and 3:

raulcd@strategypy (feature/python3_compatibility) $ tox
GLOB sdist-make: /Users/raulcd/strategypy/setup.py
py27 inst-nodeps: /Users/raulcd/strategypy/.tox/dist/strategypy-0.2.1.zip
py27 runtests: PYTHONHASHSEED='2906404891'
py27 runtests: commands[0] | py.test -s
================================================================================ test session starts ================================================================================
platform darwin -- Python 2.7.9 -- py-1.4.26 -- pytest-2.6.4
collected 19 items

tests/test_integration.py ...................

============================================================================= 19 passed in 0.16 seconds =============================================================================
py34 inst-nodeps: /Users/raulcd/strategypy/.tox/dist/strategypy-0.2.1.zip
py34 runtests: PYTHONHASHSEED='2906404891'
py34 runtests: commands[0] | py.test -s
================================================================================ test session starts ================================================================================
platform darwin -- Python 3.4.2 -- py-1.4.26 -- pytest-2.6.4
collected 19 items

tests/test_integration.py ...................

============================================================================= 19 passed in 0.18 seconds =============================================================================
______________________________________________________________________________________ summary ______________________________________________________________________________________
  py27: commands succeeded
  py34: commands succeeded
  congratulations :)
raulcd commented 9 years ago

Support for consolefe.py added. See below the output with python3:

(strategypy3)raulcd@strategypy (feature/python3_compatibility)* $ strategypy davide happiness | python strategypy/consolefe.py
Player davide won in 70 turns
Initial unit count: 20
Final unit count: 9
Player happiness killed: davide x 1,
Player davide killed: happiness x 10,
Player happiness was killed by: davide x 10,
Player davide was killed by: happiness x 1,
(strategypy3)raulcd@strategypy (feature/python3_compatibility)* $

Also tested with Python2

davide-ceretti commented 9 years ago

Looks good. A couple of minor things:

raulcd commented 9 years ago

@davide-ceretti I've added on the last commit this minor changes. I can expand on the README if you want but I suppose indicating that system dependencies are python2.7 or python3.4 is enough. Let me know if you want me to expand on it.

davide-ceretti commented 9 years ago

:+1: Thanks!