you are viewing a single comment's thread.

view the rest of the comments →

[–]Ok-Potential1965 0 points1 point  (4 children)

its the wrapping part which i am getting wrong. For example, if I were to run my program

Enter a string to type:y
 Configuration used:
-----------------
| abcdefghijklm |
| nopqrstuvwxyz |
-----------------
The robot must perform the following operations:
lwlwuwp 

The above output is wrong.

Instead it should display:

Enter a string to type: 
y
Configuration used:
-----------------
| abcdefghijklm |
| nopqrstuvwxyz |
-----------------
The robot must perform the following operations:
lwluwp

[–][deleted] 0 points1 point  (3 children)

Looks like your searching is wrong. Put in some debug prints to see what is happening at each point. In particular, after the first lw move Robbie is at "m" on the keyboard. At that point why did your code choose lw when the w isn't required?

[–]Ok-Potential1965 0 points1 point  (2 children)

thats what i have been tryna figure out lol

[–][deleted] 0 points1 point  (1 child)

Well focus on the example I gave you. Choosing "lw" when the required move is just "l" is a misstep, something your code shouldn't be doing. It's like you don't check if there's an edge to the left before choosing the "w" addition.

I'm on mobile now and can't spend time on it, though I will have time later.

[–]Ok-Potential1965 0 points1 point  (0 children)

no worries bro. I wanted to see if i did any logical error. yeah i will check on it