Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def safe_pawn_count(pawns[n]) #pawns[n] = list of pawns, there are n pawns
- lowest_index = ∞
- lowest_count = 0
- for each pawn in pawns
- if pawn.row_index < lowest_index
- lowest_index = pawn.index
- lowest_count = 1
- else if pawn.row_index = lowest_index
- lowest_count = lowest_count + 1
- return n - lowest_count
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement