EXAPUNKS

EXAPUNKS

View Stats:
cannot read past end of file
welcome to "i'm stuck on the tutorial" thread 5000

specifically, i currently have this setup:

XA
LINK 800
GRAB 200
COPY F M
WIPE
HALT

XB
LINK 800
LINK 800
MAKE
COPY M F
MARK LOOP
SUBI F 1 T
COPY T F
ADDI X 1 X
TEST X = 10
FJMP LOOP
DROP

(i don't even know if this is the correct solution, and right now i don't care. one problem at a time.)

XB gets as far as SUBI F 1 T, then says "cannot read end of file"

it doesn't explain what this means, what the end of the file is (and which file? the one it's holding?), why it can't read it, or why it's even TRYING to read it

___________________
EDIT:

decided to give this game another try and still couldn't figure out what the issue was here. lamented my issue to a friend, who offered to help. gave them the guidebook. being an actual programmer themself, they actually understood the guidebook. in particular, these paragraphs that i'd read about 20 times on page 09:

"look for the "file cursor" in the file window, highlighting the first value in the file. when an exa reads from the f register it'll read the value pointed at by the file cursor. likewise, writing to the f register replaces the value pointed at by the file cursor. if the file cursor is at the end of the file it will append the new values instead of replacing an existing one.

one more thing. reading or writing the f register automatically moves the file cursor to the next value in the file. sometimes that's convenient. sometimes it isn't."

i never once understood what this was saying. i didn't know what the file cursor was.

my friend explained:

within the file the exa holds (NOT the instructions), the "file cursor" is the solid rectangle somewhere in the list of values.

here's a picture[cdn.discordapp.com]. the file cursor is in box 400, after the 9,

"cannot read past end of file" means the file cursor is over an empty space, and you have an instruction telling it to copy that empty space. it can't copy nothing, so it shows this error.

that's it. that's all it means. and i had to get this explanation from someone who hasn't even played the game.
Last edited by 。✧★☽༓☾★✧。; Apr 13, 2023 @ 12:56am
< >
Showing 1-4 of 4 comments
RavenRune May 7, 2022 @ 8:32pm 
How are you going about debugging the code? There are multiple ways to "run" a solution. There's the step arrow |> which advances your execution state by one step, the run arrow > which runs your code at a more or less reasonable pace where you get an idea of what's going on at every given point, and a fast forward >>> arrow runs it as fast as it can to get through all of the tests.

If you step through the program and look at the file as you're stepping one step at a time, I think you'll realize what's happening. Also, page 9 of the first zine has the crucial but of info on file manipulation that you need, if you end up not figuring it out. Pay careful attention to what happens to the "file pointer" as you read and write to files, which is the highlighted value in the file.
i am using the step-through button, that's how i know where in the instructions this is happening.

XB originally had "SUBI F 1 F" with no copy operation, but that produced the same error. i assumed it was caused by writing to and reading from a variable in the same turn so i split it up, but that didn't help

the only "fix" i've found is removing any lines that attempt to do maths with F, which is a fix in the sense that the error no longer occurs but doesn't really help me in any practical way

and thanks for the hint - i'll give the zine another look
RavenRune May 7, 2022 @ 11:56pm 
If you read page 9 of the zine, then you've probably already found it, but I guess I could try and give a more explicit hint if you haven't. It looks like this is code for tutorial puzzle 4, so you've probably done tutorials 1-3. In tutorial 2 with basic file manipulation, you do computations on multiple entries in the file. The sample code provided has no "SEEK" instructions, yet all the numbers in the file are captured. If you step through the sample code carefully, you'll observe what happens to the file pointer when different kinds of operations interact with the file.
thewifiwhisperer May 10, 2022 @ 12:09pm 
If you haven't found it yet, as RavenRune says. You COPY M F, but then you try do stuff on F, even though your 'cursor' has moved.

Below, with a seek -1 already will help

XB
LINK 800
LINK 800
MAKE
COPY M F
MARK LOOP
SEEK -1; added line
SUBI F 1 T
COPY T F
ADDI X 1 X
TEST X = 10
FJMP LOOP
DROP

Do mind that it now will end on -1, which would be a nice TEST case to change.
However, the other scenario's will have a starting number that is variable, so not great to have that hardcoded.

Some spoilers, taking this code and improving, if you're still lost.


Also, why keep a counter, if you already *know* what the end situation is. It's not after a certain number of iterations, it's when you reach 0.

So, instead of testing for 10, why not test if your value T has reached 0.
Even more awesome, T being zero is already a condition it's T being F.

As 'coup de grace', one of the awesome things of this game is that "crashing" is a feature. So, we can drop the DROP. When the EXA crashes it will DROP implicitly.

LINK 800
LINK 800
MAKE
COPY M F
MARK LOOP
SEEK -1; ADDED LINE
SUBI F 1 T
COPY T F
;ADDI X 1 X SKIP
;TEST X = 10 or 9 SKIP
TJMP LOOP; TJMP NOW
; DROP DROPPED
Last edited by thewifiwhisperer; May 10, 2022 @ 12:13pm
< >
Showing 1-4 of 4 comments
Per page: 1530 50