There are around two major features that will be implemented: fixing the code redundancy found in updateAttackLists() and adding the ability to upload and make a custom chess piece via file loading. The former of the two is simply making the code have a better format since there’s quite a bit of duplication occurring. The second, and larger implementation, is creating a way to easily upload a custom chess piece into the game with a text file. For instance, a file can indicate the movement of 1 Vertical, 2 Horizontal, and 3 Diagonal and when the file is uploaded a new custom chess piece will have those movements.
This portion of coding was not actually implemented; due to an oversight on my part while looking at the original code I thought there was redundancy that could be fixed. However, upon further inspection I found that the code--although incredibly similar--has slight differences depending on if the pieces are black or white and require having the implementation that was originally present. As such, I had to revok making this change.
if attacking piece is white
Make a temporary list to contain the white attack list
endif
if the attacking piece is black
Make a temporary list to contain the black attack list
endif
Fill the temporary list to contain no attacks
For each piece
Update in the temporary list of the piece is attacking
End for
Update the original attack list with the temporary list’s values
If a custom text file exists in /group-project/src
Create a new chess piece
For each movement type listed in the text file
For each space the custom chess piece can move
Calculate the individual movement types for the new chess piece
End for
End for
Assign the custom chess piece its cost
endif
If a custom text file exists in /group-project/src
Display a custom chess piece option to buy
endif
- Add a new text file called Custom_Piece.txt to /group-project/src (if one is not present already)
- Populate the contents of the text file with movement behavior for your custom piece
- Text File format (Where x = number)
Vertical x
Horizontal x
Diagonal x
Cost x
- Load up the game while on MainApplication.java
- Proceed to start a game; on the piece purchasing screen a new option to buy your custom piece should appear below the Queen piece
- Purchase and drag as many as your custom pieces onto the board as you want
- Add the remaining pieces you want. Repeat Steps 5 and 6 for Player 2
- Start playing a game of custom chess with your new custom piece! Movements for your custom piece will be limited to what you set in Custom_Piece.txt