How to create logic for chess pieces using list indexing, specially for rook ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to create logic for chess pieces using list indexing, specially for rook ?

I have tried and exerted alot to think many times but couldn't find the rook's logic or code.I want a hint not solution.I am using lists.Or should I create an algorithm.remember I am beginner.

23rd Sep 2023, 2:16 PM
Mushahid Bukhari
Mushahid Bukhari - avatar
2 Answers
+ 1
Aaron Lee the code is too long and I wrote it in pydroid.But I explain. I created 8 lists with ⬜ and ⬛ squares.each list named rank1, rank2, rank3, ... and so on.I stored all of them in another list 'chessboard'.then I created 32 variables for chess pieces.I can change and access and change lists and their items but I don't know How to create logic for pieces to move.rook would be better for test, it only moves in + direction.instead of creating every possibility i want a suitable way.
24th Sep 2023, 6:55 AM
Mushahid Bukhari
Mushahid Bukhari - avatar
0
Can you post your code, so we can help you better?
24th Sep 2023, 6:39 AM
Aaron Lee
Aaron Lee - avatar