code logs -> 2010 -> Tue, 12 Jan 2010< code.20100111.log - code.20100113.log >
--- Log opened Tue Jan 12 00:00:03 2010
00:39 You're now known as TheWatcher[T-2]
00:42 You're now known as TheWatcher[zZzZ]
00:56 Derakon [Derakon@Nightstar-5abd3ac9.ca.comcast.net] has joined #code
00:56 mode/#code [+o Derakon] by Reiver
00:57 Derakon [Derakon@Nightstar-5abd3ac9.ca.comcast.net] has left #code []
00:57 Derakon [Derakon@Nightstar-5abd3ac9.ca.comcast.net] has joined #code
00:57 mode/#code [+o Derakon] by Reiver
00:57
<@Derakon>
Whups.
02:07 Attilla [Attilla@FBC920.DDABA2.60661C.0EE0F8] has quit [Connection reset by peer]
02:42
< Tarinaky>
In C++ is it possible to convert a pointer to a reference?
02:53 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
02:53
<@McMartin>
Foo&a = (*pA); ought to do it.
02:58
< Tarinaky>
Cheers.
03:10
< Tarinaky>
Stupid question. There's always an implicit copy constructor right?
03:33
<@Derakon>
Unless you disable it, yes.
03:50
<@Derakon>
Do you watch Fox News?
03:50
<@Derakon>
Mischan.
04:18 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?]
04:24
< Tarinaky>
Blargh. Today I feel very stupid. Hate days like today -.-
05:37
< PinkFreud>
Faux news.
05:37
< PinkFreud>
there, I fixed it for you
06:47 Derakon is now known as Derakon[AFK]
07:00 Vornicus is now known as Vornicus-Latens
08:13 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Client closed the connection]
08:27 AnnoDomini [annodomini@Nightstar-c0dff9ab.adsl.tpnet.pl] has joined #code
08:27 mode/#code [+o AnnoDomini] by Reiver
08:47
< Tarinaky>
Does anyone know a good introduction to procedural terrain generation?
08:50
<@McMartin>
Game Programming Gems Volume 1 has a number of algorithms.
08:50
<@McMartin>
I modified one for my old game Sable.
08:52
< Tarinaky>
Anything else? I'm ideally hoping for something I might be able to find in my Uni's library :x
08:52
< Tarinaky>
Because I'm a cheap bastard.
08:53
<@McMartin>
You actually might be able to find that one in your uni library.
08:53
<@McMartin>
Alternately, to do *exactly* what Sable did, do some searches on "plasma fractal" and interpret the results of it as a height map instead of as a color map or brightness map.
08:54
<@McMartin>
Hm, Sable isn't online anymore.
08:54
< Tarinaky>
A bit part of it is city generation.
08:54
<@McMartin>
That's quite a bit harder, though you could just plop a random bunch of rectangles down.
08:55
<@McMartin>
http://happypenguin.org/images/play.png
08:55
<@McMartin>
(The final version had much better graphics)
08:55
< Tarinaky>
I had an idea for a way I could do it but I saw some videos on youtube that demonstrated a method I really liked the look of.
08:56
< Tarinaky>
Sadly I've no idea if it's an off the shelf algorithm or what :/
08:57
<@McMartin>
Plasma fractals are a form of "midpoint displacement" which is a more general thing.
08:57 Rhamphoryncus [rhamph@Nightstar-a62bd960.abhsia.telus.net] has quit [Client exited]
08:58
< Tarinaky>
http://www.youtube.com/watch?v=l-GwC1YUdes << Like that.
08:59
<@McMartin>
That seems to be doing automatic street layout and such. No idea what it's doing.
09:01
< Tarinaky>
Yeah.
09:02
< Tarinaky>
I'm rather working on the assumption that there's no such thing as a 'city generator' and that I'd have to generatev
09:02
< Tarinaky>
*generate different things then use them as the input for the next 'layer'.
09:02
< Tarinaky>
So terrain, then streets, then buildings...
09:03
< Tarinaky>
Anyway. I need to run till this afternoon. Got an exam q.q
09:03
< Tarinaky>
Be back later.
09:15 You're now known as TheWatcher
09:25 Tarinaky [Tarinaky@Nightstar-72377fdb.adsl.virginmedia.net] has quit [Ping timeout: 121 seconds]
09:39 Tarinaky [Tarinaky@Nightstar-1bf37587.adsl.virginmedia.net] has joined #code
10:30 Attilla [Attilla@FBC920.DDABA2.60661C.0EE0F8] has joined #code
10:30 mode/#code [+o Attilla] by Reiver
11:42 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
12:05 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
12:20 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
12:26<~Reiver> McM: ... Sable isn't online any more?
12:43 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: *hums* Can't stay now!]
12:50
<@TheWatcher>
Reiver: if you want it right now, I should have a copy on helios somewhere
12:51
<@TheWatcher>
hm, wait, I think that's an old version.
14:13
< Tarinaky>
Bk!
14:14
< Tarinaky>
I picked up a book on Fractals from the library. It's in my course this term anyway >.<
14:14 AbuDhabi [annodomini@Nightstar-a586bdd6.adsl.tpnet.pl] has joined #code
14:15
< Tarinaky>
I was shocked to discover none of my friends recognised the author's name!
14:17 AnnoDomini [annodomini@Nightstar-c0dff9ab.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
14:19
<@TheWatcher>
Wasn't Benoit Mandlebrot by any chance?
14:20
<@TheWatcher>
*Mandelbrot
14:20
<@TheWatcher>
(Idly, have you seen the Mandelbulb yet?)
14:23
< Tarinaky>
It was mandlebrot. And is the Mandelbulb the fractal that's part of Renraku's logo in Shadowrun?
14:23
<@TheWatcher>
http://www.skytopia.com/project/fractal/mandelbulb.html
14:24
< Tarinaky>
Ooo. 3D.
14:25
< Tarinaky>
Pretty.
14:25
<@TheWatcher>
Indeed. It is made of shiny,
14:25
< Tarinaky>
very Lovecraftian.
14:26
<@TheWatcher>
(be sure to read page 2 linked at the bottom, too)
14:30
< Tarinaky>
Anyway. I was wondering if people knew any stock methods for randomly generating cities.
14:31
<@TheWatcher>
I don't know if there are any stock methods.
14:31
<@TheWatcher>
I've never heard of one, certainly.
14:32
< Tarinaky>
I think generating streets is probably the bigger part.
14:33
< Tarinaky>
Because it's ASCII I wanna keep the streets straight anyway so I can then just populate the squares with buildings but I'd need to get the streets looking... right.
14:35
<@TheWatcher>
Hm.
14:36
<@TheWatcher>
I suspect you won't be able to effectively create realistic road layouts without doing some kind of zoning simulation
14:37
<@TheWatcher>
plonk down areas of specific zone types and density, and then work out the road network needed for it based on zone size, and rules about distances between roads in specific zone types, that sort of thing?
14:37
<@TheWatcher>
subdividing and surrounding zones with roads, progressively refining based on distance rules, topography, and randomness?
14:39
< Tarinaky>
I have the advantage that it's not an Earth city so, to some degree, I can fudge things a little.
14:39
<@TheWatcher>
If you also apply rules to zones regarding topography (say, no industrial zones over a specific slope level, or away from given resources *shrug*
14:39
<@TheWatcher>
)
14:40
< Tarinaky>
http://www.youtube.com/watch?v=l-GwC1YUdes << I saw this this morning which was what kinda prompted me to think about it.
14:41
<@TheWatcher>
hm
14:42
<@TheWatcher>
Looks like he's using some kind of limited branching actor system. Interesting method.
14:45
< Tarinaky>
You're right about zoning though. I'll definately try and keep that in mind.
14:45
< Tarinaky>
What is a branching actor system?
14:51
<@TheWatcher>
Start off with a couple of actors who have a specific movement direction. Each time through your generation loop, move the actor forward one square in its direction and mark the square its on, unless it hits another road in which case you can either kill it or let it hop over the road it encountered. Then, if the actor is still alive, based on some rules (distance since last branch or start, or whatever), randomly create a new actor, with a
14:51
<@TheWatcher>
direction at 90 degrees (or whatever) to the current one.
14:53
<@TheWatcher>
the spawning of new actors increases road density, while they get killed off as they hit other roads.
14:53
<@TheWatcher>
*shrug*
14:53
<@TheWatcher>
an idea, anyway
14:54 crem [moo@Nightstar-8ca3eea7.adsl.mgts.by] has quit [Connection reset by peer]
14:54 crem_ [moo@Nightstar-8ca3eea7.adsl.mgts.by] has joined #code
14:54
<@TheWatcher>
(I'd have a fiddle with it myself, but right now I'm up to 5K of feedback for a student who royally messed up an assignment >.<)
14:57
< Namegduf>
Ouch.
14:59
<@TheWatcher>
Yeah. I used to really appreciated decent feedback on work when I was a student, so I go out of my way to give it now that I'm on the other side... but good gods does it take a lot of typing sometimes >.>
14:59
<@TheWatcher>
-d
15:15
< Tarinaky>
Cheers for the help Watche.
15:15
< Tarinaky>
*Watcher
15:16
<@TheWatcher>
No worries, keep us informed on how you get on :)
15:30
< Tarinaky>
I'm not coding anything yet. Still wanna finish my dicebot >.<
15:31
< Tarinaky>
I mostly just wanted some reading material to muse over.
15:31
< Tarinaky>
Heh.
15:40
< AbuDhabi>
http://i49.tinypic.com/2aieptt.jpg
15:42 crem_ [moo@Nightstar-8ca3eea7.adsl.mgts.by] has quit [Connection reset by peer]
15:49 crem [moo@Nightstar-8ca3eea7.adsl.mgts.by] has joined #code
16:01 MyCatVerbs [mycatverbs@Nightstar-3b2c2db2.bethere.co.uk] has joined #code
16:01 mode/#code [+o MyCatVerbs] by Reiver
16:30 You're now known as TheWatcher[afk]
16:48 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Client closed the connection]
17:17
<@MyCatVerbs>
Salutations, humans.
17:17
<@MyCatVerbs>
Reiver: oh, thanks for the hat. Out of curiosity, am I in the AOP list?
17:17
< Namegduf>
Hey cat verbs.
17:18
<@MyCatVerbs>
Greetings, Namegduf.
17:37 Rhamphoryncus [rhamph@Nightstar-a62bd960.abhsia.telus.net] has joined #code
18:02 Vornicus-Latens is now known as Vornicus
18:03 * gnolam blarghs.
18:09 SmithKurosaki [Smith@Nightstar-a68aafef.dsl.teksavvy.com] has quit [Connection closed]
18:15 SmithKurosaki [Smith@Nightstar-a68aafef.dsl.teksavvy.com] has joined #code
18:25 You're now known as TheWatcher
18:29 celmin [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
18:29 celmin is now known as celticminstrel
18:50 MyCatVerbs [mycatverbs@Nightstar-3b2c2db2.bethere.co.uk] has quit [Connection closed]
19:06 Derakon[work] [Derakon@Nightstar-1ffd02e6.ucsf.edu] has joined #code
19:06
< Derakon[work]>
Ahh, debugging technical issues.
19:07
< Derakon[work]>
Spent ten minutes or so poking at the microscope, trying to figure out why it was moving the slide too much for each step (about .3 microns instead of .2). Turned out the piezo control wasn't on, so it was using servos instead of piezos.
19:07
< Derakon[work]>
Go simple solutions!
19:08
< Derakon[work]>
(Servos don't have as good resolution as piezos do)
19:08
< celticminstrel>
...does Python have anything like string-streams?
19:08 * Derakon[work] hits up Google, finds a forum thread that links to http://www.python.org/doc/2.3.4/lib/module-StringIO.html
19:09
< celticminstrel>
Eep.
19:09
<@jerith>
What do you mean by "string-streams"?
19:09
< celticminstrel>
sprintf, sscanf from C, or stringstream from C++
19:10
<@jerith>
StringIO gives you a file-like object backed by a string.
19:10
< Derakon[work]>
So, what, you want to put formatted content into a string?
19:10
< Derakon[work]>
foo = "%d-%s" % (10, "hello")
19:10
<@jerith>
The "%" formatting operator gives you printf-like functionality.
19:10
< celticminstrel>
Actually, I wanted a function that takes a file as an argument to be able to read from a string instead.
19:10
< celticminstrel>
So, sscanf, not sprintf.
19:11
< celticminstrel>
But without knowing whether it's a string or a file.
19:11
<@jerith>
You seem to be conflating two different things.
19:11
< Derakon[work]>
Um, given that those are fundamentally different datatypes, I suspect you'll be disappointed.
19:11
< celticminstrel>
Well, it works in C++.
19:12
<@jerith>
I generally solve that (for things that I know will be small) by only accepting a string and passing it "open(filename).read()" for the file.
19:12
< Derakon[work]>
You wouldn't use it for large files since the read() function reads the entire file all at once.
19:12
<@jerith>
You could also have it take a file-like object and pass it a StringIO wrapper for the string.
19:13
< celticminstrel>
That was my idea, yes.
19:13
< Derakon[work]>
But then you aren't dealing with pure strings any more.
19:13
<@jerith>
Correct.
19:14
<@jerith>
If you want to handle it internally, You need to figure out if something is file-like or string-like and treat it appropriately.
19:14
<@jerith>
But the Python Way is to be explicit.
19:14
< celticminstrel>
Explicit?
19:14
< Derakon[work]>
Have functions that accept either files, or sttrings, but not both.
19:14
< Derakon[work]>
readFromFile() and readFromString()
19:14
< Derakon[work]>
Er, strings.
19:15
<@jerith>
Don't allow dostuff(astring) and dostuff(afile) where you figure out inside dostuff() which one you've been given.
19:15
< gnolam>
Derakon: 3 µm for something servo-controlled still seems incredibly accurate. They must be downgeared something wicked.
19:15
< celticminstrel>
Hm. I have another idea.
19:16
< gnolam>
.3 µm, even.
19:16
< Derakon[work]>
Gnolam: well, that's my assumption. We looked over in the closet and said "Oh hey, the piezo controller is off".
19:16
< Derakon[work]>
It's possible that the piezos can still be accessed or something.
19:19 * Derakon[work] eyes WinDbg, wonders how the zark to get it debugging symbols for the program whose crash he's trying to debug.
19:19
<@McMartin>
"Symbol Path..."
19:19
< Derakon[work]>
Yeah, doesn't seem to help.
19:19
<@McMartin>
And check "reload now"
19:19
< Derakon[work]>
I pointed it at the src directory.
19:19
<@McMartin>
Oh
19:19
<@McMartin>
Point it at the PDB directory
19:19
<@McMartin>
Which is usually the object code directory.
19:20
< Derakon[work]>
Um...no PDB directory.
19:20
< Derakon[work]>
All .obj files are generated in the src directory. No PDB files.
19:20
< Derakon[work]>
So I guess that's why I don't have symbols.
19:23
< celticminstrel>
Hey, I can do type(x)(y)!
19:23
<@jerith>
Yes, you can.
19:23
<@jerith>
Although I can't really think of a good reason to.
19:24
< Derakon[work]>
That just does "cast y to the same type as x has", right?
19:24
< celticminstrel>
Yes.
19:24
< celticminstrel>
It cuts down the number of branches I need by almost half.
19:24
<@jerith>
Is this Python?
19:24
< Derakon[work]>
Yes.
19:24
< celticminstrel>
Yes.
19:25
< Derakon[work]>
Direct examination of types always makes me feel like something has gone horribly wrong.
19:25
<@jerith>
Because that means "create a new object with the same class as x passing y as a constructor parameter".
19:25
< celticminstrel>
Yes.
19:25 Zedidiah [zag@Nightstar-d0088b95.or.comcast.net] has quit [Client closed the connection]
19:25
<@jerith>
Which is not the same as casting something.
19:26
< celticminstrel>
Well... I don't think there's a distinction between the two in Python...
19:26
<@jerith>
Python, being dynamically typed, doesn't have anything that could meaningfully be called a cast.
19:27
< celticminstrel>
Okay, that works too.
19:27
<@jerith>
Although most of the builtin types have constructors that will do something analogous.
19:28
<@jerith>
Consider str(), however.
19:29
<@jerith>
All that does (in simple terms, anyway) is call .__str__() its parameter.
19:29
< celticminstrel>
And `x` calls .__repr__().
19:30
< celticminstrel>
But I'd say __str__ is a sort of "cast to string" function.
19:30
<@jerith>
repr() calls __repr__(), and is rather more explicit.
19:30
< celticminstrel>
I like the backquote syntax.
19:31
< Derakon[work]>
Backquotes remind me of Perl~
19:31
<@jerith>
I don't. They're used rarely enough that they're non-obvious.
19:32
< celticminstrel>
They're obvious to me. ;)
19:32
< Derakon[work]>
Are they obvious to the people you ask for help?
19:32
< Derakon[work]>
"Rare" is relative, but generally speaking the community style guidelines for Python are excellent and should be followed.
19:32
< celticminstrel>
No idea, but I don't really need help for the places where I use them.
19:32 Zedidiah [zag@Nightstar-d0088b95.or.comcast.net] has joined #code
19:47 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: ]
19:58
< Derakon[work]>
Ahh, apparently the /ZI and /Fd options cause nmake to generate PDB files.
19:58
< Derakon[work]>
That was more than a little difficult to discover.
20:00
< Derakon[work]>
...not that WinDbg actually used the resulting .pdb file.
20:19 Derakon[work] [Derakon@Nightstar-1ffd02e6.ucsf.edu] has quit [[NS] Quit: Leaving]
21:06 * TheWatcher vaguely pokes at mingw
21:06
<@TheWatcher>
Huh, it comes with opengl support without extra effort?
21:22
< celticminstrel>
Yay, now this function is not a massive page-long blob.
21:29
< celticminstrel>
Eep! This function is 3.5 screens of code!
21:50
< AbuDhabi>
Is it wrong to use try-catch as an improvised if-fail?
21:51
< celticminstrel>
I dunno, but I have been doing so.
21:51
< celticminstrel>
It's probably less efficient though.
21:52
<@McMartin>
Generally a bad move unless failure is extremely rare or you're using a language like ML or Haskell; exceptions are hundreds to thousands of times slower.
21:54
< AbuDhabi>
I'm asking academically. This is for an assignment and speed matters not.
21:54
< celticminstrel>
It will work.
21:54
< AbuDhabi>
Thanks.
21:54
< Namegduf>
I believe exceptions for non-exceptional conditions are considered "academically" bad.
21:55
< AbuDhabi>
If it were for something I do for fun, then it would matter. :P
22:00
< celticminstrel>
...
22:02
< AbuDhabi>
What?
22:02
< celticminstrel>
Wow. I guess I didn't know Python classes quite as well as I thought.
22:03
< celticminstrel>
I assumed they were like classes in C++, Java, etc, in that attributes and functions appear at the same scope... but attributes apparently have to be declared in __init__.
22:05 EvilDarkLord [jjlehto3@Nightstar-f1ccbb45.hut.fi] has quit [Ping timeout: 121 seconds]
22:06 EvilDarkLord [jjlehto3@Nightstar-f1ccbb45.hut.fi] has joined #code
22:09 Tarinaky [Tarinaky@Nightstar-1bf37587.adsl.virginmedia.net] has quit [Ping timeout: 121 seconds]
22:10
<@McMartin>
Python classes are completely different from C++/Java classes.
22:10
<@McMartin>
Not only is what you describe the case, different instances of the same class can have different fields or have new fields added or removed at runtime.
22:10
<@McMartin>
A Python class is really just an extra namespace.
22:11
< celticminstrel>
I knew about the ability to add fields, oddly.
22:23 Tarinaky [Tarinaky@Nightstar-e9569ece.adsl.virginmedia.net] has joined #code
22:46 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code
22:46 mode/#code [+o Vornicus] by Reiver
23:24
<@McMartin>
This Project Euler program of mine has been running for 18 days. To date, it's still my fastest solution and it's not even done
23:28
<@Vornicus>
;_;
23:28
<@Vornicus>
which problem?
23:45
< gnolam>
TheWatcher: most platforms do.
23:45
< gnolam>
TheWatcher: Of course, to get actual usable functionality out of it you still need GLEW or AllegroGL or somesuch on most. :P
23:47
< PinkFreud>
bah. just go with brainf*ckGL
23:47
<@McMartin>
Vornicus: The one about Toricelli Points.
23:49
<@McMartin>
Which is #143, I guess
23:51
< PinkFreud>
heh. I have a modified euler problem here - the one that has you derive a repeating xor key from encrypted plaintext
23:52
< PinkFreud>
my modified version uses arbitrary (but known) key lengths, which are not necessarily limited to plain ascii. encrypted document is still plain text. anyone want to take a stab at it?
23:57 AbuDhabi [annodomini@Nightstar-a586bdd6.adsl.tpnet.pl] has quit [[NS] Quit: Now I lie me down to sleep, pray the Lord my soul to keep. If I die before I wake, pray the Lord my soul to take.]
--- Log closed Wed Jan 13 00:00:07 2010
code logs -> 2010 -> Tue, 12 Jan 2010< code.20100111.log - code.20100113.log >