Task 2 robot movement logic without message passing