SwiftChess
SwiftChess copied to clipboard
[Feature Request] Use K/k for king and N/n for knight.
A common ASCII representation king and knight are K and N, not G and K.
the function printBoardState() requires some attention too
switch piece.type {
case .rook:
character = piece.color == .white ? "R" : "r"
case .knight:
character = piece.color == .white ? "K" : "k"
case .bishop:
character = piece.color == .white ? "B" : "b"
case .queen:
character = piece.color == .white ? "Q" : "q"
case .king:
character = piece.color == .white ? "K" : "k"
case .pawn:
character = piece.color == .white ? "P" : "p"
}
printBoardState() is fixed in #4.
I've merged the fix for printBoardState()
Switching to K and N rather than G and K would definitely be clearer, and more in line with other representations. The main hurdle is that most of the tests define board states using ascii board representations, so they would all need to be changed to the new system, which would take a little bit of time. (an hour or so maybe)
If anyone wants to pick this up and make the change I'll be happy to merge it in. Otherwise I'll do it next time I make some updates to my chess game, but I can't guarantee when that will be.
I am not familiar with the code layout but I made the following script which would highlight the 200 or so relevant lines of code, it should be run in the Tests directory, I am not confident to modify the tests by myself.
echo AIBehaviourTests grep -n -A8 ASCIIBoard AIBehaviourTests.swift | egrep -i '[gk]' echo AIConfigurationTests grep -n -A8 ASCIIBoard AIConfigurationTests.swift | egrep -i '[gk]' echo AIPlayerTests grep -n -A8 ASCIIBoard AIPlayerTests.swift | egrep -i '[gk]' echo BoardLocationTests grep -n -A8 ASCIIBoard BoardLocationTests.swift | egrep -i '[gk]' echo BoardRaterBoardDominanceTests grep -n -A8 ASCIIBoard BoardRaterBoardDominanceTests.swift | egrep -i '[gk]' echo BoardRaterCheckMateOpportunityTests grep -n -A8 ASCIIBoard BoardRaterCheckMateOpportunityTests.swift | egrep -i '[gk]' echo BoardRaterCountPiecesTests grep -n -A8 ASCIIBoard BoardRaterCountPiecesTests.swift | egrep -i '[gk]' echo BoardRaterKingSurroundingPossession grep -n -A8 ASCIIBoard BoardRaterKingSurroundingPossession.swift | egrep -i '[gk]' echo BoardRaterThreatenedPiecesTests grep -n -A8 ASCIIBoard BoardRaterThreatenedPiecesTests.swift | egrep -i '[gk]' echo BoardScenarios grep -n -A8 ASCIIBoard BoardScenarios.swift | egrep -i '[gk]' echo BoardTests grep -n -A8 ASCIIBoard BoardTests.swift | egrep -i '[gk]' echo PerformanceTests grep -n -A8 ASCIIBoard PerformanceTests.swift | egrep -i '[gk]' echo PieceTests grep -n -A8 ASCIIBoard PieceTests.swift | egrep -i '[gk]' echo PlayerTests grep -n -A8 ASCIIBoard PlayerTests.swift | egrep -i '[gk]'
On Wed, Apr 11, 2018 at 7:46 PM, Steve Barnegren [email protected] wrote:
I've merged the fix for printBoardState()
Switching to K and N rather than G and K would definitely be clearer, and more in line with other representations. The main hurdle is that most of the tests define board states using ascii board representations, so they would all need to be changed to the new system, which would take a little bit of time. (an hour or so maybe)
If anyone wants to pick this up and make the change I'll be happy to merge it in. Otherwise I'll do it next time I make some updates to my chess game, but I can't guarantee when that will be.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SteveBarnegren/SwiftChess/issues/5#issuecomment-380393333, or mute the thread https://github.com/notifications/unsubscribe-auth/ADH92jSS8d5u5liwNgYWH8L9DLhb-mMkks5tndDogaJpZM4TLOBR .
I'm starting to use this library, and agree standard Algebraic chess notation would really help this library. It will also help if PGN support is added later, e.g. let game = Game(pngText: String)
and let pgnText = game.pgnText
.
I will try to do the refactor and make a PR for you to review. Thanks!
If anyone wants to pick this up and make the change I'll be happy to merge it in. Otherwise I'll do it next time I make some updates to my chess game, but I can't guarantee when that will be.
Done. PR is here, @SteveBarnegren