Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 1667
Number of posts: 4756

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Dijkstra algorithm Posted by kingbp on 18 Apr 2011 at 8:18 PM
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



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.