code logs -> 2008 -> Thu, 10 Jan 2008< code.20080109.log - code.20080111.log >
--- Log opened Thu Jan 10 00:00:04 2008
00:26 You're now known as TheWatcher[t-2]
00:29 Vornicus [~vorn@Admin.Nightstar.Net] has quit [Ping Timeout]
00:30 Vornotron [~vorn@Admin.Nightstar.Net] has joined #code
00:30 Vornotron is now known as Vornicus
00:31 You're now known as TheWatcher[zZzZ]
00:32 You're now known as NSGuest-4237
00:36 You're now known as TheWatcher[zZzZ]
00:38 Reivles [~dogmatix@Nightstar-2154.dsl.telstraclear.net] has joined #Code
01:26 Vornicus is now known as Darius
--- Log closed Thu Jan 10 01:32:59 2008
--- Log opened Thu Jan 10 01:33:33 2008
01:33 TheWatcher[zZzZ] [~chris@82.71.33.ns-26612] has joined #code
01:33 Irssi: #code: Total of 17 nicks [6 ops, 0 halfops, 0 voices, 11 normal]
01:33 mode/#code [+o TheWatcher[zZzZ]] by ChanServ
01:34 Irssi: Join to #code was synced in 46 secs
02:58 C_tiger [~c_wyz@Nightstar-5325.nycmny.east.verizon.net] has quit [Quit: BRB.]
03:07 C_tiger [~c_wyz@Nightstar-5325.nycmny.east.verizon.net] has joined #code
03:55 C_tiger [~c_wyz@Nightstar-5325.nycmny.east.verizon.net] has quit [Quit: Filled]
04:02 C_tiger [~c_wyz@Nightstar-5325.nycmny.east.verizon.net] has joined #code
04:16
< Darius>
Hey, look, my site-generating code works.
04:25 * Darius now tries to figure out the path-generating code.
05:39 Darius is now known as Vornicus
05:41 Syloqs-AFH [Syloq@Admin.Nightstar.Net] has quit [Connection reset by peer]
--- Log closed Thu Jan 10 06:25:17 2008
--- Log opened Thu Jan 10 06:25:54 2008
06:25 TheWatcher[zZzZ] [~chris@Nightstar-29731.dsl.in-addr.zen.co.uk] has joined #code
06:25 Irssi: #code: Total of 16 nicks [6 ops, 0 halfops, 0 voices, 10 normal]
06:25 mode/#code [+o TheWatcher[zZzZ]] by ChanServ
06:26 Irssi: Join to #code was synced in 44 secs
06:58 * Vornicus fiddles with the path-generating code. 1. generate all possible paths and sites. 2. filter sites to remove those without three regions. 3. filter paths to remove those where one or both sites have been filtered.
07:20
< Reivles>
??
07:25
< Vornicus>
I'm writing the thing that goes from a board template to a board.
07:28
< Reivles>
???
07:30
< Vornicus>
For VornSettlers
07:32
< Reivles>
Ah!
07:36
< Vornicus>
hm. Interesting bit: I have to represent paths in a canonical direction.
07:37
<@McMartin>
lolclox
07:37
< Vornicus>
lolclox?
07:38
<@McMartin>
Isn't clockwise the traditional one?
07:38
<@McMartin>
Cross product goes into the screen?
07:38
< Vornicus>
Ah. That is the difficulty
07:39
< Reivles>
?
07:39
< Vornicus>
See, the thing is, each eventually valid path gets generated twice.
07:39
< Vornicus>
if I go around each region clockwise, the two generations are the reverse of one another.
07:40
< Vornicus>
(I am, in fact, going around each region clockwise)
07:48
< Vornicus>
So I have to make a canonical direction, so that I can tell when I've duplicated.
07:48
<@McMartin>
Checking the signs of the cross products of any two adjacent vectors should do that.
07:50 * Vornicus tries to figure out what McM is trying to say.
07:50 * Vornicus can't really see how that helps.
07:51
<@McMartin>
OK, each path is a series of directed line segments, right?
07:51
< Vornicus>
it is a single line segment.
07:51
<@McMartin>
... then it doesn't go clockwise at all, does it?
07:51
< Vornicus>
And, in the end, may not even include actual positional data in itself.
07:51
< Vornicus>
It goes 'clockwise' around the region it is generated from.
08:15
< Vornicus>
Hm. Probably sets is the right way to do it. It gives me the code to check things pretty cheaply too.
08:15
< Vornicus>
....but, oh, ew. That means using a restricted thing for a large segment of code; sites and paths are, in the end, mutable.
08:16
< Vornicus>
And sets require immutability for the things that they hold.
08:38 You're now known as TheWatcher
08:41 * Vornicus fiddlefiddles.
09:40 * TheWatcher blinks
09:40
<@TheWatcher>
... what is it you're tring to do?
09:42
<@TheWatcher>
If it's just pathfinding, have you looked at A* or one of its varients?
09:44
< Vornicus>
It's not pathfinding
09:44
< Vornicus>
it's Settlers - a place where you can put a road or a ship is called a path.
09:47
< Vornicus>
I am generating paths by going around the hexes and using each site pair to generate one path.
09:47
< Vornicus>
Thing is that by doing this you get each path twice - once from the hex on one side, and once in the opposite direction from the hex on the other side.
09:49 * C_tiger futilely argues for generating all the sites first and then the paths second.
09:51
< Vornicus>
Which in the end is either n^2 or requires a lot of extra knowledge attached to each site.
09:52 * TheWatcher ponders
09:52
< C_tiger>
How is it n^2? you have the hexes generated.
09:53
< Vornicus>
n^2: for each site: for each possible other-end of the path: search the list of valid sites for the other end.
09:53
<@TheWatcher>
If you're just doing a straight clone of SoC, aren't you only looking at maybe 40 to 50 tiles anyway?
09:54
<@TheWatcher>
that's, um, nothing.
09:54
< C_tiger>
Yes, but for each site you only have to check the other sites that are attached to hexes attached to this site.
09:54
< Vornicus>
I know it's nothing, but I'm already iterating over regions, and I need to associate paths with regions.
09:54
< C_tiger>
Since hex->site is a known.
09:55
< C_tiger>
And plus each time you resolve a site, a site gets taken out of the list.
09:56
< Vornicus>
huh?
09:57 * TheWatcher thinks he sees what C is going after - since you have a complete set of hexes, and know how those hexes are placed next to each other, you only actually need to search at most the neighbouring 6 hexes, not all of them
09:57
< C_tiger>
It's a pairings problem, A-B, A-C, A-D but when you check B, you skip A.
09:57
< C_tiger>
And since you're going right-to-left, you only have to check the left 3 hexes.
09:57
< C_tiger>
(say)
09:58 * TheWatcher shrug, goes back to beating servers heavily with a stick
10:00 mode/#code [+o Vornicus] by Vornicus
10:00
<@Vornicus>
http://vorn.dyndns.org/~vorn/catan/3/ <--- for those of you playing along at home. a hex is a region/hex; a site is a corner of a hex (all valid sites are shown here in yellow - if there aren't three hexes around it, it's not valid); a path is an edge of a hex (if there's not a site at each end, it's not valid).
10:01
< C_tiger>
PS, your wood icon looks like little houses :)
10:02
<@Vornicus>
That was intentional. :)
10:02 * Vornicus was trying to find something that looked like it was made of wood, and after ten attempts at making log-ish logs, gave up.
10:04
< C_tiger>
Actually, how are you generating sites-from-hexes?
10:05
<@Vornicus>
for hex in hexes: for offset in site_offsets: if hex.coords + offset in sites: sites[hex.coords + offset].append(hex); else: sites[hex.coords + offset] = [hex]
10:05
<@Vornicus>
and then filter on length of the list
10:06
< C_tiger>
Can't you co-op the code and generate "nearby sites" the same way?
10:06
<@Vornicus>
Not nicely.
10:06
< C_tiger>
Really?
10:06
<@Vornicus>
As far as I can see, anyway
10:08
< C_tiger>
For site in (remaining_sites): for (1..3): if site+offset is not in remaining_sites, make path
10:08
< C_tiger>
offset[i]
10:09
< C_tiger>
I dunno, that was godawful pseudocode.
10:09
<@Vornicus>
That was pretty bad, yes.
10:10
< C_tiger>
But the idea is that you have a set of remaining sites, for each site, you find the nearby 3 with offsets. If any of them are in the remaining sites list, you make a path. Then you take the original site out of the remaining sites list.
10:11
< C_tiger>
It's 5AM, and I've forgotten how to code python already.
10:11
<@Vornicus>
ah, so
10:11
<@Vornicus>
Tricky bit then would be to say "hey, which handedness am I?"
10:12
< C_tiger>
what do you mean handedness?
10:12
<@Vornicus>
Look at the sites directly to the left and right of any given region
10:12
< C_tiger>
ok...
10:13
<@Vornicus>
Notice how one looks like -< and the other looks like >- ?
10:13
< C_tiger>
Yes, ah.
10:13
< C_tiger>
Ok, check 6 offsets.
10:13
< C_tiger>
It's the same 6 as when you're generating hexes to sites.
10:14
< C_tiger>
Hence my comment about coopting code.
10:14 * Vornicus eyes, fiddles. Wonders if they'reactually the same.
10:14
< C_tiger>
They have to be.
10:14
< C_tiger>
triangular grid.
10:15 * Vornicus fiddles in a drawing program.
10:16
< C_tiger>
Another way of putting it: draw a hex around each site. You'll hit another site or the center of a hex at each point.
10:17
< C_tiger>
(Which is how I first proposed you make the whole thing: make a triangular grid and pull out alternate points as hexes and sites.)
10:18 * Vornicus fiddlefiddles, gets a result... which says that they would not be the same offsets, generally.
10:18
< C_tiger>
really?
10:19
< C_tiger>
your math is funny.
10:19
<@Vornicus>
yeah.
10:19
< C_tiger>
If they're perfect hexagons they're the same offsets.
10:20
<@Vornicus>
Not perfect hexagons. Too much riding on getting the locations right, then.
10:21
< C_tiger>
Ugh. In this case, I would really root for taking the make a triangular grid and eliminate sites approach.
10:22
< C_tiger>
Because then even if they aren't perfect, it doesn't matter at all.
10:24
<@Vornicus>
problem is
10:24
<@Vornicus>
I can't figure out how the 'triangular grid' approach works at all with trying to load in data.
10:24
<@Vornicus>
This, I've already got it mostly written.
10:25
< C_tiger>
(also, even if they weren't perfect, as long as the horizontal diameter is exactly double the horizontal side length, it should work.)
10:25
< C_tiger>
I don't follow. We're just generating a list of coordinates, right?
10:25
< C_tiger>
Or are you loading data in on the fly?
10:26
<@Vornicus>
We're loading data - terrain data - in, then generating the coordinates.
10:27
< C_tiger>
Rather than the approach I'm advocating which is generate the coordinates, then load the data and use pregenerated coordinates.
10:27
<@Vornicus>
Because each set of terrain data is a different shape.
10:28
< C_tiger>
oh, I see, not the hex type data.
10:28 * TheWatcher flails, can't find a piece of code he's certain he's already written, wtf
10:29
< C_tiger>
Ok, fine. Back to the point I had originally, this should still work as long as length-of-horiz-side = 1/2 horiz diameter.
10:29
<@Vornicus>
Which is, in the end, not the case, for the coordinate system I have.
10:30
< C_tiger>
So there's no symmetry in your offsets, oh man.
10:30
< C_tiger>
that sucks.
10:30
<@Vornicus>
Offsets are (1,1) (0,1) and (1,0)
10:30
<@Vornicus>
and their sign-flipped cousins.
10:30
<@Vornicus>
well, between-hex offsets.
10:31
< C_tiger>
Should still work.
10:31 * Vornicus eyes.
10:32 * TheWatcher vaguely wonders how you're storing those maps in memory, actually
10:32
< C_tiger>
Oh, wait maybe not.
10:32
<@Vornicus>
...oh, heck, it does.
10:33
< C_tiger>
No, it should. I'm confusing myself.
10:33
< C_tiger>
But in theory if there's right-left symmetry you're fine.
10:33
< C_tiger>
And if there isn't you're already fubared.
10:33
<@Vornicus>
TW: board is a list of regions, sites, paths, harbors
10:34
<@Vornicus>
And then the regions sites paths and harbors all know what other regions sites paths and harbors they are connected to.
10:35
< C_tiger>
That said, I'm not entirely sure what you mean by (1,1), (0,1) and (1,0)
10:36
< C_tiger>
If you mean your hexes are rotated pi/4, it should still work.
10:36
<@Vornicus>
http://vorn.dyndns.org/~vorn/catan/coords.png
10:36
<@Vornicus>
Stars are hex centers; the hexagon is the shape of one hex.
10:37
<@Vornicus>
your duplicate-offsets thing works, actually.
10:37
< C_tiger>
Ok, but it should...
10:37
< C_tiger>
yeah.
10:37
< C_tiger>
Ok.
10:37
< C_tiger>
Way to totally freak me out for a second.
10:38
<@Vornicus>
I actually scale it up by 3 to do the site counting.
10:40
< C_tiger>
Anyhow, my horrible pseudocode nonwithstanding, that would be how I'd approach it.
10:41 * C_tiger ponders... it'd be easier to code (at least in my head) the algorithm recursively but I always get the feeling that recursion doesn't make for actual efficiency.
10:42
<@Vornicus>
It's not a naturally recursive algorithm, as far as i can see.
10:42
<@TheWatcher>
C: depends on your metric for efficiency
10:42
<@TheWatcher>
(and on the situation, obviously)
10:43
<@Vornicus>
Some algorithms do it nicely; this one is while available_sites: current = available_sites.pop(); for offset in offsets: if current + offset in available_sites: pathify(current, current + offset)
10:44
<@Vornicus>
...which, uh, actually works, so long as you define pathify and Site.__add__
10:44
< C_tiger>
Oh right, I always forget about while :P
10:44
<@Vornicus>
heh.
10:45
<@Vornicus>
For is so awesome that you rarely end up using while.
10:45
< C_tiger>
yes.
10:46
< C_tiger>
Anyhow, that was what I was trying to say. Also, in your little picture, your hex is drawn wrong.
10:46
<@Vornicus>
No, it's drawn right.
10:47
<@Vornicus>
each vertex is the average of the three hex centers around it.
10:47
< C_tiger>
Oooh.
10:48
< C_tiger>
Yeah, I know you said that, but visually reading it is totally different.
10:50
< C_tiger>
I'm still at a loss how you go from that to rendering non-rotated hexes.
10:50
<@Vornicus>
A matrix transform.
10:50
< C_tiger>
Oh, duh.
10:51
<@Vornicus>
Which I haven't actually written - the page you see was done by hand.
10:53
< C_tiger>
You have too much patience :P
10:53
< C_tiger>
Just a word of advice. If you have more than 20-odd div tags on a page, firefox starts slowing down.
10:54
<@Vornicus>
Heh. No div tags there; just images with absolute positioning.
10:54
<@Vornicus>
I have too much patience, and am dangerous with search+replace
10:54
< C_tiger>
At 700 div tags (which is what we're using to debug this problem), you can get to the store and back in the time it takes to render this stuff.
10:55
< C_tiger>
(And by we, I mean the devs with me looking over their shoulder because I'm super curious like that.)
10:55
<@Vornicus>
O.o
10:55
<@Vornicus>
C: what is your job?
10:55
< C_tiger>
Nothing right now.
10:55
< C_tiger>
So I'm doing tech support for firefox as a volunteer position.
10:55
<@Vornicus>
Aha.
10:56
< C_tiger>
And part of that is watching bugs get fixed.
10:57
<@Vornicus>
I use divs extensively, often - I don't have to worry about the various strange defaults that p gives me, so there's a lot more formatting freedom.
10:57
< C_tiger>
Just keep it reasonable. 20, fine. 50, pushing it. 100, slow. 700. Cries.
10:58
<@Vornicus>
Sounds like a quadratic or worse setup.
10:59
<@Vornicus>
One of the things I did rather often at sikorsky was export requirements lists from the requirements software into word.
10:59
< C_tiger>
That sounds like fun and a half right there.
11:00
<@Vornicus>
Which was quadratic time, which /blew goats/ when I had to get 3000 requirements. I'd sit there playing freecell for three hours.
11:02
< C_tiger>
I suck at freecell.
11:03
<@Vornicus>
I get about 70%.
11:03
<@Vornicus>
Or used to.
11:03
<@Vornicus>
Dunno how I am now.
11:03
< C_tiger>
I haven't figured out an optimum strategy.
11:06
< C_tiger>
Maybe lseep.
11:06
< C_tiger>
slepe.
11:06
< C_tiger>
sleep
11:07
<@Vornicus>
Heh
11:28
<@Vornicus>
Hey, look, that worked.
11:35
<@Vornicus>
Scary when you can write pseudocode, and drop it directly into your program after changing a few names and fleshing something out.
11:35 * Vornicus didn't even technically have to break it into multiple lines.
11:44
<@Vornicus>
...better to use the list of filtered sites. Get it right, jeez.
13:08 gnolam [lenin@85.8.5.ns-20483] has joined #Code
13:08 mode/#code [+o gnolam] by ChanServ
13:37 Xiphias [Ameroth@82.68.15.ns-4527] has joined #code
14:48 Vornicus is now known as Vornicus-Latens
15:35 Xiphias [Ameroth@82.68.15.ns-4527] has quit [Quit: I was never gone]
16:07 Netsplit Blargh.CA.US.Nightstar.Net <-> DeepThought.NY.US.Nightstar.Net quits: Serah, @EvilDarkLord, Attilla, @AnnoDomini, Reiver, @ToxicFrog, C_tiger, Pi, @Vornicus-Latens, @jerith, (+3 more, use /NETSPLIT to show all of them)
16:11 jerith [~jerith@IRCop.Nightstar.Net] has joined #Code
16:11 Chalain [~chalain@Admin.Nightstar.Net] has joined #Code
16:11 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
16:11 Serah [~Z@87.72.35.ns-26506] has joined #Code
16:11 Pi [~sysop@67.183.91.ns-3660] has joined #Code
16:11 AnnoDomini [AnnoDomini@83.21.72.ns-4440] has joined #Code
16:11 Vornicus-Latens [~vorn@Admin.Nightstar.Net] has joined #Code
16:11 gnolam [lenin@85.8.5.ns-20483] has joined #Code
16:11 ServerMode/#Code [+ooooo gnolam Vornicus-Latens AnnoDomini Chalain jerith] by Troika.TX.US.Nightstar.Net
16:12 EvilDarkLord [~jjlehto3@Nightstar-2194.vipunen.hut.fi] has joined #code
16:14 Attilla [~The.Attil@194.72.70.ns-11849] has joined #code
16:25 EvilDarkLord [~jjlehto3@Nightstar-2194.vipunen.hut.fi] has quit [Quit: AnnoDomini ]
16:30 EvilDarkLord [~jjlehto3@130.233.228.ns-13022] has joined #code
16:40 EvilDarkLord [~jjlehto3@130.233.228.ns-13022] has quit [Quit: Lost terminal]
16:42 EvilDarkLord [~jjlehto3@130.233.228.ns-13022] has joined #code
16:48 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has joined #code
16:48 mode/#code [+v DiceBot] by ChanServ
16:48 mode/#code [+o jerith] by ChanServ
16:48 mode/#code [+o Chalain] by ChanServ
16:48 mode/#code [+o Reiver] by ChanServ
16:48 mode/#code [+o Pi] by ChanServ
16:48 mode/#code [+o AnnoDomini] by ChanServ
16:48 mode/#code [+o gnolam] by ChanServ
16:48 mode/#code [-o Vornicus-Latens] by ChanServ
16:48 mode/#code [-o TheWatcher] by ChanServ
16:48 mode/#code [+o ToxicFrog] by ChanServ
16:49 EvilDarkLord is now known as NSGuest-4253
16:53 McMartin [~mcmartin@Nightstar-17577.dsl.pltn13.sbcglobal.net] has joined #code
16:53 mode/#code [+o McMartin] by ChanServ
16:53 NSGuest-4253 is now known as EvilDarkLord
16:57 C_tiger [~c_wyz@Nightstar-5325.nycmny.east.verizon.net] has joined #code
17:01 Netsplit Blargh.CA.US.Nightstar.Net <-> DeepThought.NY.US.Nightstar.Net quits: C_tiger, @McMartin, @ToxicFrog
17:11 You're now known as TheWatcher[afk]
17:17
<@AnnoDomini>
My opinion of the guy who teaches us Basics of Electronics' ability to teach sunk to a new low. He fails utterly at confirming that someone has something right. Only if one knows for certain that something is correct can someone divine whether he says you're basically right or wrong. He just fails at communication.
17:17
<@AnnoDomini>
Too bad nobody else wants his job. :/
17:42 Netsplit over, joins: McMartin, ToxicFrog, C_tiger
17:42 mode/#code [+o jerith] by ChanServ
17:42 mode/#code [+o Chalain] by ChanServ
17:42 mode/#code [+o Reiver] by ChanServ
17:42 mode/#code [+o Pi] by ChanServ
17:42 mode/#code [+o AnnoDomini] by ChanServ
17:42 mode/#code [+o gnolam] by ChanServ
17:42 mode/#code [+v DiceBot] by ChanServ
17:45 samer [~wadihdaou@Nightstar-18853.94.39.21.satgate.net] has joined #Code
18:08 samer [~wadihdaou@Nightstar-18853.94.39.21.satgate.net] has quit [Quit: ]
18:22 You're now known as TheWatcher
18:33 mode/#code [+o TheWatcher] by ChanServ
19:49 Attilla [~The.Attil@194.72.70.ns-11849] has quit [Ping Timeout]
20:07 Attilla [~The.Attil@194.72.70.ns-11849] has joined #code
21:56 AnnoDomini [AnnoDomini@83.21.72.ns-4440] has quit [Ping Timeout]
21:56 gnolam [lenin@85.8.5.ns-20483] has quit [Quit: Z?]
22:03 AnnoDomini [AnnoDomini@Nightstar-29201.neoplus.adsl.tpnet.pl] has joined #Code
22:03 mode/#code [+o AnnoDomini] by ChanServ
22:30 Vornicus-Latens is now known as Vornicus
23:47 You're now known as TheWatcher[T-2]
23:51 You're now known as TheWatcher[zZzZ]
--- Log closed Fri Jan 11 00:00:10 2008
code logs -> 2008 -> Thu, 10 Jan 2008< code.20080109.log - code.20080111.log >