Help with a node counting and line following functions

Hi!
I'm trying to make my robot navigate a 10x10 grid, not using a mapping function. Instead, I want to make the robot count a number of specific intersections, after which we turn left, right or 180. It's using an array of 5 sensors, and 2 encoder motors up front with a Castor wheel at the back. I need help with the line following functions and the node counting functions: more specifically, which sensors for which function? My current code causes the robot to skip junctions, randomly turn right, not turn right at all, etc. It's a nightmare. What should I do?

muunshine:
What should I do?

Stop and think.

What have you told us?
What do you think we might need to know?