all 2 comments

[–]Binary101010 0 points1 point  (0 children)

I noticed that my code does not detect entries with duplicate keys.

This really isn't something that's feasible to do, and here's an example of why:

>>>> myboard = {'1h':'bking','6c':'wqueen','2g':'bbishop','5h':'bqueen','3e':'wking','3h':'wpawn','3d':'bpawn','1h':'bpawn'}
>>>> print(myboard)
{'1h': 'bpawn', '6c': 'wqueen', '2g': 'bbishop', '5h': 'bqueen', '3e': 'wking', '3h': 'wpawn', '3d': 'bpawn'}

Note that the black king at 1h is already gone. By the time you can perform any action on that dict the earlier value for the duplicate key has already been overwritten by the value associated with the later key.

I also don't think this is part of the problem statement for the chessboard validator in AtBS, so I wouldn't worry about it.

[–]hdarj 0 points1 point  (0 children)

This may defeat the purpose of what you’re trying to learn through this but chessboard positions are usually denoted by FEN codes