Skip to content
Advertisement

Tag: dry

How to reduce overly-redundant for loops

I am currently developing a Chess game and ran into a problem with code redundancy in my Bishop class. I am trying to create a function that will get all possible moves of a bishop. To do that, I would create a for loop that evaluates all diagonals of the bishop, and break the loop when it hits the end

Advertisement