Is this a bug or expected behavior?

new topic     » topic index » view thread      » older message » newer message

I decided to try doing the Advent of Code programming problems this year.

The first problem was pretty easy -- find 2 numbers from the list given that add up to 2020 and return the product of the 2 numbers. No problem. Then the second part of the first problem was find 3 numbers that add up to 2020 and give the product of those 3 numbers.

Due to a logic error in my program it just ended with no output. I put a

with trace 
trace(1) 

in to see if that would help me find my logic error.

eui advent0102.ex <input.txt  

the trace screen opened with the line after the trace highlighted.

None of the command keys seem to work

I hit CTRL c and got

Press Enter... 

Then I had to go to the Task Manager, select the Euphoria Interpreter (which was taking up about 60% of the processor) and do an End Task.

Then I got the lines below which showed that I hit the enter key, '1' key twice, enter 3 more times and then tried inputting numbers 123 and 456

C:\Users\Lonny\Programming\AdventofCode2020> 
C:\Users\Lonny\Programming\AdventofCode2020>11 
'11' is not recognized as an internal or external command, 
operable program or batch file. 
 
C:\Users\Lonny\Programming\AdventofCode2020> 
C:\Users\Lonny\Programming\AdventofCode2020> 
C:\Users\Lonny\Programming\AdventofCode2020> 
C:\Users\Lonny\Programming\AdventofCode2020>123 
'123' is not recognized as an internal or external command, 
operable program or batch file. 
 
C:\Users\Lonny\Programming\AdventofCode2020>456 
'456' is not recognized as an internal or external command, 
operable program or batch file. 

Here's some code that will show the bug:

file input.txt

12 
34 
56 
78 
90 
These are NOT the actual input I was using.

run the program with eui test.ex <input.txt

--test.ex 
include std/io.e 
include std/get.e 
 
sequence numbers = {} 
object line 
atom one_num 
with trace 
trace(1) 
while 1 do 
    line = get(STDIN) 
    if line[1] = GET_EOF then 
        exit 
    end if 
    one_num = line[2] 
    numbers &= one_num 
end while 

If I use the STDIN and type the numbers in on the main window of the trace it works correctly. So the question is "Is this a bug in the interpreter or the command shell?"

Lonny

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu