Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Dijkstra algorithm

kingbpkingbp Posts: 1Member
I'm doing a project with a robot caled the boe-bot. My project deals with the boe-bot going through a maze twice: the first time it goes through every single path, even the dead ends, and on the second run it has the entire maze stored in memory so it takes the shortest path to the finish line avoiding all dead ends.

Here is my code so far in pbasic. It goes through the entire maze but doesn't memorize the paths taken. Can you guys add an algorithm in pbasic for memorizing paths taken to my code thanks.

' {$STAMP BS2}
' {$PBASIC 2.5}



DEBUG "Program Running!"
counter VAR Word
FREQOUT 4, 2000, 3000 ' Signal program start/reset.
FOR counter = 1 TO 41
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
DO
SELECT INL ' Select line follower states
CASE %11000000, %11100000 ' Pivot right
PULSOUT 13, 650
PULSOUT 12, 650
CASE %01100000, %01110000 ' Curve right
PULSOUT 13, 700
PULSOUT 12, 650
CASE %00110000 ' Slight right
PULSOUT 13, 750
PULSOUT 12, 650
CASE %00111000 ' Adjust right
PULSOUT 13, 800
PULSOUT 12, 650
CASE %11111111 ' T Intersection
PULSOUT 13, 750
PULSOUT 12, 650
CASE %00011000 ' Straight
PULSOUT 13, 850
PULSOUT 12, 650
CASE %11111111 ' T Intersection Right Turn
PULSOUT 13, 750
PULSOUT 12, 650
CASE %00011100 ' Adjust left
PULSOUT 13, 850
PULSOUT 12, 700
CASE %00001100 ' Slight left
PULSOUT 13, 850
PULSOUT 12, 750
CASE %00000110, %00001110 ' Curve left
PULSOUT 13, 850
PULSOUT 12, 800
CASE %00000011, %00000111 ' Pivot left
PULSOUT 13, 850
PULSOUT 12, 850
CASE %00000000 'U-Turn
PULSOUT 13, 850
PULSOUT 12, 850
ENDSELECT
LOOP
Sign In or Register to comment.