code logs -> 2007 -> Sat, 29 Dec 2007< code.20071228.log - code.20071230.log >
--- Log opened Sat Dec 29 00:00:10 2007
00:01
<@EvilDarkLord>
for a, b in respective ranges, generate a, b, c if a^2 + b^2 is a perfect square?
00:02
< Vornicus>
Quite.
00:02
< Vornicus>
and the way I always learned to do that was to search - iterate over a and b and generate when it's true.
00:04
<@EvilDarkLord>
What do you need triplets for this time?
00:05
< Vornicus>
But apparently you can do it without searching - each rational number has a triple associated with it, and they're very easy to generate.
00:05
< Vornicus>
Nothing.
00:07
< Vornicus>
I was reading God Created The Integers and it described the pattern of certain sets of pythagorean triplets, and then it just fell into my head that there's a really simple underlying pattern, and that you can use that pattern to generate as many triplets as you'd want.
00:51
< Vornicus>
(the thing about triplets is that they get rarer as the numbers go higher - there's 18 where a and b are under 100, and 90 where a and b are under 500)
01:08
<@ToxicFrog>
Vornicus: if/when you get that web-based Settlers of Catan thing working, my entirely family and all but one of the Hayles-Kenyans are eager to help beta test.
01:08
<@ToxicFrog>
(I talked the parents into getting Settlers four days ago. Since then we have played nothing else and have already gotten an expansion pack)
01:09
< Vornicus>
Which pack?
01:12 Vornicus is now known as Darius
01:12
< Darius>
(I far prefer Seafarers, because it just seems like, well, the same game except more polished; C&K tends to eat the pace all to hell, because 1. there's much more upkeep, and 2. there's a lot more stuff to consider.
01:13
<@ToxicFrog>
Just a +players one.
01:14
<@ToxicFrog>
We haven't tried Seafarers/Starfarers/C&K yet.
01:14
< Darius>
Ah
01:15
< Darius>
Starfarers is not an expansion to Settlers but an independent game.
01:15
< Darius>
Also, have you played Carcassonne?
01:15
<@ToxicFrog>
Yeah, but it's one we want to try at some point.
01:15
<@ToxicFrog>
And no, I haven't.
01:15
<@ToxicFrog>
How goes Settlers-by-Web, anyways?
01:16
< Darius>
Settlers-by-Web keeps getting pushed aside for other projects.
01:21
< Darius>
Mainly right now I'm getting mired in the damn schema; I keep running over the same questions and never getting a satisfactory solution.
01:23
<@ToxicFrog>
;.;
01:27
< Darius>
The real humdinger is the board template to in-game board thing - a template needs a lot less information than an actual game board, but you have to be able to create the board straight from the template. Exactly how much information I need to maintain when editing boards is a hard problem.
01:48
< Darius>
(technically you should only need harbors and regions for a board, and adding more than that tends to make maintaining integrity while editing very difficult. However, you need site, path, harbor2site, path2site, region2site, and path2region for various rules, so you have to be able to generate those)
02:04 Carn_Carby [~carn_carb@Nightstar-10708.dsl.irvnca.pacbell.net] has joined #code
02:05
< Carn_Carby>
'evening =)
02:06
< Darius>
Carn!
02:06
< Darius>
<--- is Vornicus
02:06
< Carn_Carby>
HI VORN =D
02:06 * Carn_Carby breathes a sigh of relief
02:07
< Carn_Carby>
How's it going?
02:07
< Darius>
It's going good.
02:07
< Darius>
Have some ice cream. <DDDDDDD
02:07 * EvilDarkLord waves to the new guy.
02:08
< Carn_Carby>
Yay, ice cream!!!!!!!
02:08
< Darius>
How's it going on your end?
02:08
< Carn_Carby>
It's going alright
02:08
< Carn_Carby>
It's super cold
02:09
< Carn_Carby>
well, for LA
02:09
< Carn_Carby>
XD
02:09
< Carn_Carby>
oh, oops
02:09 * Carn_Carby waves to EvilDarkLord
02:09
< Carn_Carby>
hmmm
02:10
< Carn_Carby>
so which one of these O'Reilly books about Python should I read, Vorn?
02:10
< Carn_Carby>
;)
02:10
< Darius>
I don't know, I don't have any of them.
02:10
< Darius>
I learned Python from the official tutorial.
02:11
< Carn_Carby>
Ah
02:11
< Carn_Carby>
I think dacut linked that to me a while back
02:11
<@EvilDarkLord>
Dive Into Python is good after that.
02:12 mode/#code [+o Darius] by Darius
02:12 ServerMode/#Code [-o MyCatVerbs] by Blargh.CA.US.Nightstar.Net
02:12
<@Darius>
http://www.python.org/doc/ <--- have the full documentation. The bit labelled "tutorial" is exactly that.
02:12 mode/#code [+o MyCatVerbs] by EvilDarkLord
02:12 mode/#code [+o-o+o MyCatVerbs EvilDarkLord EvilDarkLord] by Darius
02:13
< Carn_Carby>
Aha
02:13
< Carn_Carby>
Thanks =D
02:13
< Carn_Carby>
And thanks, EvilDarkLord
02:13
< Carn_Carby>
I will go read
02:13
< Carn_Carby>
^_^
02:13 * Carn_Carby waves
02:13 mode/#code [+ooo Attilla Carn_Carby Kazriko] by Darius
02:13 Carn_Carby is now known as Carn[away]
02:14
<@Attilla>
Woo!
02:18
<@McM[SanDiego]>
zomg Carn
02:18
<@Darius>
zomg indeed.
02:20
<@McM[SanDiego]>
OK, an IF fairness question.
02:20
<@Darius>
OK.
02:21
<@McM[SanDiego]>
I've got a puzzle you can't fail.
02:21
<@Darius>
Like, succeed-or-die, or it's literally impossible to fail?
02:21
<@McM[SanDiego]>
The latter. But I'm considering doing the scoring so you only get full points for solving it if you do it within a reasonably tight, unstated time limit.
02:21
<@Darius>
That sounds fair.
02:23
<@McM[SanDiego]>
(Well, OK, I think it's impossible to fail. I try to prevent it. If it happens anyway (there's an easy way to check if it does), I kill them with *** You have discovered a serious error ***
02:23
<@McM[SanDiego]>
)
02:24
<@Darius>
Yeah, that sort of thing is reasonably common in games of all stripes.
02:25
<@McM[SanDiego]>
This is the stardock puzzle. I try to automatically prevent collisions.
02:25
<@McM[SanDiego]>
But if the move reversals still result in the ships intersecting...
02:26
<@Darius>
Lots of games with ratings - Cave Story's Sacred Ground comes to mind, the way it changes the credits music depending on how fast you finish - have unstated time limits.
02:29
<@Darius>
I don't see how an IF is different in that regard.
02:31
<@Darius>
Stardock puzzle - you're not making Rush Hour the IF Puzzle, are you?
02:33
<@McM[SanDiego]>
I don't think so.
02:35
<@Darius>
(Rush Hour being a puzzle game where you have to push around various pieces to get a particular car out of the gridlock)
02:36
<@Darius>
http://www.puzzles.com/products/rushhour.htm <---
02:36
<@Carn[away]>
ah!
02:36
<@Carn[away]>
I suck at that game
02:36
<@Carn[away]>
x_x
02:36
<@Darius>
Me too.
02:37
<@Carn[away]>
No no, I'm sure I'm worse, haha
02:37
<@Carn[away]>
hmm
02:37
<@Carn[away]>
so should I tackle unix commands first? -_-
02:37
<@Carn[away]>
this tutorial keeps making references
02:37
<@Carn[away]>
I feel like it's referencing quotes from a well-loved movie that everyone has seen
02:37
<@Darius>
Heh
02:38
<@Darius>
What is it that it's doing? I can probably do the same thing with less references.
02:38
<@Darius>
Well, except maybe I'll throw "you keep using that word" in there, but
02:39
<@Carn[away]>
you don't think I know what it means?
02:39
<@Carn[away]>
=P
02:39
<@Darius>
What part are you on?
02:39
<@Carn[away]>
;(
02:39
<@Carn[away]>
2.1 Invoking the Interpreter
02:39
<@Carn[away]>
hahaha
02:40
<@McM[SanDiego]>
Darius: This is with respect to the "fly an orbiting rocketship" sequence in FotH.
02:40
<@McM[SanDiego]>
I'll have Milestone 3 done Real Soon Now, honest
02:40
<@Darius>
Ah, well
02:40
<@McM[SanDiego]>
PUSH CRATE. G. G. G. G. G>
02:40
<@McM[SanDiego]>
THRILLINGS
02:40
<@Darius>
Pff.
02:41
<@Darius>
Carn: the invoking the interpreter thing is... mostly useless.
02:41
<@McM[SanDiego]>
(zSokoban exists, but it uses text-art.)
02:41
<@Carn[away]>
-_-
02:41
<@Carn[away]>
ah
02:41
<@Carn[away]>
McM
02:41
<@Carn[away]>
why are you in Sandy Eggo?
02:41
<@Carn[away]>
=)
02:41
<@Darius>
the two ways you'll use it until you start doing crazy stuff - "python" to get an interactive interpreter, and "python cheese.py" to run a particular script.
02:42
<@Darius>
Are you on Windows or *nix (including mac)?
02:42
<@Carn[away]>
Windows =)
02:42
<@Darius>
Okay, then that's all you need to know.
02:42
<@Carn[away]>
Ahhh
02:42
<@Carn[away]>
okay! =)
02:42
<@McM[SanDiego]>
Carn: Visiting family for Christmas/New Year
02:42
<@Carn[away]>
I'll move on then
02:43
<@Carn[away]>
McM: Cool beannns.
02:43
<@Darius>
(do this from an /established command prompt/ - doing it from Run will make your program go away as soon as it's done running)
03:09 Forj [~Forj@Nightstar-2443.ue.woosh.co.nz] has joined #code
03:09 mode/#code [+o Forj] by ChanServ
03:34 You're now known as TheWatcher
03:44 Attilla [~Andrew@Nightstar-23974.ipt.aol.com] has quit [Connection reset by peer]
04:10 Mana2012 [~new.world@190.80.140.ns-12188] has joined #Code
04:10 Mana2012 [~new.world@190.80.140.ns-12188] has left #Code []
04:18
<@Darius>
Mana mana.
04:21
<@C_tiger>
dodoodododoo
04:32
<@Darius>
Carn: how's it coming?
04:53 Forjeh [~Forj@Nightstar-2443.ue.woosh.co.nz] has joined #code
04:53 Forj [~Forj@Nightstar-2443.ue.woosh.co.nz] has quit [Ping Timeout]
05:02
<@ToxicFrog>
Carn yay!
05:02 * ToxicFrog pounces, darts away for family gaming
05:08 Darius is now known as Vornicus-Latens
06:39
<@Carn[away]>
ah
06:39
<@Carn[away]>
it's going slowly (because I get distracted)
06:40
<@Carn[away]>
but going okay =)
06:40
<@Carn[away]>
Hi ToxicFrog!
07:27 Carn[away] [~carn_carb@Nightstar-10708.dsl.irvnca.pacbell.net] has quit [Ping Timeout]
07:33 Carn[away] [~carn_carb@Nightstar-11666.dsl.irvnca.pacbell.net] has joined #code
07:33
< Carn[away]>
okay, I'm off to bed
07:33
< Carn[away]>
thanks for the link, Vorn =)
07:33 * Carn[away] waves to all
07:33
<@McM[SanDiego]>
Sleep tight, Carn. Good to see you again =)
07:33
< Carn[away]>
Nice to see you too, McM!!
07:33
< Carn[away]>
Have fun while you're down here
07:33
< Carn[away]>
although
07:33
< Carn[away]>
it's really cold (at least in LA)
07:33
< Carn[away]>
-_-
07:33
< Carn[away]>
I hope SD is warmer
07:34
<@McM[SanDiego]>
We're rainy
07:34
< Carn[away]>
o_O
07:35
<@McM[SanDiego]>
It's still warmer than up north though
07:35
< Carn[away]>
er
07:35
< Carn[away]>
-_-
07:35
< Carn[away]>
ah
07:35
< Carn[away]>
I'm going to UCSF in a few weeks
07:35
<@McM[SanDiego]>
!
07:35
< Carn[away]>
for an interview
07:35
< Carn[away]>
I hope it's warm
07:35
< Carn[away]>
-_-
07:35
<@McM[SanDiego]>
Bring a windbreaker
07:35
< Carn[away]>
*nods*
07:35
< Carn[away]>
oh!
07:35
< Carn[away]>
if I get an interview at stanford
07:35
<@McM[SanDiego]>
Feel free to visit Mountain View or Stanford while you're up there =)
07:35
< Carn[away]>
we should get lunch =D
07:35
<@McM[SanDiego]>
We should.
07:36 * McM[SanDiego] will of course be driving through LA soon, but not the right part.
07:36
< Carn[away]>
-_-
07:36
< Carn[away]>
well
07:36
< Carn[away]>
I live in the left part
07:36
< Carn[away]>
=D
07:36
< Carn[away]>
I'll let you know if I'm headed up to Palo Alto, though!!
07:36
< Carn[away]>
night night =)
07:36
<@McM[SanDiego]>
Yeah. I'm unlikely to get much west of Yorba Linda
07:37 * Carn[away] has no idea where that is -_-
07:37
< Carn[away]>
Anyway, off to bed
07:37
< Carn[away]>
Night! =)
07:37 Carn[away] [~carn_carb@Nightstar-11666.dsl.irvnca.pacbell.net] has quit [Quit: ]
07:59
<@ToxicFrog>
I missed most of Carn. Aah well.
08:00
<@ToxicFrog>
She'll be back for more Python~
08:07
<@McM[SanDiego]>
Hee. "Coding has taught me that Platonism is 180 degrees wrong; names matter immensely, but only to the programmer. The thing in itself - the program - doesn't care."
10:07 Chalcedon [~Chalcedon@Nightstar-2443.ue.woosh.co.nz] has quit [Quit: Gone]
10:41 Forjeh [~Forj@Nightstar-2443.ue.woosh.co.nz] has quit [Quit: Gone]
11:12 Attilla [~Andrew@Nightstar-23974.ipt.aol.com] has joined #code
11:31 ReivZzz [~reaverta@Admin.Nightstar.Net] has joined #Code
11:32 ReivZzz is now known as Reiver
13:48 AnnoDomini [AnnoDomini@83.21.5.ns-20951] has quit [Ping Timeout]
13:51 Vornicus-Latens is now known as Vornicus
13:54 AnnoDomini [AnnoDomini@Nightstar-29646.neoplus.adsl.tpnet.pl] has joined #Code
13:54 mode/#code [+o AnnoDomini] by ChanServ
15:48 Vornicus [~vorn@ServicesOp.Nightstar.Net] has quit [Ping Timeout]
16:07 Vornicus [~vorn@Admin.Nightstar.Net] has joined #code
16:07 mode/#code [+o Vornicus] by ChanServ
16:28
<@ToxicFrog>
So, Vorn.
16:28
<@ToxicFrog>
I've been thinking about this schema problem.
16:28
<@ToxicFrog>
I think I have one suitable for the in-game board which can, furthermore, be generated fairly easily from a list of hexes and ports.
16:29
<@ToxicFrog>
A board is a collection of hexes, edges, and vertices. These may have coordinates or orientation information, but these are for the use of the renderer and do not affect gameplay.
16:29
<@ToxicFrog>
An edge has two vertices it connects to, and (a list of players permitted to build roads on it or a marker indicating which player has a road on it).
16:30
<@ToxicFrog>
A hex has an activation number, a resource type, and a list of adjacent vertices.
16:30
<@ToxicFrog>
And a flag indicating whether the thief is there or not, probably.
16:31
<@ToxicFrog>
A vertex has a list of adjacent hexes; a list of connected edges; and (a set of players currently permitted to build settlements on it or a marker indicating which player has a (settlement or city) on it)
16:31
<@ToxicFrog>
It also has an optional port flag indicating whether the vertex is part of a port and if so, what trade ratio and what resource (if any).
16:32
<@ToxicFrog>
And a flag indicating whether it can be built on at all (distinct from the set of allowed players).
16:32
<@ToxicFrog>
I think that's it.
16:32
<@ToxicFrog>
Thoughts?
16:34 Attilla [~Andrew@Nightstar-23974.ipt.aol.com] has quit [Ping Timeout]
16:39
<@C_tiger>
There also needs (for each number 2-6,8-12) to be lists of vertices that activated by each dice roll.
16:39
<@C_tiger>
But I think that's static... and not generated with each board generation. (it's been a while since I played)
16:40
<@C_tiger>
Or was that hexes.
16:41
<@C_tiger>
Damn, it's been a long while since I've played... my bad.
16:42
<@ToxicFrog>
It's not static.
16:42
<@ToxicFrog>
Er, rather
16:42
<@ToxicFrog>
The list of vertices is, the list of settlements isn't.
16:43
<@C_tiger>
Yes.
16:43
<@ToxicFrog>
At any rate, you can either maintain that additionally, or maintain a map of roll->hex and use that, or just do a linear search each roll
16:43
<@ToxicFrog>
But it doesn't imply any additions to the schema.
16:44
<@C_tiger>
No. You're right.
16:45
<@C_tiger>
See... back in the day, I'd build something like this with a database program and lots of linked databases. I never learned how to do it in code.
16:45
<@C_tiger>
Man, I had a shitty CS education.
16:46
<@ToxicFrog>
In databases you can construct something using the relational calculus which will evaluate to the set of activated vertices, given that schema, I think.
16:46
<@ToxicFrog>
But it's been a while and I'm just thinking in terms of code (well, of data structures), because I'm more comfortable with that.
16:47
<@C_tiger>
Yeah... I just learned stuff like if you use one value in one DB to key to another DB, magic things happen.
16:47
<@C_tiger>
So I guess the equivalent approach is to make hashes that key each other.
16:48
<@C_tiger>
(In data structure terms)
16:48
<@ToxicFrog>
(Aha. The advantage of mapping rolls to hexes is that you then get the resource type, too, so you just need to map(hex.vertices, \v add-resource(v.player, hex.resource))
16:49
<@C_tiger>
(Yeah, actually, my comment earlier about vertices was totally misguided, I meant to say hexes but I got confused)
16:49
<@ToxicFrog>
If you were storing them like you'd store a database.
16:49
<@ToxicFrog>
In most languages, though, you can just refer to objects directly.
16:50
<@C_tiger>
Somehow I thought that the layout of the activation numbers on the hexes was static... which isn't true.
16:50
<@ToxicFrog>
It is, according to the rules.
16:50
<@C_tiger>
No, because there's the desert piece.
16:50
<@ToxicFrog>
Oh righyt.
16:51
<@ToxicFrog>
Concerning what I mean about referring to objects directly...in a database (or a corresponding hash layout), you'd have, say, roll_to_hexes, which uses a roll as the primary key.
16:51
<@ToxicFrog>
And the value is a list of keys to be used in the hexes table. Yes?
16:51
<@C_tiger>
right.
16:52
<@C_tiger>
But then the hex doesn't store its corresponding roll anymore.
16:52
<@ToxicFrog>
But, with most languages, you can simply create references to the objects directly - so rather than a list of keys, the value is the list of hexes themselves.
16:52
<@ToxicFrog>
Yes, it does.
16:52
<@C_tiger>
Wait, why?
16:52
<@ToxicFrog>
Although I suppose it no longer -has- to, but it's convenient for the renderer.
16:53
<@C_tiger>
Oh, right. I forgot about the whole practicality thing.
16:53
<@ToxicFrog>
Anyways, rather than going, say, key = rolls[6][1]; hex = hexes[key]; you just go hex = rolls[6][1]
16:54
<@C_tiger>
Ah, yes.
16:55
<@C_tiger>
and a hex is a list of 6 vertices (this is static) and a resource.
16:55
<@C_tiger>
(an a few flags)
16:55
<@ToxicFrog>
Static?
16:55
<@C_tiger>
Well, for a given hex the vertices are fixed, no?
16:56
<@C_tiger>
As in there's no randomization.
16:56
<@ToxicFrog>
Umm. Yes, but I was thinking of a hex not as "a region on the board", but as what the hex represents - "a resource producer linked to six vertices"
16:56
<@C_tiger>
As in when we link hexes to vertices, we only ever have to do it once.
16:56
<@ToxicFrog>
Hmm.
16:56
<@C_tiger>
But why not think of it as a region on the board?
16:57
<@ToxicFrog>
I suppose this depends on whether it's easier to generate the whole thing once, and just fill in resources and numbers; or to generate the whole thing from scratch each time.
16:57
<@ToxicFrog>
You may have something here.
16:57
<@ToxicFrog>
I was thinking place hexes first, then generate vertices and edges around them.
16:57
<@C_tiger>
Yeah, and I was thinking the opposite, build a quick thing that does it just once and fill in.
16:58
<@ToxicFrog>
But if we start out with the whole hex/vertex/edge structure, and just fill in resources and activation numbers and port flags according to the generated board layout...
16:58
<@C_tiger>
Right.
16:58
<@ToxicFrog>
Yeah, that does make things easier.
16:58 You're now known as TheWatcher[afk]
16:59
<@C_tiger>
I can't remember how ports work, so I'm not sure about that...
16:59
<@C_tiger>
but otherwise. Yes.
16:59
<@ToxicFrog>
A port touches two adjacent vertices on the edge of the board. Any player with a settlement or city on one of those vertices can use it.
17:00
<@C_tiger>
Right, but how are they randomized?
17:00
<@C_tiger>
Or are they not?
17:00
<@C_tiger>
I forget.
17:00
<@ToxicFrog>
They come in two flavours. A 3:1 port lets you trade 3 of any one resource in for 1 resource of your choice (rather than the usual 4:1). A 2:1 port lets you trade in 2 of a port-specific resource for 1 resource of your choice.
17:00
<@ToxicFrog>
Aah. They're on sea tiles which are randomly placed around the board.
17:01
<@ToxicFrog>
Or, alternately, which are non-randomly placed in an evenly spread out manner.
17:01
<@ToxicFrog>
But this is all generation; I don't think it actually affects the schema.
17:01
<@C_tiger>
So any vertex of a port tile counts as a port? Or just one vertex?
17:01
<@C_tiger>
Yes.
17:01
<@ToxicFrog>
Two vertices.
17:01
<@C_tiger>
Ah.
17:02
<@ToxicFrog>
Two adjacent vertices, which means only one player can hold each port.
17:02
<@ToxicFrog>
In the schema, this is just a flag on each of those vertices indicating that there's a port there.
17:02
<@C_tiger>
And always oriented so that the other two hexes at each of those vertices are land hexes, if possible then.
17:03
<@ToxicFrog>
That's not possible.
17:03
<@ToxicFrog>
One of the vertices is always land-land-sea and the other is always sea-sea-land.
17:03
<@C_tiger>
My mental picture of the board may be what's lacking.
17:04
<@C_tiger>
But either way, I see your point. It's just flags.
17:05
<@Vornicus>
You've just described the existing board. The problem is really "given regions and harbors, generate the things you described"
17:06
<@C_tiger>
Why can't I parse that statement?
17:06
<@ToxicFrog>
Vornicus: for each hex, walk the vertices generating a new vertex structure for each one and linking it to the current hex and (with an edge) to the previous vertex. Use memoized vertex and edge generation functions so that each vertex-location gets only a single vertex-structure.
17:07
<@ToxicFrog>
Handle harbours the same way, except replace linking with updating the trade-level flags on the ensuing vertices.
17:07
<@C_tiger>
I'm having an even harder time parsing that one. (dang!)
17:08
<@ToxicFrog>
Furthermore, using C's idea, we already have the structure, with no generation required - the list of regions and harbours simply fills in some fields in existing hex and vertex objects.
17:08
<@Vornicus>
...and then I can filter out vertices that have less than three hexes, and then edges that have less than two vertices.
17:08
<@C_tiger>
But those shouldn't exist.
17:08
<@C_tiger>
Because we already have the structure.
17:08
<@C_tiger>
That's what's confusing me.
17:09
<@ToxicFrog>
C_tiger: if you're using sea hexes and generating the hexes first, they can
17:09
<@ToxicFrog>
If you're generating the board structure first and then filling it in, it's a nonissue, I think.
17:09
<@Vornicus>
Also: I believe the correct method for the robber etc is actually to make the robber its own table, with a reference to the hex it's on.
17:09
<@C_tiger>
Ok, two questions. Why bother with the sea hexes at all?
17:09
<@Vornicus>
Because Seafarers uses them.
17:09
<@C_tiger>
Oh.
17:09
<@ToxicFrog>
Aah. Never having played Seafarers, I'm thinking in terms of normal Catan here.
17:10
<@Vornicus>
And because that helps describe the correct layout of sea hexes, as opposed to having to generate, which is a pain.
17:10
<@ToxicFrog>
However, the schema easily extends itself to cover sea hexes, I think (new terrain type sea, no activation number)
17:10
<@C_tiger>
Right.
17:10
<@ToxicFrog>
The edition I have doesn't have sea hexes, it just has a border
17:11
<@C_tiger>
Here's my big question. Does the SHAPE of the board change in any way?
17:11
<@ToxicFrog>
But yes. Sea hexes aren't really a problem.
17:11
<@Vornicus>
Sure.
17:11
<@C_tiger>
How?
17:11
<@Vornicus>
The 5-6 version makes the board bigger; the Seafarers things use a lot of different layouts, mostly rectangular though.
17:11
<@C_tiger>
(Because that would be one that that we don't account for that may be the big confusion.)
17:12
<@C_tiger>
Right but within editions, no change, right?
17:12
<@ToxicFrog>
(no, it wouldn't be)
17:12
<@Vornicus>
the /topology/ of the board never changes, but the extents do.
17:12
<@ToxicFrog>
(as long as the board is still hex-based, the schema works)
17:12
<@ToxicFrog>
(and, for that matter, I think it works even if it were, say, grid or triangle based)
17:12
<@Vornicus>
(it would, but we'd have to rejigger things)
17:12
<@ToxicFrog>
(it makes no assumption about the overall shape of the playing field, nor about the number of edges in each cell)
17:13
<@C_tiger>
TF, but if each time you played, a different shape occurs then you couldn't pregenerate your basic underlying scheme.
17:13
<@ToxicFrog>
Yes, you can; you just need to extend the generation function so that you can describe the shape you want when invoking it.
17:14
<@ToxicFrog>
And now, brunch
17:14
<@C_tiger>
Hmmm... yeah, but that brings us back to the problem we started with.
17:14
<@Vornicus>
I think TF solved my problem though
17:15
<@Vornicus>
I was taking issue with "how the hell do I find the sites/paths properly?" and the answer is "filter the generated sites"
17:15
<@C_tiger>
I'm still trying to work that one out.
17:15 Serah [~Z@130.227.16.ns-12529] has joined #Code
17:16
<@Vornicus>
You start with regions
17:16
<@Vornicus>
for each region: for direction: generate site in that direction
17:16 * Serah starts with regions.
17:17
<@C_tiger>
ok, site = vertex, edge or hex?
17:17
<@Vornicus>
vertex
17:17
<@Vornicus>
region -> hex; path -> edge
17:17
<@C_tiger>
Ok.
17:17
<@Vornicus>
also while we're in there we generate paths.
17:17
<@C_tiger>
Ok... and overlaps will just take care of themselves?
17:18
<@Vornicus>
We memoize paths and sites, so when we try to generate a site or path that we've already got from somewhere else, we instead get a reference to that site or path, and just add our goodies to it.
17:18
<@C_tiger>
memoize?
17:19
<@C_tiger>
So you're doing this by coordinates, then, to take care of overlaps?
17:19
<@Vornicus>
memoize: create in response to a function call, and then save for when another call of the function would produce the same result.
17:19
<@Vornicus>
Right.
17:19
<@C_tiger>
It definitely wasn't my first thought, I'll admit that much.
17:20
<@Vornicus>
I need the coordinates anyway for the rendering, and they're reasonably meaningful, so why not.
17:20
<@C_tiger>
Well, it works. Not how I would have done it but I wasn't thinking of rendering.
17:21
<@Vornicus>
Then once we've created the paths and sites, we filter out sites with less than three associated regions, and then paths with less than two associated sites.
17:22
<@C_tiger>
I was thinking generate a triangular field of points as a simple list. Then every other vertex on every other line becomes a hex, linked to its 6 nearest neighbors and every remaining point is a vertex. Paths are redundant with vertices.
17:23
<@C_tiger>
But that doesn't give coordinate data (because again, I wasn't thinking rendering, merely data storage)
17:25
<@C_tiger>
All told, however, I would suggest that you don't generate paths until after you've filtered your vertices. Thinking in my own database mentality, a path is just a hash table hashed to vertex pair.
17:26
<@Vornicus>
hrm
17:26
<@Vornicus>
thing is it's easiest to generate paths while I'm generating sites.
17:27
<@C_tiger>
fair enough.
17:29
<@C_tiger>
I kinda liked my triangle to hex approach, though. It manages to get away from having to check for redundancies... partly because I didn't think of memoizing admittedly.
18:06
<@ToxicFrog>
Ok, so now we have a generator for the board shape.
18:06
<@ToxicFrog>
Then to make it game-ready we just fill in the resource types and activation numbers and ports, place_initial_settlements(), and we're good to go.
18:07 * ToxicFrog fiddles with a tty representation of a Settlers board
18:08
<@Vornicus>
I had one once.
18:10
<@Vornicus>
Well, I had a representation. I don't remember what I did with it. use -- / \ for roads, three-tile-tall cells. It's easier if you can do colors.
18:10
<@ToxicFrog>
It's actually pretty easy.
18:10
<@ToxicFrog>
Yeah.
18:10
<@Vornicus>
I think you /need/ colors, actually.
18:11
<@ToxicFrog>
Probably.
18:12
<@ToxicFrog>
@-@
18:12
<@ToxicFrog>
/ \
18:12
<@ToxicFrog>
@ 6 @
18:12
<@ToxicFrog>
\ /
18:12
<@ToxicFrog>
@-@
18:12
<@ToxicFrog>
Something like that for each cell?
18:13
<@Vornicus>
Yes.
18:13
<@Vornicus>
You need some things to represent terrain
18:14
<@ToxicFrog>
Color-code the number.
18:14
<@ToxicFrog>
Or set a bgcolor for the entire cell.
18:14
<@ToxicFrog>
Light green, dark green, red, grey, yellow, blue
18:15
<@Vornicus>
I'd add little symbols ~ ^ f ' (something for pasture) (something for hill)
18:17
<@Vornicus>
need 7-8 colors anyway (Seafarers adds a "gold" hex, which I haven't arted up and don't know how I would, either)
18:21
<@ToxicFrog>
I'm just thinking about vanilla here.
18:22
<@ToxicFrog>
And I'm not seriously considering a tty interface, or at least not until the backend is done.
18:22
<@Vornicus>
These balloons are impossible to get started.
18:27
<@ToxicFrog>
?
18:28
<@Vornicus>
I got balloons in my Kwanzaa Sock (it got filled the day after christmas because people got home at 2AM christmas day instead of 5PM christmas eve)
18:28
<@Vornicus>
And they're extremely difficult to get air into.
18:28
<@ToxicFrog>
Aah.
18:30 You're now known as TheWatcher
18:32
<@Vornicus>
Once they start inflating though it's much easier.
18:32
<@ToxicFrog>
Damn you, now I want to write it too.
18:38 Attilla [~Andrew@Nightstar-23974.ipt.aol.com] has joined #code
18:58
<@Vornicus>
Heh
19:03
<@Vornicus>
hrm. The only other schema issue I had with the base game, which is just basically the representation of player's devcard hands.
19:04
<@Vornicus>
I thought about doing counts of each type, but that seems wrong because you need to know how many soliders someone has played; on the other hand tracking individual cards seems a bit much.
19:07 Forj [~Forj@Nightstar-2443.ue.woosh.co.nz] has joined #code
19:08 mode/#code [+o Forj] by ChanServ
19:10
<@ToxicFrog>
Tracking individual cards makes sense to me. You already have to do that for the deck, in effect.
19:11
<@Vornicus>
...true. If I don't do it for the deck I have to essentially unpack the deck each time I want to pick one.
19:11
<@ToxicFrog>
Exactly.
19:13
<@Vornicus>
So another asset associated with a game is a list of cards. What i can then do is have the development card have an "owner" column (FK:user) and a "revealed" column (boolean) and then just select * from game_cards where game_id = ? and owner is null; and random.choice() from that pile.
19:15
<@ToxicFrog>
...oh, you're actually doing this databasey?
19:17
<@Vornicus>
Yeah. I figure why make my own persistence thing when a database actually does the job. Fortunately, I have SQLAlchemy on my side.
19:23
<@Vornicus>
(as a web application, persistence is important; indeed, persistence is one of the failures of other computer catans that I wanted to fix.)
19:24
<@C_tiger>
Hmmm... I wonder...
19:24
<@Vornicus>
you why-why-why-why-wo-onder?
19:25
<@C_tiger>
I need to code this database thingy that I promised someone months ago.
19:25
<@EvilDarkLord>
Would pickling be insufficient for the task, Vorn?
19:25
<@C_tiger>
all web-friendly like.
19:26
<@C_tiger>
I was just wondering if I could get you to code it for me OR if you'd teach me to do the same. :P
19:26
<@C_tiger>
Because I'm stupid like bricks.
19:26
<@Vornicus>
Pickling doesn't do atomicity very cleanly.
19:30
<@Vornicus>
by using an actual database, I don't get the kinds of race conditions that would destroy me completely.
19:34 * Vornicus can probably teach it.
19:34
<@C_tiger>
I dunno, I'm pretty stupid like bricks.
19:36 * Vornicus gives C a brick to compare his stupid to.
19:36
<@C_tiger>
Hey, I'm worth more than ONE brick :P
19:36 * Vornicus gives C a bag of hammers?
19:39 AnnoDomini is now known as C`raksh`su
19:55
<@C_tiger>
I can't even begin to try to read taht.
19:55
<@C_tiger>
that.
21:10 You're now known as TheWatcher[afk]
22:10
<@ToxicFrog>
Hmm.
22:10
<@ToxicFrog>
Yes, atomicity is an issue.
22:13
<@ToxicFrog>
It has to be able to cope both with multiple games running simultaneously, and worse, multiple clients accessing the same game simultaneously.
22:15
<@Vornicus>
(note that the only thing that players can write to when it's not their turn is the trades)
22:20
<@Vornicus>
(the main reason for using a db is you get a persistence model that actually understands how to keep itself consistent, without having to write it yourself)
22:20 You're now known as TheWatcher
22:28
<@ToxicFrog>
Trades also implies players' hands.
22:28
<@Vornicus>
True
22:29
<@ToxicFrog>
Hmm. Personally I think it's still easier to write your own than to learn a db binding and write a database schema and install and set up a db server.
22:29
<@Vornicus>
Dude?
22:29
<@Vornicus>
SQLite.
22:29
<@Vornicus>
Also my schema is mostly written for me, and I'm good at writing schemas, once I figure out how the app works.
22:30
<@ToxicFrog>
I mean, the persistence part I already have lying around, and some kind of locking I can implement in about five minutes on *nix.
22:31
<@ToxicFrog>
The main issue I have with using DBs for this kind of thing is that the tables don't map perfectly to the data structures - references become foreign keys, for example.
22:31
<@ToxicFrog>
So you have to either write something to reconstruct your data, or track down a library for same.
22:31
<@Vornicus>
meet sqlalchemy
22:34
<@ToxicFrog>
Which is for Python.
22:34 * Vornicus is writing it in Python, so, obviously.
22:34
<@ToxicFrog>
And, again, in the time it takes me to determine that that's what I need, to download it, install it, and learn the API, I've implemented fs-based locking and don't need a DB.
22:47 Attilla [~Andrew@Nightstar-23974.ipt.aol.com] has quit [Connection reset by peer]
22:47 Attilla [~Andrew@172.201.5.ns-2743] has joined #code
22:54 C_tiger [~c_wyz@Nightstar-5378.nycmny.east.verizon.net] has left #code []
22:55 C_tiger [~c_wyz@Nightstar-5378.nycmny.east.verizon.net] has joined #code
23:23 You're now known as TheWatcher[T-2]
23:26 You're now known as TheWatcher[zZzZ]
23:26
<@ToxicFrog>
Actually, I think you can just do it with flock(2) - you don't even need lockfiles.
--- Log closed Sun Dec 30 00:00:53 2007
code logs -> 2007 -> Sat, 29 Dec 2007< code.20071228.log - code.20071230.log >