Learning-Python-Team/Chess

`Board.move` moves the other player

Closed this issue · 4 comments

This should speak for itself:

>> chess
  |
8 |  ♜    ♞    ♝    ♛    ♚    ♝    ♞    ♜
  |
7 |  ♟    ♟    ♟    ♟    ♟    ♟    ♟    ♟
  |
6 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
5 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
4 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
3 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
2 |  ♙    ♙    ♙    ♙    ♙    ♙    ♙    ♙
  |
1 |  ♖    ♘    ♗    ♕    ♔    ♗    ♘    ♖
--+-------------------------------------------
  |  a    b    c    d    e    f    g    h

white: a2 a3

  |
1 |  ♖    ♘    ♗    ♔    ♕    ♗    ♘    ♖
  |
2 |  ♙    ♙    ♙    ♙    ♙    ♙    ♙    ♙
  |
3 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
4 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
5 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
6 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ♟
  |
7 |  ♟    ♟    ♟    ♟    ♟    ♟    ♟    ☐
  |
8 |  ♜    ♞    ♝    ♚    ♛    ♝    ♞    ♜
--+-------------------------------------------
  |  a    b    c    d    e    f    g    h

Black starts his turn with his pieces moved. This is caused by a2 a3 being translated internally to ( (1, 0), (2, 0) ), which is at the top of the board from White's point of view. This needs to dynamically change.

So, when I play with it, the letters flip, but the numbers don't. I can't figure out why. I think it's because the numbers are printing the range destination and aren't easily flipped. If they were printed more explicitly, maybe they would reverse easier.

Works on mine... Check the pull request. But I'll check it out

Here's what I get:

  |
8 |  ♜    ♞    ♝    ♛    ♚    ♝    ♞    ♜
  |
7 |  ♟    ♟    ♟    ♟    ♟    ♟    ♟    ♟
  |
6 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
5 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
4 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
3 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
2 |  ♙    ♙    ♙    ♙    ♙    ♙    ♙    ♙
  |
1 |  ♖    ♘    ♗    ♕    ♔    ♗    ♘    ♖
--+-------------------------------------------
  |  a    b    c    d    e    f    g    h

White: a2 a3
True
  |
1 |  ♖    ♘    ♗    ♔    ♕    ♗    ♘    ♖
  |
2 |  ♙    ♙    ♙    ♙    ♙    ♙    ♙    ☐
  |
3 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ♙
  |
4 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
5 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
6 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
7 |  ♟    ♟    ♟    ♟    ♟    ♟    ♟    ♟
  |
8 |  ♜    ♞    ♝    ♚    ♛    ♝    ♞    ♜
--+-------------------------------------------
  |  h    g    f    e    d    c    b    a

Black: h7 h6
True
  |
8 |  ♜    ♞    ♝    ♛    ♚    ♝    ♞    ♜
  |
7 |  ♟    ♟    ♟    ♟    ♟    ♟    ♟    ☐
  |
6 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ♟
  |
5 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
4 |  ☐    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
3 |  ♙    ☐    ☐    ☐    ☐    ☐    ☐    ☐
  |
2 |  ☐    ♙    ♙    ♙    ♙    ♙    ♙    ♙
  |
1 |  ♖    ♘    ♗    ♕    ♔    ♗    ♘    ♖
--+-------------------------------------------
  |  a    b    c    d    e    f    g    h

Closed with #14