arbylee / python-warrior Goto Github PK
View Code? Open in Web Editor NEWPython implementation of ruby-warrior
Home Page: https://pypi.python.org/pypi/pythonwarrior
License: Other
Python implementation of ruby-warrior
Home Page: https://pypi.python.org/pypi/pythonwarrior
License: Other
Change the name to minimize name conflicts as users may run pythonwarrior from a location that already has a non-pythwarrior .profile
Hi,
Maybe it's a bit late for opening an issue an on old repo :)
Though I encountered this :
pythonwarrior โ no config
Traceback (most recent call last):
File "/usr/sbin/pythonwarrior", line 16, in <module>
from pythonwarrior import runner
File "/usr/lib/python3.8/site-packages/pythonwarrior/runner.py", line 4, in <module>
from pythonwarrior.game import Game
File "/usr/lib/python3.8/site-packages/pythonwarrior/game.py", line 5, in <module>
from pythonwarrior.level import Level
File "/usr/lib/python3.8/site-packages/pythonwarrior/level.py", line 5, in <module>
from pythonwarrior.level_loader import LevelLoader
File "/usr/lib/python3.8/site-packages/pythonwarrior/level_loader.py", line 12, in <module>
from pythonwarrior.units.warrior import Warrior
File "/usr/lib/python3.8/site-packages/pythonwarrior/units/warrior.py", line 36
print "earns %d points" % points
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("earns %d points" % points)?
Thanks
Hi there, trying to run this with the default sample code:
class Player(object):
def play_turn(self, warrior):
if warrior.feel().is_enemy():
warrior.attack_()
else:
warrior.walk_()
and getting this output:
$ pythonwarrior
Welcome to Python Warrior
[1] Roland - beginner - level 1 - score 0
[2] New Profile
Choose profile by typing the number: 1
Starting level 1
- turn 1 -
--------
|@ >|
--------
Traceback (most recent call last):
File "/usr/bin/pythonwarrior", line 20, in <module>
runner.run()
File "/usr/lib/python2.7/site-packages/pythonwarrior/runner.py", line 19, in run
self.game.start()
File "/usr/lib/python2.7/site-packages/pythonwarrior/game.py", line 32, in start
self.play_normal_mode()
File "/usr/lib/python2.7/site-packages/pythonwarrior/game.py", line 71, in play_normal_mode
self.play_current_level()
File "/usr/lib/python2.7/site-packages/pythonwarrior/game.py", line 76, in play_current_level
self.current_level().play()
File "/usr/lib/python2.7/site-packages/pythonwarrior/level.py", line 65, in play
unit.prepare_turn()
File "/usr/lib/python2.7/site-packages/pythonwarrior/units/base.py", line 77, in prepare_turn
self.play_turn(self.current_turn)
File "/usr/lib/python2.7/site-packages/pythonwarrior/units/warrior.py", line 20, in play_turn
return self.player().play_turn(turn)
File "./pythonwarrior/roland-beginner/player.py", line 3, in play_turn
if warrior.feel().is_enemy():
AttributeError: 'Turn' object has no attribute 'feel'
I can't start the game.
After installing the game with pip, I get this error when I execute pythonwarrior:
Traceback (most recent call last):
File "/usr/local/bin/pythonwarrior", line 20, in <module>
runner.run()
File "/usr/local/lib/python2.7/dist-packages/pythonwarrior/runner.py", line 19, in run
self.game.start()
File "/usr/local/lib/python2.7/dist-packages/pythonwarrior/game.py", line 21, in start
self._profile = Profile.load(Config.path_prefix + '/.profile')
File "/usr/local/lib/python2.7/dist-packages/pythonwarrior/profile.py", line 43, in load
player = Profile.decode(f.read())
File "/usr/local/lib/python2.7/dist-packages/pythonwarrior/profile.py", line 38, in decode
return pickle.loads(base64.b64decode(encoded_profile))
File "/usr/lib/python2.7/pickle.py", line 1382, in loads
return Unpickler(file).load()
File "/usr/lib/python2.7/pickle.py", line 858, in load
dispatch[key](self)
KeyError: '\xfe'
(py)liubiantao@liubiantao-ThinkPad:~/youxi/pythonwarrior/liubiantao-beginner$ pythonwarrior
Welcome to Python Warrior
Starting level 2
- turn 1 -
--------
|@ s >|
--------
Traceback (most recent call last):
File "/home/liubiantao/youxi/py/bin/pythonwarrior", line 20, in <module>
runner.run()
File "/home/liubiantao/youxi/py/local/lib/python2.7/site-packages/pythonwarrior/runner.py", line 19, in run
self.game.start()
File "/home/liubiantao/youxi/py/local/lib/python2.7/site-packages/pythonwarrior/game.py", line 32, in start
self.play_normal_mode()
File "/home/liubiantao/youxi/py/local/lib/python2.7/site-packages/pythonwarrior/game.py", line 71, in play_normal_mode
self.play_current_level()
File "/home/liubiantao/youxi/py/local/lib/python2.7/site-packages/pythonwarrior/game.py", line 76, in play_current_level
self.current_level().play()
File "/home/liubiantao/youxi/py/local/lib/python2.7/site-packages/pythonwarrior/level.py", line 65, in play
unit.prepare_turn()
File "/home/liubiantao/youxi/py/local/lib/python2.7/site-packages/pythonwarrior/units/base.py", line 77, in prepare_turn
self.play_turn(self.current_turn)
File "/home/liubiantao/youxi/py/local/lib/python2.7/site-packages/pythonwarrior/units/warrior.py", line 20, in play_turn
return self.player().play_turn(turn)
File "/home/liubiantao/youxi/py/local/lib/python2.7/site-packages/pythonwarrior/units/warrior.py", line 26, in player
import player
File "./player.py", line 3
if warrior.feel().is_empty()
^
SyntaxError: invalid syntax
Here's python.py
class Player(object):
def play_turn(self, warrior):
if warrior.feel().is_empty()
warrior.walk_()
else
warrior.attack_()
I just starting learn python,is this my fault?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.