checkers icon indicating copy to clipboard operation
checkers copied to clipboard

TypeError: unsupported operand type(s) for <<

Open julienroyd opened this issue 7 years ago • 1 comments

When I run game.py with either arthur or random_agent, I get the following error :

Traceback (most recent call last):
  File "game.py", line 237, in <module>
    status = main()
  File "game.py", line 168, in main
    B.make_move(cpu_1.make_move(B))
  File "C:\Users\julro\Desktop\Coding\DeepCheckers\checkers-master\checkers.py", line 66, in make_move
    taken_piece = int(1 << sum(i for (i, b) in enumerate(bin(move)[::-1]) if b == '1')/2)
TypeError: unsupported operand type(s) for <<: 'int' and 'float'

It doesn't always occur on the same line but it's always that same TypeError

julienroyd avatar Apr 03 '18 16:04 julienroyd

You're probably using Python 3, in Python 3 the / operator is a floating point division, change it to // instead for integer division.

SentinelWarren avatar Dec 19 '18 21:12 SentinelWarren