C
C#2y ago
Spekulant

❔ basic maze solver but there is a bug that it moves how it should not

5 Replies
Spekulant
SpekulantOP2y ago
$paste
MODiX
MODiX2y ago
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
Spekulant
SpekulantOP2y ago
Pastebin
using System;using System.Collections.Generic;using System.Linq;nam...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Spekulant
SpekulantOP2y ago
https://pastebin.com/5KrpdbR2
so the input:
10
6
XXXXXXXXXX
X....X...X
X....X...X
X.X..X.X.X
X.X.>..X.X
XXXXXXXXXX

first number is the width second the height the > is the player and he has 4 rotations <>V^

i want to print every time he moves

the algorithm is that

if{there is a wall to his right}
if{there is a wall infron}
turn left
else{ go forward}
else{
turn to the right
count the step
move forward}

XXXXXXXXXX
X....X...X
X....X...X
X.X..X.X.X
X.X..>.X.X
XXXXXXXXXX

XXXXXXXXXX
X....X...X
X....X...X
X.X..X.X.X
X.X...>X.X
XXXXXXXXXX

XXXXXXXXXX
X....X...X
X....X...X
X.X..X.X.X
X.X...^X.X
XXXXXXXXXX

XXXXXXXXXX
X....X...X
X....X...X
X.X..X^X.X
X.X....X.X
XXXXXXXXXX
first 4 steps
so the input:
10
6
XXXXXXXXXX
X....X...X
X....X...X
X.X..X.X.X
X.X.>..X.X
XXXXXXXXXX

first number is the width second the height the > is the player and he has 4 rotations <>V^

i want to print every time he moves

the algorithm is that

if{there is a wall to his right}
if{there is a wall infron}
turn left
else{ go forward}
else{
turn to the right
count the step
move forward}

XXXXXXXXXX
X....X...X
X....X...X
X.X..X.X.X
X.X..>.X.X
XXXXXXXXXX

XXXXXXXXXX
X....X...X
X....X...X
X.X..X.X.X
X.X...>X.X
XXXXXXXXXX

XXXXXXXXXX
X....X...X
X....X...X
X.X..X.X.X
X.X...^X.X
XXXXXXXXXX

XXXXXXXXXX
X....X...X
X....X...X
X.X..X^X.X
X.X....X.X
XXXXXXXXXX
first 4 steps
Pastebin
using System;using System.Collections.Generic;using System.Linq;nam...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server