Introduction to OOP Chapter 6: The Eight Queens Puzzle: next previous audio real text

Can Attack


function canAttack(r, c)
	if r = row then
		return true
	cd := column - c;
	if (row + cd = r) or (row - cd = r) then
		return true;
	return neighbor.canAttack(r, c)
end
For a diagonal, the difference in row must equal the difference in columns.
Intro OOP, Chapter 6, Slide 11