travis-ci has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<travis-ci> [travis-ci] Build details : http://travis-ci.org/manastech/crystal/builds/31866164
<travis-ci> [travis-ci] manastech/crystal#1339 (master - 388c11c : Ary Borenszweig): The build was fixed.
asterite has joined #crystal-lang
waj has joined #crystal-lang
asterite has joined #crystal-lang
travis-ci has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<travis-ci> [travis-ci] Build details : http://travis-ci.org/manastech/crystal/builds/31871833
<travis-ci> [travis-ci] manastech/crystal#1340 (master - b9a699b : Ary Borenszweig): The build passed.
travis-ci has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<travis-ci> [travis-ci] Build details : http://travis-ci.org/manastech/crystal/builds/31874118
<travis-ci> [travis-ci] manastech/crystal#1341 (master - a219ca1 : Juan Wajnerman): The build passed.
CraigBuchek has joined #crystal-lang
e_dub has joined #crystal-lang
asterite has joined #crystal-lang
travis-ci has joined #crystal-lang
<travis-ci> [travis-ci] manastech/crystal#1342 (master - 734c99b : Juan Wajnerman): The build passed.
<travis-ci> [travis-ci] Build details : http://travis-ci.org/manastech/crystal/builds/31875390
travis-ci has left #crystal-lang [#crystal-lang]
asterite has joined #crystal-lang
e_dub has joined #crystal-lang
asterite has joined #crystal-lang
asterite has joined #crystal-lang
asterite1 has joined #crystal-lang
travis-ci has joined #crystal-lang
<travis-ci> [travis-ci] Build details : http://travis-ci.org/manastech/crystal/builds/31876783
travis-ci has left #crystal-lang [#crystal-lang]
<travis-ci> [travis-ci] manastech/crystal#1343 (master - 7b3544b : Juan Wajnerman): The build passed.
asterite has joined #crystal-lang
drizz_ has joined #crystal-lang
bcardiff1 has joined #crystal-lang
e_dub has joined #crystal-lang
e_dub has joined #crystal-lang
Excureo has joined #crystal-lang
asterite has joined #crystal-lang
CraigBuchek has joined #crystal-lang
bcardiff has joined #crystal-lang
travis-ci has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<travis-ci> [travis-ci] Build details : http://travis-ci.org/manastech/crystal/builds/31916795
<travis-ci> [travis-ci] manastech/crystal#1344 (master - 2e1966d : Ary Borenszweig): The build passed.
travis-ci has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<travis-ci> [travis-ci] Build details : http://travis-ci.org/manastech/crystal/builds/31916978
<travis-ci> [travis-ci] manastech/crystal#1345 (master - eec2f31 : Ary Borenszweig): The build passed.
waj has joined #crystal-lang
e_dub has joined #crystal-lang
asterite has joined #crystal-lang
travis-ci has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<travis-ci> [travis-ci] Build details : http://travis-ci.org/manastech/crystal/builds/31935018
<travis-ci> [travis-ci] manastech/crystal#1346 (master - 2ab3689 : Ary Borenszweig): The build passed.
Liothen has joined #crystal-lang
Liothen has joined #crystal-lang
Rylee has joined #crystal-lang
Rylee has joined #crystal-lang
Rylee has joined #crystal-lang
Liothen has joined #crystal-lang
e_dub has joined #crystal-lang
asterite has joined #crystal-lang
<jhass> hey asterite, I could fix the read_nonblock issues by changing it to return what's available instead of insisting to read the specified length (by basically just ignoring the EAGAIN error).
<asterite> if that fixes it, then go ahead :)
<asterite> or tell me what to change, where
<jhass> however I have no idea why the out of bounds happens. I mean it happens because the last row (array) in the grid turns into an empty one, but I have no idea why
<jhass> the only assignments in the game logic are of [a][b]=, there's no .shift and no .clear
<jhass> and no .pop
<asterite> True, I just saw the empty array
<asterite> Hmmm...
<asterite> I see there: set_current_row [] of String
<asterite> That's probably it, but I didn't really follow the code
<jhass> yes but that just sets @current_row
<jhass> it doesn't touch @grid at all
<jhass> and @grid should be of Array(Array(Int32|Symbol))
<jhass> so Array(String) doesn't really fit there
<asterite> Right
<asterite> My guess is that there's something wrong with read_nonblock that is scarmbles the memory or something like that
<asterite> I mean, it touches other memory and scrwes that array, but I'm not sure
<jhass> hm but then quite consistently it just damages the last array of the arrays in @grid?
<asterite> :-P
<asterite> I'm getting this array: [[:empty, :empty, :empty, 4], [:empty, :empty, :empty, :empty], [], []]
<jhass> hm, I only get the last one empty
<jhass> so, the other issue is that there are still random segfaults out of (seemingly) nowhere
<jhass> one interesting bit is that they drastically increase if I comment set_current_row [] of String line you mentioned
<asterite> I just changed the read_keypress to use getchar and it works perfect
<asterite> No segfault, no index out of bounds
<asterite> (but let me try a little more)
<asterite> (but you have to press the key and press enter, ugh)
<asterite> The good thing is that the same logic seems to be ok :D
<asterite> and we could also improve it by using the colorize file
<asterite> the bad news is that we have to debug read_nonblock and deal with segfaults, etc. :-P
<jhass> nope, sorry, doesn't work at all for my terminal
<asterite> What terminal is that?
<jhass> terminator on Archlinux
<jhass> er, terminology by now
<asterite> well, if it was terminator i would understand the segfaults...
<jhass> oh, I didn't realize that you changed to wasd
<asterite> Ah, yes, sorry
<jhass> but not even the q worked for me
<asterite> strange
<asterite> but the other keys work?
<jhass> hm yeah, strange
<jhass> anyway, always pressing enter makes that almost not playable :P
<asterite> Where did you get the original read_nonblock code… ruby?
<jhass> pretty much iirc
<jhass> meh, I think I defined the termios struct wrongly
<asterite> Don't worry, we always miss the correct definitions the first time, specially when dealing with multiple platforms
<jhass> so aliasing Tcflag to UInt64 fixes it for me
<jhass> that stuff is defined in bits/termios.h
<jhass> which is as system specific as it gets as I understood it
<jhass> though since it's set to unsigned int there, the proper alias in crystal would be UInt I guess?
<jhass> uh, that doesn't exist
<jhass> so what's the crystal equivalent to C's unsigned int?
<asterite> You have UInt8, UInt16, UInt32 and UInt64
<asterite> so I guess UInt32
<jhass> UInt32 is what I had it at and that's causing all the errors
<jhass> UInt64 on my system seems to work flawless
<jhass> but I wouldn't be surprised at all if that breaks on other systems
<jhass> iirc C's unsigned int is 32bit or 64bit depending on the architecture
<asterite> I think so
<asterite> In my headers I see tcflag is unsigned long
<asterite> so I guess UInt64
<asterite> but I changed it and it still doesn't work, don't know why
<jhass> see now why we need header parsing? :P
<asterite> on the other hand it doesn't crash anymore
<asterite> :-P
<asterite> farelyknight is working on something that parses headers :)
<jhass> if it doesn't crash anymore, what does "still doesn't work" mean?
<asterite> because the input never matches the case
<jhass> let me open a PR with all my changes so you can try
<asterite> I mean, I can't play because the program reads the keyboard but it's never "\x1B[A" or any of those listed there
<asterite> and I have to press two keys in the "read_keypress" method for it to do something
<asterite> (but it never matches)
<asterite> Specifically, it executes "input = io.read 1". I press a key, input is "\e", it does "io.read_nonblock 3" but there I have to press a key again :(
<jhass> can you try out that branch? https://github.com/jhass/crystal/tree/2048_fixes
<asterite> Sure
<asterite> Still doesn't work, but maybe it doesn't work on a mac
<asterite> I'll have to try it in a linux vm, but I'll do that later
<asterite> Thanks for looking into this :)
<jhass> if you still want to play with it you can look what input you receive by printing input before the case and commenting the Screen.clear line
<asterite> cool
Excureo has joined #crystal-lang
e_dub has joined #crystal-lang
Excureo has joined #crystal-lang
edub has joined #crystal-lang
waj has joined #crystal-lang