code logs -> 2016 -> Sat, 26 Nov 2016< code.20161125.log - code.20161127.log >
--- Log opened Sat Nov 26 00:00:56 2016
00:03 catadroid [catalyst@Nightstar-t7bbfh.dab.02.net] has quit [Ping timeout: 121 seconds]
00:04
<@celticminstrel>
(What's the Rod of Seasons for anyway?)
00:09
<~Vornicus>
in Oracle of Seasons it is used to change the season.
00:31 catadroid [catalyst@Nightstar-rut4et.dab.02.net] has joined #code
00:32 catalyst [catalyst@Nightstar-bt5k4h.81.in-addr.arpa] has quit [[NS] Quit: Leaving]
00:52 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
00:53
<@celticminstrel>
Why is it that when I set ITERATIONS to 30, everything works, but setting it to 1 causes Firefox to complain the script is running too long?
00:53
<@celticminstrel>
(The thing being iterated is a cellular automaton.)
00:53
<@celticminstrel>
Hmm, actually, it's probably the part after the iteration that's the culprit...
00:54
<@celticminstrel>
Yeah, okay.
00:54
<@celticminstrel>
Now, the real question is why it's not being seeded properly...
01:01 Derakon_ [Derakon@Nightstar-4h95jf.ca.comcast.net] has joined #code
01:01
< Derakon_>
Lua gurus!
01:02
< Derakon_>
Say I am using this class implementation: http://lua-users.org/wiki/SimpleLuaClasses
01:02 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
01:02 mode/#code [+qo Vornicus Vornicus] by ChanServ
01:02
< Derakon_>
Is there some way for me to determine if a given object I am handed implements a specific class?
01:02 Vashicus [Vash@Nightstar-uhn82m.ct.comcast.net] has joined #code
01:02
< Derakon_>
I'm looking for the "instanceof" equivalent.
01:02
< Derakon_>
I guess I would compare metatables somehow?
01:03 Vash [Vash@Nightstar-uhn82m.ct.comcast.net] has quit [Ping timeout: 121 seconds]
01:05
<~Vornicus>
you can compare metatables - make sure you do the metatable in such a way that it exists before you use setmetatable
01:05
<@celticminstrel>
getmetatable(a) == getmetatable(b)
01:06
<@celticminstrel>
Note that that doesn't always return the metatable.
01:06
<~Vornicus>
I kno that cpml makes it so each object it implements has an item in the metatable that says the type of the object
01:06
<@celticminstrel>
But it does at least return something that will be the same for objects with the same metatable.
01:13
< Derakon_>
cpml?
01:13
< Derakon_>
CM: right, thanks.
01:15
<~Vornicus>
https://github.com/excessive/cpml
01:15
< Derakon_>
Guessing if I want to pretty-print a class, I need to implement a :str() function or similar?
01:17
<@celticminstrel>
You could implement __tostring__ IIRC
01:18
< Derakon_>
That sounds like a Pythonism.
01:18
<@celticminstrel>
Then you can call tostring(obj)
01:18
<@celticminstrel>
It's a bit similar to Python I guess.
01:18
<@celticminstrel>
I might not have the name exactly right.
01:18
< Derakon_>
Yeah, I just tried what you said.
01:19
< Derakon_>
Ah, it's __tostring.
01:19
< Derakon_>
https://www.lua.org/pil/13.3.html
01:20
<~Vornicus>
yeah, the special method names in lua are __foo
01:21
< Derakon_>
function List:size() return self.last - self.first end
01:21
< Derakon_>
"Attempt to index local 'self' (a nil value)"
01:21
< Derakon_>
...nemmind, forgot to invoke function using the : syntax.
01:28
<@celticminstrel>
Invoke, or define?
01:32
< Derakon_>
Invoke.
01:33
< Derakon_>
I think most of my "WTF why isn't this working" errors have been because I've not provided syntactically valid arguments to a function.
01:33
< Derakon_>
And Lua will just roll with it instead of saying "hey dumbass you did this wrong".
01:40 Derakon [chriswei@Nightstar-5mvs4e.ca.comcast.net] has quit [Ping timeout: 121 seconds]
01:42
< Derakon_>
cell_paths = {start_cell = first_path}
01:42
< Derakon_>
print(cell_paths[start_cell])
01:42
< Derakon_>
nil
01:42
< Derakon_>
WTF?
01:42
< Derakon_>
start_cell and first_path are both tables, natch.
01:48
<~Vornicus>
Haang on
01:49
< Derakon_>
...oh, wait, the shortcut syntax autoconverts the key to a string?
01:49
< Derakon_>
Per http://lua-users.org/wiki/TablesTutorial
01:49
<~Vornicus>
It's not that it autoconverts
01:49
<@celticminstrel>
[start_cell] = first_path
01:49
< Derakon_>
>.<
01:49
<@celticminstrel>
It doesn't autoconvert, it's an identifier.
01:50
< Derakon_>
t = {foo = "bar"} -- same as ["foo"]="bar" (but not [foo]="bar" , that would use the variable foo)
01:50
<~Vornicus>
It's that the assumption is "a string"
01:50
<~Vornicus>
because typically that's how you'll be using it
01:50
<@celticminstrel>
Not just any string, an identifier.
01:51
<~Vornicus>
This makes more sense typically because you can go t = {foo = "bar"} and then t.foo gives "bar"
01:51
< Derakon_>
This language is a bizarre combination of very specific magic and making you do a lot of stuff yourself.
01:52
< Derakon_>
It's like if C and Python had a baby.
01:52
<@celticminstrel>
It's technically consistent - x = {foo = 'bar'} yields x.foo == 'bar', and x = {[foo] = 'bar'} yields x[foo] == 'bar'.
01:53 Derakon [chriswei@Nightstar-5mvs4e.ca.comcast.net] has joined #code
01:53 mode/#code [+ao Derakon Derakon] by ChanServ
01:53
<@celticminstrel>
Should I repeat what I just said?
01:53
< Derakon_>
No, different Derakon.
01:53
<@celticminstrel>
Ah 'kay
01:53
< Derakon_>
And yeah, I get that it's consistent, but it's still surprising.
01:55
< Derakon_>
Whoops, my pathfinding algorithm got stuck.
01:55
< Derakon_>
% killall love
02:01
<@Alek>
.... seriously?
02:01
< Derakon_>
...oh goddammit, the reason this isn't working is because Lua uses the table reference when you want to use a table as a key, doesn't it?
02:01
<@Alek>
2 different Derakons in the same channel on the same small network???
02:01
< Derakon_>
So I'm trying to store a mapping of grid cell position to the path to that cell, but I'm not using a consistent table to store that cell position.
02:01
< Derakon_>
Alek: yeah, the other one is me from my home computer.
02:01 mode/#code [+oo catadroid Vashicus] by Alek
02:01
<@Alek>
ah, that's better. the original comment was rather misleading.
02:02 mode/#code [+o Derakon_] by Alek
02:02
<@Derakon_>
Anyway, so I store into the cell_paths table at foo = {x: 5, y: 4}, then later look into it under bar = {x: 5, y: 4}, and I find nothing.
02:02
<@Derakon_>
Fuck this language, for serious. >.<
02:03
<~Vornicus>
YOu're expecting object equality to be based on something other than id
02:03
<~Vornicus>
I don't know why, this is the default in everything else, including python
02:04
<@Derakon_>
No, I get that. I'm just frustrated, and also I don't know how to get it to do what I want in Lua.
02:05
<@Derakon_>
In Python it would be a simple matter of overriding __hash__ and __cmp__.
02:05
<@Derakon_>
My Googling for Lua is turning up approaches that modify the table instead of the things you stuff into the table.
02:06
<@celticminstrel>
You can overload __le and __lt, but those aren't used for key lookup anyway.
02:06
<@celticminstrel>
And __eq and __ne IIRC, but same caveat.
02:07
<@celticminstrel>
I think the only way would be to have a point() function that returns a unique instance of the point.
02:07
<@celticminstrel>
(Obviously not a great solution.)
02:07
<@celticminstrel>
Or switch to using string keys.
02:07
<@celticminstrel>
"5,4" instead of {x:5,y:4}
02:08
<@celticminstrel>
Oh, I guess you could use __index in the table that you're storing the keys in.
02:08
<~Vornicus>
Yes, that's the typical method for lua
02:08
<@celticminstrel>
An __index function that takes the table, converts it to a string, and looks it up with rawget().
02:10
<@Derakon_>
Well, what I'm going to do right now is go eat dinner~
02:10
<@Derakon_>
But thanks for the advice guys.
02:20 Derakon_ [Derakon@Nightstar-4h95jf.ca.comcast.net] has quit [[NS] Quit: This computer has gone to sleep]
02:21 Derakon_ [Derakon@Nightstar-4h95jf.ca.comcast.net] has joined #code
02:28
<@celticminstrel>
Okay, so I have no idea why this isn't working.
02:28
<~Vornicus>
What's up?
02:29
<@celticminstrel>
If i use the randomly-seeded state of the automata as the map, then I can see the random scattering of land tiles. As soon as I run the automata once, the bottom one-fifth of the map is pure water.
02:30
< Derakon_>
What decides when a tile becomes water?
02:30
< Derakon_>
(I assume you mean "bottom one-fifth" in terms of XY coordinates, not depth?)
02:30
<@celticminstrel>
After the automata runs it invokes a callback on every cell.
02:31
<@celticminstrel>
And yeah, it's XY coordinates. The width is a multiple of 8 and the height of 10, but the generated land all fits in the 8x8.
02:31
<@celticminstrel>
The callback sets the tile to water or land depending on the input boolean.
02:31
<@celticminstrel>
(Well, it's 0/1 rather than boolean, but close enough.)
02:32
<~Vornicus>
celmin: are you putting them in the right oder
02:32
<@celticminstrel>
What do you mean?
02:32
<@celticminstrel>
Am I swapping the coordinates?
02:32
<~Vornicus>
Like, this sugg-- yes
02:33
<@celticminstrel>
My impresion is... probably not.
02:33
<@celticminstrel>
Since when I use the seeded values before running the automata, there's land.
02:33
<@celticminstrel>
^impression
02:33
<@celticminstrel>
Unless there's a bug in the automata (not my code), but I can't see anything wrong there.
02:37
< Derakon_>
So, you're calling a cellular automata to fill in your map, which invokes various callbacks you have defined according to conditions in the cell? And for some reason it's calling the "Set water" callback for all cells where Y > 80% or something like that?
02:37
<@celticminstrel>
It's a single callback that takes (x, y, is_this_cell_alive).
02:37
<@celticminstrel>
And for Y > 80% it seems to always be passing false.
02:38 * celticminstrel adds a log message to the callback to test if this is true.
02:38
< Derakon_>
What happens if you pass in a square map?
02:38
< Derakon_>
I'm guessing the non-squareness is part of the problem.
02:38
<@celticminstrel>
Well, I assume that wouldn't have the problem, but I guess I'll give it a try.
02:39
<~Vornicus>
also try a 10-wide 8-tall map and see if that fails in a similar fashion
02:40
<@celticminstrel>
Easier to do 8-wide 6-tall.
02:44
<@celticminstrel>
No problems with 8x8.
02:44
<@celticminstrel>
No problems with 8x6...
02:45
<@celticminstrel>
It seems like 10x8 also works.
02:46
< Derakon_>
So far the only failure case is where height > width, then?
02:46
<~Vornicus>
Did you write the generator?
02:46
<@celticminstrel>
Oh, wait, maybe that wasn't 10x8.
02:47
<@celticminstrel>
I thought it looked strange... but, still works.
02:47
<@celticminstrel>
I didn't write the cellular automata.
02:48
< Derakon_>
Maybe it's time to file a bug report, then~
02:49
<@celticminstrel>
https://github.com/ondras/rot.js/blob/master/src/map/cellular.js
02:50
<@celticminstrel>
That's the automata implementation.
02:53
< Derakon_>
You're using a rectangular cell shape?
02:53
<@celticminstrel>
Yes, not hexes.
02:55
< Derakon_>
Found it.
02:55
< Derakon_>
Line 108.
02:56
<@celticminstrel>
o.o
02:56
< Derakon_>
y is compared against width instead of height.
02:56
< Derakon_>
Thus making it think that all cells that have y > width have no neighbors.
02:57
<@celticminstrel>
Well, I guess I can make another PR now... >_> That fixes it.
03:00
<@celticminstrel>
Thanks.
03:02
< Derakon_>
No problem. Thanks for your help with Lua.
03:04
<~Vornicus>
There are tests but they don't seem to cover cellular. Meh!
03:05 macdjord|wurk is now known as macdjord
03:09
<@celticminstrel>
?
03:13
<~Vornicus>
Looking at the rot.js codebase. While there is a test suite, there isn't a group of tests for the cellular automata system
03:13
<@celticminstrel>
Ah.
03:38
<&McMartin>
omg
03:38 * McMartin gets a sound out of his simulated Adlib card
03:57
<&[R]>
Congrats
03:59
<&McMartin>
*And* I managed to not make the BIOS flip out and die
03:59
<&McMartin>
Which turns out to be a bit of a challenge, because there's a bunch of sensitive timing bits
04:50 Derakon [chriswei@Nightstar-5mvs4e.ca.comcast.net] has quit [Ping timeout: 121 seconds]
04:59 Derakon [chriswei@Nightstar-5mvs4e.ca.comcast.net] has joined #code
04:59 mode/#code [+ao Derakon Derakon] by ChanServ
05:09 Vashicus [Vash@Nightstar-uhn82m.ct.comcast.net] has quit [Connection closed]
05:13 Derakon_ [Derakon@Nightstar-4h95jf.ca.comcast.net] has quit [[NS] Quit: This computer has gone to sleep]
06:31 catadroid` [catalyst@Nightstar-45vtdp.dab.02.net] has joined #code
06:32 celticminstrel [celticminst@Nightstar-h4m24u.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
06:33 catadroid [catalyst@Nightstar-rut4et.dab.02.net] has quit [Ping timeout: 121 seconds]
06:59 Derakon [chriswei@Nightstar-5mvs4e.ca.comcast.net] has quit [Ping timeout: 121 seconds]
07:06 macdjord is now known as macdjord|slep
07:13 Derakon [chriswei@Nightstar-5mvs4e.ca.comcast.net] has joined #code
07:13 mode/#code [+ao Derakon Derakon] by ChanServ
07:44 Derakon [chriswei@Nightstar-5mvs4e.ca.comcast.net] has quit [Ping timeout: 121 seconds]
07:47 Derakon [chriswei@Nightstar-5mvs4e.ca.comcast.net] has joined #code
07:47 mode/#code [+ao Derakon Derakon] by ChanServ
08:02 Kindamoody[zZz] is now known as Kindamoody
10:11 gnolam [lenin@Nightstar-t1tbf0.cust.bahnhof.se] has quit [[NS] Quit: SACRIFICE]
10:34 Kindamoody is now known as Kindamoody|afk
11:07 catalyst [catalyst@Nightstar-bt5k4h.81.in-addr.arpa] has joined #code
11:50 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
12:41
<@Azash>
https://www.bunniestudios.com/blog/?p=3554
13:01 catadroid [catalyst@Nightstar-8n2v7q.dab.02.net] has joined #code
13:04 catadroid` [catalyst@Nightstar-45vtdp.dab.02.net] has quit [Ping timeout: 121 seconds]
13:30
<@TheWatcher>
Azash: that's kinda terrifying
13:47
<@Azash>
TheWatcher: https://www.youtube.com/watch?v=r3GDPwIuRKI
13:47
<@Azash>
"You're not storing data, you're storing a probabilistic approximation of your data"
14:57
<@abudhabi>
What's a good JavaFX tutorial?
14:58
<@abudhabi>
(Not learning for any practical application; was hired to do Java instruction and I need to explain how that shit works.)
15:41 catalyst [catalyst@Nightstar-bt5k4h.81.in-addr.arpa] has quit [[NS] Quit: Leaving]
15:42 catalyst [catalyst@Nightstar-bt5k4h.81.in-addr.arpa] has joined #code
17:34 celticminstrel [celticminst@Nightstar-h4m24u.dsl.bell.ca] has joined #code
17:34 mode/#code [+o celticminstrel] by ChanServ
18:02 catalyst [catalyst@Nightstar-bt5k4h.81.in-addr.arpa] has quit [[NS] Quit: Leaving]
18:31 Alek [Alek@Nightstar-cltq0r.il.comcast.net] has quit [Ping timeout: 121 seconds]
18:34 Alek [Alek@Nightstar-cltq0r.il.comcast.net] has joined #code
18:34 mode/#code [+o Alek] by ChanServ
19:31 catadroid` [catalyst@Nightstar-79ktfv.dab.02.net] has joined #code
19:34 catadroid [catalyst@Nightstar-8n2v7q.dab.02.net] has quit [Ping timeout: 121 seconds]
19:44 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
19:44 mode/#code [+qo Vornicus Vornicus] by ChanServ
20:34 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
20:46
<@celticminstrel>
"return new this(...)" o.o
20:57
<&[R]>
Yeah, you can do a few things to change the value of "this", including making it a function.
20:59
<&[R]>
You could also do: function constructor() { this.is = {the: 'constructor'} }; constructor.method = function() { return new this }; constructor.method()
21:07
<@celticminstrel>
In this case it was a method on a specific function.
21:09 * celticminstrel is trying to decide how to generate ruins on the surface. ROT's dungeon generators don't seem great for it, though the room sub-generator might be helpful.
21:12
<@celticminstrel>
Even that though seems to assume a digging paradigm though...
21:46
<@celticminstrel>
The divided maze generator looks surprisingly close to something I'd want.
21:47
<@celticminstrel>
But it doesn't offer any options.
21:47
<@celticminstrel>
Maybe I could extend it though...
21:51
<@celticminstrel>
Well, I could apply the same algorithm though.
21:52
<@celticminstrel>
Or a similar one.
22:52 Kindamoody|afk [Kindamoody@Nightstar-0lgkcs.tbcn.telia.com] has quit [Ping timeout: 121 seconds]
23:00 Vorntastic [Vorn@Nightstar-03rtgq.sub-174-199-34.myvzw.com] has joined #code
23:05 Vorntastic [Vorn@Nightstar-03rtgq.sub-174-199-34.myvzw.com] has quit [Ping timeout: 121 seconds]
23:13 catalyst [catalyst@Nightstar-bt5k4h.81.in-addr.arpa] has joined #code
23:20 Vorntastic [Vorn@Nightstar-03rtgq.sub-174-199-34.myvzw.com] has joined #code
23:27 Kindamoody [Kindamoody@Nightstar-0lgkcs.tbcn.telia.com] has joined #code
23:27 mode/#code [+o Kindamoody] by ChanServ
23:55 macdjord|slep is now known as macdjord|dance
--- Log closed Sun Nov 27 00:00:11 2016
code logs -> 2016 -> Sat, 26 Nov 2016< code.20161125.log - code.20161127.log >

[ Latest log file ]