Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors Thrown on Certain In-Place Operations #125

Open
pashneal opened this issue Apr 21, 2020 · 0 comments
Open

Errors Thrown on Certain In-Place Operations #125

pashneal opened this issue Apr 21, 2020 · 0 comments
Labels

Comments

@pashneal
Copy link

pashneal commented Apr 21, 2020

def turn():
    i = 1

    #commented lines produce an error
    #uncommented lines work just fine
    i += 1
    i -= 1000
    i *= 500
    i /= 500
    i = i // 500
    #i //= 500

    i = 50
    i = i << 1
    #i <<= 1
    i = i >> 1
    #i >>= 1
    i = i % 1
    #i %= 1

    i = {0,1,2,3,4,5}
    #i ^= { 1 }
    i = i ^ {1}
    #i |= {0}
    i = i | {0}
    # i &= i
    i = i & i

It seems that only the most common operations have their equivalent in place operation allowed.
The following error is produced:

File "/home/user/.local/lib/python3.6/site-packages/battlehack20/engine/container/runner.py", line 218, in do_turn
    exec(self.locals['turn'].__code__, self.globals, self.locals)
  File "bot.py", line 26, in turn
    i &= i
  File "/home/user/.local/lib/python3.6/site-packages/battlehack20/engine/container/runner.py", line 122, in inplacevar_call
    raise SyntaxError('Unsupported in place op "' + op + '".')
  File "<string>", line None
SyntaxError: Unsupported in place op "&=".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants