bez komentarzy
This commit is contained in:
parent
9b1699d65b
commit
60b15d7996
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,9 +1,7 @@
|
||||
from piece import Piece
|
||||
from board import Board
|
||||
from square import Square
|
||||
from abc import abstractmethod
|
||||
class Bishop(Piece):
|
||||
@abstractmethod
|
||||
def straightline_moves(self, piece, row, column, isvertical):
|
||||
if isvertical is True:
|
||||
self.direction = [
|
||||
|
2
board.py
2
board.py
@ -21,7 +21,7 @@ class Board:
|
||||
self.other_row = 0
|
||||
#pawns
|
||||
for column in range(8):
|
||||
self.boardlist[self.pawn_row][column] = Square(self.pawn_row, column, Piece("pawn", color)) #do kazdego square przypisuje poczatkowy pawn
|
||||
self.boardlist[self.pawn_row][column] = Square(self.pawn_row, column, Piece("pawn", color))
|
||||
#rooks
|
||||
self.boardlist[self.other_row][0] = Square(self.other_row, 0, Piece("rook", color))
|
||||
self.boardlist[self.other_row][7] = Square(self.other_row, 7, Piece("rook", color))
|
||||
|
1
game.py
1
game.py
@ -71,7 +71,6 @@ class Game:
|
||||
for column in range(8):
|
||||
if self.board.boardlist[row][column].has_piece():
|
||||
self.piece = self.board.boardlist[row][column].piece
|
||||
#self.board.calc_moves(self.board.boardlist[row][column].piece, row, column)
|
||||
Move.calc_moves(self, self.piece, row, column)
|
||||
def nextMove(self, ruch):
|
||||
self.currently_available_moves()
|
||||
|
2
king.py
2
king.py
@ -1,9 +1,7 @@
|
||||
from piece import Piece
|
||||
from board import Board
|
||||
from square import Square
|
||||
from abc import abstractmethod
|
||||
class King(Piece):
|
||||
@abstractmethod
|
||||
def king_moves(self, piece, row, column):
|
||||
self.direction = [
|
||||
(0, 1),
|
||||
|
@ -1,9 +1,7 @@
|
||||
from piece import Piece
|
||||
from board import Board
|
||||
from square import Square
|
||||
from abc import abstractmethod
|
||||
class Knight(Piece):
|
||||
@abstractmethod
|
||||
def knight_moves(self, piece, row, column):
|
||||
self.possible_moves = [
|
||||
(row + 2, column - 1),
|
||||
|
2
main.py
2
main.py
@ -5,9 +5,7 @@ game2 = Game()
|
||||
#game2.printBoard()
|
||||
ruch=None
|
||||
while True:
|
||||
#print(ruch)
|
||||
ruch = game.nextMove(ruch)
|
||||
game.printBoard()
|
||||
#print(ruch)
|
||||
ruch = game2.nextMove(ruch)
|
||||
game2.printBoard()
|
15
move.py
15
move.py
@ -9,7 +9,8 @@ from king import King
|
||||
import random
|
||||
|
||||
class Move:
|
||||
|
||||
def szach(self):
|
||||
pass
|
||||
def move_rival(self, ruch):
|
||||
self.from_column = Move.letters_to__numbers(ruch[0])
|
||||
self.from_row = int(ruch[1])
|
||||
@ -27,6 +28,7 @@ class Move:
|
||||
return self.board.boardlist[self.to_row][self.to_column].piece.color
|
||||
|
||||
def move_boot(self, color):
|
||||
#move.szach(self, color)
|
||||
self.x, self.initial_row, self.initial_column, self.final_row, self.final_column = Move.random_valid_move(self, color)
|
||||
self.board.boardlist[self.initial_row][self.initial_column].piece = None
|
||||
Move.mat(self, self.x, self.final_row, self.final_column)
|
||||
@ -67,7 +69,8 @@ class Move:
|
||||
return self.x, self.move_initial_row, self.move_initial_column, self. move_final_row, self.move_final_column
|
||||
|
||||
def calc_moves(self, piece, row, column):
|
||||
piece.valid_moves=[]
|
||||
piece.delete_moves()
|
||||
#piece.valid_moves=[]
|
||||
if piece.name == 'rook':
|
||||
Rook.straightline_moves(self, piece, row, column,True)
|
||||
pass
|
||||
@ -94,12 +97,10 @@ class Move:
|
||||
def mat(self, x, final_row, final_column):
|
||||
if self.board.boardlist[final_row][final_column].has_piece():
|
||||
if self.board.boardlist[final_row][final_column].piece.name == 'king':
|
||||
#print(final_column, final_row)
|
||||
#print(x)
|
||||
#print(x.color)
|
||||
#print(self.board.boardlist[final_row][final_column].piece.color)
|
||||
#self.board.boardlist[final_row][final_column].piece = x
|
||||
exit(0)
|
||||
#def szach(self,color):
|
||||
# for
|
||||
|
||||
@staticmethod
|
||||
def numbers_to_letters(number):
|
||||
if number == 0:
|
||||
|
2
pawn.py
2
pawn.py
@ -1,9 +1,7 @@
|
||||
from piece import Piece
|
||||
from board import Board
|
||||
from square import Square
|
||||
from abc import abstractmethod
|
||||
class Pawn(Piece):
|
||||
@abstractmethod
|
||||
def pawn_moves(self, piece, row, column):
|
||||
if piece.moved == True:
|
||||
self.steps = 1
|
||||
|
3
piece.py
3
piece.py
@ -13,3 +13,6 @@ class Piece:
|
||||
|
||||
def delete_moves(self):
|
||||
self.valid_moves = []
|
||||
|
||||
#def czy_szachuje(self, row, column, color):
|
||||
# self.ruch=[]
|
||||
|
2
queen.py
2
queen.py
@ -1,9 +1,7 @@
|
||||
from piece import Piece
|
||||
from board import Board
|
||||
from square import Square
|
||||
from abc import abstractmethod
|
||||
class Queen(Piece):
|
||||
@abstractmethod
|
||||
def straightline_moves(self, piece, row, column, isvertical):
|
||||
if isvertical is True:
|
||||
self.direction = [
|
||||
|
2
rook.py
2
rook.py
@ -1,9 +1,7 @@
|
||||
from piece import Piece
|
||||
from board import Board
|
||||
from square import Square
|
||||
from abc import abstractmethod
|
||||
class Rook(Piece):
|
||||
@abstractmethod
|
||||
def straightline_moves(self, piece, row, column, isvertical):
|
||||
if isvertical is True:
|
||||
self.direction = [
|
||||
|
Loading…
Reference in New Issue
Block a user