Click here to Skip to main content
15,867,870 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
def resetBoard(self):
    # Initializw Black Pieces
    # self.board[0][0] = Spot(0,0,piece)  # black rooks
    self.board[0][1] = Spot(0, 1, piece)  # black knight
    # self.board[0][2] = Spot(0,2,piece)  # black bishops
    # self.board[0][3] = Spot(0,3,piece)  # black queens
    self.board[0][4] = Spot(0, 4, piece)  # black king
    # self.board[0][5] = Spot(0,5,piece)  # black bishops
    self.board[0][6] = Spot(0, 6, piece)  # black knight
    # self.board[0][7] = Spot(0,7,piece)  # black rooks
    self.board[1][0] = Spot(1, 0, piece)  # black pawn
    self.board[1][1] = Spot(1, 1, piece)  # black pawn
    self.board[1][2] = Spot(1, 2, piece)  # black pawn
    self.board[1][3] = Spot(1, 3, piece)  # black pawn
    self.board[1][4] = Spot(1, 4, piece)  # black pawn
    self.board[1][5] = Spot(1, 5, piece)  # black pawn
    self.board[1][6] = Spot(1, 6, piece)  # black pawn
    self.board[1][7] = Spot(1, 7, piece)  # black pawn

    # Initializw White Pieces
    self.board[6][0] = Spot(6, 0, piece)  # white pawn
    self.board[6][1] = Spot(6, 1, piece)  # white pawn
    self.board[6][2] = Spot(6, 2, piece)  # white pawn
    self.board[6][3] = Spot(6, 3, piece)  # white pawn
    self.board[6][4] = Spot(6, 4, piece)  # white pawn
    self.board[6][5] = Spot(6, 5, piece)  # white pawn
    self.board[6][6] = Spot(6, 6, piece)  # white pawn
    self.board[6][7] = Spot(6, 7, piece)  # white pawn
    # self.board[7][0] = Spot(7,0,piece)  # white rooks
    self.board[7][1] = Spot(7, 1, piece)  # white knight
    # self.board[7][2] = Spot(7,2,piece)  # white bishops
    # self.board[7][3] = Spot(7,3,piece)  # white queens
    self.board[7][4] = Spot(7, 4, piece)  # white king
    # self.board[7][5] = Spot(7,5,piece)  # white bishops
    self.board[7][6] = Spot(7, 6, piece)  # white knight
    # self.board[7][7] = Spot(7,7,piece)  # white rooks


What I have tried:

I have tried using examples online
Posted
Updated 24-Jul-20 23:01pm

Quote:
How do I place my reset board in a CSV file?

This is your design, you define what you need in the file and how it appear in the csv.
Then you program a routine to load the configuration.
If the goal is to save a few lines of code, the routine must be shorter than the board configuration it self.
Quote:
This'll improve your code readability significantly, and make it easier to maintain

This is only a believe of beginner, removing 40 lines of code change nothing.
Typical professional app can be more than 50k lines of code.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900