# [Röda], <s>405</s> <s>393</s> <s>392</s> <s>391</s> <s>371</s> <s>366</s> <s>361</s> <s>236</s> <s>234</s> <s>232</s> 230 bytes F f{L=f()|[#_]|sort|tail c=""x=0 y=0 X=1 Y=0{l=f[y]l+=" "until[x<#l];c=l[x]a=X [c] C=indexOf(c,`><v^/\|_#`)X=[1,-1,0,0,-Y,Y,-X,X,-X,X][C]Y=[0,0,1,-1,-a,a,Y,-Y,-Y,Y][C]x+=X x=x%L y+=Y y=y%#f x+=L if[x<0] y+=#f if[y<0]}until[c=";"]} [Try it online!] [Röda]: https://github.com/fergusq/roda [Try it online!]: https://tio.run/nexus/roda#dVDBbqMwFDzXX/FkVKltQJAzOJdKPUXayx5AxEm9YCeuqOmClwWFfHv22VFQL4vBep6ZN2/M9Q3UecvU0/NcBgc@921nZyt0QypG6cgSMuGXszUpWHJumCon3qwYBfrHWN2UYxY0PK0YVlywnJQVJ69Mm1qOP9RTFb5vsmEf7@ZD8P6cs3IdRuswwRUVYRFGeZj7jZevvGClI7wiEqFwvH8Lx44rNB/Z@Lgl04oVmGp6DBRBeAtaYYyEOyJQ7jTh6XLLh7dIKb9cP4U2cCYAVva2Er3sgUFJB3DPZiAb8asa4jglRyXrbK9PNIT/so5DpJYqvZfzUgVLtdulxBkcHLBPvUstYwL7D306Zg712iwVftoGJQPlBJt6@RuSEIIlbbSGGVTbgYa6JQ8P8cvPkwQjRwv2bwuNNnijqjWD7BBBqredNscetLGtk0S1/pSm160RDTTSHO0JPW8qEF0npv4l9nHvM/EHLeNLzWO6M9QLbuGWbD7aedbzHUDxt17fSi8HDP22gN7nC2dboM60bo0k5HL9Bw "Röda – TIO Nexus" [Check outputs!](https://tio.run/nexus/roda#dZFLb6MwEMfP8acYGVXKA5bkDM6lUk6RetlDEDGEgklcUdMFhwWFfPbs4CSoPSwvzfzn9fNw20B@2bJ8OutDK@Z9XVa614ksSMoobdmSdPju2IoEbHkpWB52vFgwCvSstCzC1rcK7qUMLZ6wHQlTTl6ZVJlo3/Jpah/WfhO5@z62DrMdC1e2s7KXeDuBHdjOzt6ZDw9fecDCIWAynMROhrh5giHaLrB5y9qXLekWLECq7sXKCcpbkDliLPkQsPLB69C73vnwFB7l19tnIhVcCIAWtU6TWtTAIKQNDNe6IevkPW1c1yPHXGR@JE/Uhv9Ghxgqmci9p9mPljVa@71HhgbxIESe6ZIJl0D0IU9Hf1BNru8llBMyScuqEql@O@uvs37wmck@TjqeZOS66wYrvqsAozoS3YGy9D15OtbDORiseG/cg00jeDCBj/0/IlNwZ0ITmZC/Fn9gaYM1Ls5ZQQ95WYGErCSTSWl4EZdS9Nz575MAJVoN@m8JhVS46rRUjahQwVCtK6mONUilyyHFyeSnULUsVVJAIdRRn3DCPQuSqkq6eu6aPT4JcNQIE0ru0r2iJuGOOpIa0Esv@6eAyd9qTSm9xqY03Eyf@oxj2eNQvxjEeKhwPOPPf4QtOHHnk8lm7Ppg/UJ8PWwEcElKEHK9/QM "Röda – TIO Nexus") ###Explanation (outdated) F f{ /* Declares a function F with parameter f */ /* Takes a 2D array of single-char Strings as f */ L = /* L contains the value of the length of the longest line*/ f() /* Push the contents each element of f to the stream; this pushes each line*/ | [#_] /* Pull a line and push its length to the stream*/ |sort|tail /* Sort it and get the last value (the largest one) */ c="" /* c contains the value of the current char that is being processed */ x=0; y=0 /* x and y contain the position of the fish */ X=1; Y=0 /* X and Y contain the direction of the fish */ { ... }while [c != ";"] /* While c is not `;` do: */ l=f[y] /* l is the line (row) the fish is at */ c=" " if [x >= #l] /* If x is more than or equal to the line's length, set c to a space (so that we don't need to pad spaces to the array at the beginning)*/ else c = l[x] /* Else set c to the character a position x of l*/ [c] /* Push c to the output stream; ie prints c without a trailing newline*/ a = X /* a preserves the value of X before analysing c */ C = indexOf(c,`><v^/\|_#`) /* Simple enough */ X=[1,-1,0,0,-Y,Y,-X,X,-X,X][C]/* Map each value of C to their respective X-direction in the array */ /* If c cannot be found in `><v^/\|_#` then it will be given the value of -1, or in other words, the -1th element of an array its last element */ Y=[0,0,1,-1,-a,a,Y,-Y,-Y,Y][C]/* Do the same thing for Y */ x += X /* Change the x-pos by the X-direction */ x = x%L /* Wrap around the right edge */ y += Y /* Do the same for y */ y=y%#f /* But wrap around the bottom instead */ x+=L if[x<0] /* Wrap around the left */ y+=#f if[y<0] /* Wrap around the top */ } ###Edits - 10 bytes saved thanks to @fergusq by using `%` instead of checking whether x or y is over the boundaries, which paved the way for 2 more! - Used <code>\`\\`</code> instead of `"\\"` - Moved `c=""` to the second line and then removed the newline following it - Moved the conversion of the lines to single-character array into the loops instead of at the beginning (inspired by the Python answer) - Used the brace syntax of `while` (thanks to @fergusq for spotting that) - Moved the `a=X` out of the if-statements - Thanks to @fergusq for finding a shorter way to find the length of the longest line - Used array syntax instead of if-statements (like the Python answer) to save tons of bytes - Removed the code that padded spaces, instead spaces are added as the ><> moves along - Fixed a bug thanks and golfed one character thanks to @fergusq - Removed the `+1` at the end of `indexOf` and restructured code to save 2 bytes - Saved 2 bytes by moving things around (thanks to @fergusq again) - Saved 1 byte thanks to @fergusq by using a different method of padding spaces - Saved 1 byte by using `until[c=";"]` instead of `while[c!=";"]`