void fillRow() // move across row, placing beepers on alternate squares while (frontIsClear()) move(); if (!beepersPresent()) // place only on every other square: check previous square to alternate // Simpler: attempt to move two steps placing beepers on stepping pattern
A verified approach focuses on making the code "world-independent" by using loops instead of fixed numbers. WordPress.com Row Filling 645 checkerboard karel answer verified