Split input in stub

Hello,

I am working on a new puzzle but I struggle to write a working stub generator for it.

Input is like this :
Line1 : var1 N var2 var3 var4
Line2 to LineN+1 : varA varB varC
LineN+2 : var1 N2 var2 var3 var4
LineN+3 to LineN+3+N2 : varA varB varC

I saw several times stub parsing this kind of data but I am not able to make it work in the editor and I cannot valid my puzzle because of that.

Thanks.

You are redeclaring some variables here, which is not possible (e.g. var1 in line 1 and N+2).
Assuming that all data types are ints, you get the first 2 lines like this:

read var1:int N:int var2:int var3:int var4:int
loop N read varA:int varB:int varC:int

The last 2 are pretty much the same again.

1 Like

Thanks alot, I had never understood i could pass more than 1 argument to read. Thats perfect !

Check here for documentation and examples: Stub Generator