How do I model a chessboard when programming a computer to play chess?

后端 未结 14 2311
夕颜
夕颜 2021-01-31 10:13

What data structures would you use to represent a chessboard for a computer chess program?

14条回答
  •  遇见更好的自我
    2021-01-31 10:31

    int[8][8]
    
    0=no piece
    1=king
    2=queen
    3=rook
    4=knight
    5=bishop
    6=pawn
    

    use positive ints for white and negative ints for black

提交回复
热议问题