Pi Wars Week -18: Into The Light

Another quick one: I had an hour or so to spare tonight to work on some code I started on a hackspace build night. New to Piwars this year is the Minesweeper challenge (or as I like to think of it, the disco dancefloor challenge) - a square arena with light-up floor tiles, in which the robot has to drive onto the one lit up floor tile to "defuse" it, at which point another tile will light up and so on.

My simplistic approach for the moment is to find the brightest pixel in the image, use its left-right coordinate to steer towards it and the up-down coordinate to set speed, making the robot "chase" a bright spot like a cat chasing a laser pointer. The actual challenge will need a bit more cleverness as we have to drive over the lit up spot, not just near it, and then turn around to search for a new one; I have some ideas about the logic I'll need for that which will come in a later post.

For now...