Skip to content

Commit 1404db2

Browse files
committed
Ran reindent
1 parent 2c2aaa9 commit 1404db2

File tree

5 files changed

+25
-24
lines changed

5 files changed

+25
-24
lines changed

README

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ Turns out that programming a chess game is no trivial task,
99
so I've tried to make it as modular and as easy as possible.
1010

1111
Contains:
12-
* dict-based board representation
13-
* move validation
14-
* Console-based Unicode GUI
15-
* TkInter GUI
12+
* dict-based board representation
13+
* move validation
14+
* Console-based Unicode GUI
15+
* TkInter GUI
1616

1717
Requirements:
18-
* Python 2.5+
19-
* TkInter
20-
* PIL
18+
* Python 2.5+
19+
* TkInter
20+
* PIL
2121

2222
To install the dependancies on debian/ubuntu run:
23-
sudo apt-get install python-tk python-imaging python-imaging-tk
23+
sudo apt-get install python-tk python-imaging python-imaging-tk
2424

2525
TODO:
26-
* En passant
27-
* Pawn promotion
28-
* Fifty-move rule
29-
* Tests
30-
* Scalable GUI window
26+
* En passant
27+
* Pawn promotion
28+
* Fifty-move rule
29+
* Tests
30+
* Scalable GUI window

chess

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#!/usr/bin/env python
2-
3-
from chesslib import board
4-
52
import os
63
import sys
74

5+
if sys.version_info[0] > 2:
6+
print("This game runs on python 2 only")
7+
8+
9+
from chesslib import board
10+
811
# Load a save if it exists
912

1013
if os.path.exists("state.fen"):
@@ -29,4 +32,3 @@ except ImportError:
2932
from chesslib.gui_console import display
3033
else:
3134
display(game)
32-

chesslib/board.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ def move(self, p1, p2):
8181

8282
# If enemy has any moves look for check
8383
if self.all_possible_moves(enemy):
84-
if self.is_in_check_after_move(p1,p2):
85-
raise Check
84+
if self.is_in_check_after_move(p1,p2):
85+
raise Check
8686

8787
if not possible_moves and self.is_in_check(piece.color):
8888
raise CheckMate
@@ -154,7 +154,7 @@ def occupied(self, color):
154154

155155
for coord in self:
156156
if self[coord].color == color:
157-
result.append(coord)
157+
result.append(coord)
158158
return result
159159

160160
def is_king(self, piece):

chesslib/gui_console.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def move(self):
3434
os.system("clear")
3535
except board.ChessError as error:
3636
self.error = "Error: %s" % error.__class__.__name__
37-
37+
3838
self.move()
3939

4040
def unicode_representation(self):
@@ -57,4 +57,3 @@ def display(board):
5757
except (KeyboardInterrupt, EOFError):
5858
os.system("clear")
5959
exit(0)
60-

chesslib/gui_tkinter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def move(self, p1, p2):
8585
self.label_status["text"] = error.__class__.__name__
8686
else:
8787
self.label_status["text"] = " " + piece.color.capitalize() +": "+ p1 + p2
88-
88+
8989

9090
def hilight(self, pos):
9191
piece = self.chessboard[pos]
@@ -156,7 +156,7 @@ def reset(self):
156156
def display(chessboard):
157157
root = tk.Tk()
158158
root.title("Simple Python Chess")
159-
159+
160160
gui = BoardGuiTk(root, chessboard)
161161
gui.pack(side="top", fill="both", expand="true", padx=4, pady=4)
162162
gui.draw_pieces()

0 commit comments

Comments
 (0)