Giter VIP home page Giter VIP logo

python-warrior's People

Contributors

arbylee avatar fjorgemota avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

python-warrior's Issues

Rename .profile

Change the name to minimize name conflicts as users may run pythonwarrior from a location that already has a non-pythwarrior .profile

pythonwarrior fails to launch

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

AttributeError: 'Turn' object has no attribute 'feel'

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'

Error during fisrt run

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'

Something wrong at beginner level 2

 (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?

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.