C
C#15mo ago
Spekulant

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

5 Replies
Spekulant
Spekulant15mo ago
$paste
MODiX
MODiX15mo 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
Spekulant15mo 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
Spekulant15mo 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
Accord15mo 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.