code logs -> 2011 -> Fri, 25 Mar 2011< code.20110324.log - code.20110326.log >
--- Log opened Fri Mar 25 00:00:12 2011
00:02
< gnolam>
"Programming is like sex. It's sweaty, dirty work, and sometimes nothing comes out."
00:11 Rhamphoryncus [rhamph@C06FE3.F5723C.BE3FEB.9D4666] has joined #code
00:15 You're now known as TheWatcher[T-2]
00:20 You're now known as TheWatcher[zZzZ]
01:03 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?]
01:18 Alek [omegaboot@Nightstar-96006922.il.comcast.net] has joined #code
01:19
<@Derakon>
It's been too long since I did graph theory.
01:20
<@Derakon>
Any of you remember the name of the algorithm that calculates the node-node distances of the graph?
01:20
<@Derakon>
(I mean for every node pair, since I'm trying to find long travel times)
01:21
<@Derakon>
I guess iterating Dijkstra's algorithm for each node?
01:23
<@Derakon>
...unfortunate. The Longest Path Problem in graph theory is NP-complete.
01:36
<@Derakon>
Actually, what I want is the actual longest path, not just its distance, so Dijkstra's is out unless I want to make it annoyingly stateful.
01:37 Kindamoody|nap is now known as Kindamoody
01:41
<@Derakon>
Hrm, actually I should figure out exactly how this algorithm's supposed to work before I go any further.
01:42
<@Derakon>
The goal is to add some shortcut edges within a given edge group.
01:42
<@McMartin>
Hum
01:42
<@McMartin>
Lame cheaty version
01:42
<@McMartin>
Negate all the weights, run Dijkstra outright?
01:42
<@Derakon>
So I want to find edges that are far apart on the graph (in terms of number of edge hops), and then try to insert edges into the graph that bring them closer together.
01:42
<@Derakon>
McM: only works if the graph is acyclic.
01:43
<@McMartin>
You should be able to guarantee that if you're starting from a given point
01:43
<@Derakon>
So I could do that for one loop, but after that I'm on my own.
01:44
<@Derakon>
I suppose what I could do is just consider each pair of nodes in the triangulation, check their distance according to Dijkstra, and if they're far apart, then connect them.
02:40 Attilla [Some.Dude@37647E.0E7447.22C7B1.567421] has quit [Ping timeout: 121 seconds]
02:59 cpux is now known as shade_of_cpux
03:27 * Derakon spends about half an hour trying to figure out why his loopback code is making the map disconnected before discovering that no, it's a different part of the system that's doing that.
03:30
<@Derakon>
The difficulty here is that I have a region mapping like this: http://wiki.jetblade.googlecode.com/hg/images/articles/mapgen/regions.png
03:30
<@Derakon>
And I need to generate a set of edges crossing the boundaries of the different regions.
03:30
<@Derakon>
But I want each edge to be far away from other edges to the extent possible.
03:49 * Derakon eyes his code.
03:49
<@Derakon>
if not shouldContinue:
03:49
<@Derakon>
continue
03:49
<@McMartin>
Shoryukens for all
03:51
<@Namegduf>
XD
03:52
<@Namegduf>
An unfortunate combination of names.
03:52
<@Derakon>
When I was writing the code, I meant "should continue the process of adding this node".
03:52
<@Derakon>
And of course, "continue" means "skip the rest of this iteration".
03:52
<@Namegduf>
Yes.
03:54
<@McMartin>
Might want to rename that bad boy 'finished' or 'skip' and reverse its polarity
03:55
<@Derakon>
Actually I'm trying excising that particular bit of code entirely.
03:57
< celticminstrel>
XD
04:14 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
04:14 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Client closed the connection]
04:30
<@Derakon>
If two items hash to the same value, and one of them is in a dict, then I ought to be able to use the other to access the first one's entry in the dict...right?
04:32
<@Namegduf>
Generally no.
04:32
<@Derakon>
Why not?
04:32
<@Namegduf>
A key collision will be detected and handled.
04:32
<@Namegduf>
Storing the key along with the value so it can be compared to check is one way.
04:32
<@Namegduf>
Same way collisions during assigning won't do that.
04:33
<@Derakon>
The problem I have with this is that I'm sure I have this kind of thing working elsewhere in the program.
04:33
<@Namegduf>
It will see that it isn't the same key already in the hash and apply one of the various options for handling collisions.
04:33
<@Derakon>
Which is why it's so surprising that it's broken down here.
04:33
<@Derakon>
I specifically designed my Vector2D class to allow it to be used in dicts without having to keep a specific Vector2D instance around.
04:34
<@Derakon>
And it's worked just fine up to now, when it's suddenly refusing to admit that a given position is in a dict.
04:36
< celticminstrel>
If they hash to the same value and compare equal, though...
04:37
<@Namegduf>
Yeah, that will do it.
04:37
<@Derakon>
...ah, for some reason they aren't comparing equal.
04:37
<@Derakon>
Durp.
04:38
<@Derakon>
They're different types.
04:38
<@Derakon>
No wonder.
04:38
<@Namegduf>
Equality defines whether a key should match another key, hashing is basically just used to accelerate things.
05:06
<@Derakon>
Well, that fixed connectivity, but it's arse-slow.
05:07 Alek [omegaboot@Nightstar-96006922.il.comcast.net] has quit [Ping timeout: 121 seconds]
05:08
<@Derakon>
~8 seconds to make the map graph, compared to under 2 seconds with the previous method.
05:25
<@Derakon>
Looks like the main slowdown is figuring out which chunks of terrain are connected.
05:44 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
06:00 Derakon is now known as Derakon[AFK]
06:34 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
06:46 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
06:58 AnnoDomini [annodomini@D553D1.9D4909.43AA7A.2F4956] has joined #code
06:58 mode/#code [+o AnnoDomini] by Reiver
07:12 You're now known as TheWatcher
08:11 You're now known as TheWatcher[afk]
08:52 Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
08:53 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
08:53 Syloqs_AFH [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
08:55 Syloqs_AFH is now known as Syloqs-AFH
09:02 AnnoDomini [annodomini@D553D1.9D4909.43AA7A.2F4956] has quit [[NS] Quit: Going to convention.]
09:40 Kindamoody [Kindamoody@Nightstar-4764665d.tbcn.telia.com] has quit [Client exited]
09:44 Kindamoody|away [Kindamoody@Nightstar-4764665d.tbcn.telia.com] has joined #code
09:49 Kindamoody|away is now known as Kindamoody
10:02 Attilla [Some.Dude@Nightstar-92c9199f.cable.virginmedia.com] has joined #code
10:02 mode/#code [+o Attilla] by Reiver
10:19 You're now known as TheWatcher
10:47 SmithKurosaki [smith@DCDEB4.F95CFD.2EEAA4.B1AE3D] has quit [Ping timeout: 121 seconds]
10:49 Kindamoody is now known as Kindamoody|out
11:22 You're now known as TheWatcher[d00m]
12:02 You're now known as TheWatcher
--- Log closed Fri Mar 25 12:14:15 2011
--- Log opened Fri Mar 25 12:14:48 2011
12:14 TheWatcher [chris@Nightstar-b4529b0c.zen.co.uk] has joined #code
12:14 Irssi: #code: Total of 25 nicks [10 ops, 0 halfops, 0 voices, 15 normal]
12:14 mode/#code [+o TheWatcher] by Reiver
12:15 Irssi: Join to #code was synced in 55 secs
14:18 SmithKurosaki [smith@Nightstar-7820a96a.dsl.teksavvy.com] has joined #code
14:39 You're now known as TheWatcher[afk]
14:42 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
15:27 Reiv [orthianz@ServerAdministrator.Nightstar.Net] has quit [Connection reset by peer]
15:27 Reiv [orthianz@3CF3A5.E1CD01.36D449.95F5A5] has joined #code
16:24 Derakon[AFK] is now known as Derakon
16:35 * Derakon mutters at Python for not having a convenient way to create an empty 2D array.
16:36
<@Derakon>
You can do [[None] * width] * height, but you end up with an array of length height of references to the same single array of length width.
16:37
< celticminstrel>
Not quite convenient, but what about "x = [(None) * width] * height; x = [list(y) for y in x]"? Would that work?
16:37
<@Derakon>
Probably, yeah.
16:38
<@Derakon>
It's just ugly.
16:38
<@Derakon>
You can also do something like "foo = [[None for i in xrange(height)] for j in xrange(width)]"
16:38
< celticminstrel>
Ah yes, that works too.
16:45
< SmithKurosaki>
So, I'm watching CCP's fanfest - apparently they use git :)
16:46 Reiv [orthianz@3CF3A5.E1CD01.36D449.95F5A5] has quit [Connection reset by peer]
16:46 Reiv [orthianz@3CF3A5.E1CD01.36D449.95F5A5] has joined #code
17:14 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
17:29 Alek [omegaboot@490720.5E22A0.CA107A.D7BF53] has joined #code
17:35 AnnoDomini [annodomini@Nightstar-606e76a5.icpnet.pl] has joined #code
17:35 mode/#code [+o AnnoDomini] by Reiver
17:49 Reiv [orthianz@3CF3A5.E1CD01.36D449.95F5A5] has quit [Connection reset by peer]
17:49 Reiv [orthianz@3CF3A5.E1CD01.36D449.95F5A5] has joined #code
17:53 Rhamphoryncus [rhamph@C06FE3.F5723C.BE3FEB.9D4666] has quit [Client exited]
17:57 AnnoDomini is now known as Ed
18:01 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
18:36 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
19:00 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
19:04
<@Derakon>
Man, in the 240s it took to generate this oversized map, I spent 4s in os.path.join.
19:04
<@froztbyte>
hah
19:04
<@Derakon>
That's only 156584 calls. You'd think it'd be faster.
19:11 Tarinaky is now known as Caeldir
19:12 Kindamoody|out is now known as Kindamoody
19:21 Stalker [Z@5E691D.FC7C16.75EF63.7C4DDA] has joined #code
19:23 Ed is now known as Zon
19:43 Stalker [Z@5E691D.FC7C16.75EF63.7C4DDA] has quit [Ping timeout: 121 seconds]
19:54 Stalker [Z@2C3C9C.B2A300.F245DE.859909] has joined #code
19:58
<@jerith>
os.path.join is known to be less efficient than non-portable joins.
19:59
<@jerith>
You /could/ cache things, but it's only 2% of your time.
19:59
<@jerith>
Uless you actually have 150k different paths you're joining?
20:00
<@Derakon>
Heh, no.
20:46 You're now known as TheWatcher
21:51
< Alek>
"And my grandma remembers wireless irons..."
22:10 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
22:16 Derakon is now known as Derakon[AFK]
22:36 Alek [omegaboot@490720.5E22A0.CA107A.D7BF53] has quit [Client closed the connection]
22:37 Alek [omegaboot@490720.5E22A0.CA107A.D7BF53] has joined #code
22:39
<@McMartin>
Shit, I remember those. We had one when I was a kid.
22:39
<@McMartin>
We used it as a doorstop, sure, but we had one!
23:10 Derakon[AFK] is now known as Derakon
23:23 shade_of_cpux is now known as cpux
23:48 Zon is now known as Zezeze
--- Log closed Sat Mar 26 00:00:57 2011
code logs -> 2011 -> Fri, 25 Mar 2011< code.20110324.log - code.20110326.log >