code logs -> 2007 -> Thu, 05 Jul 2007< code.20070704.log - code.20070706.log >
--- Log opened Thu Jul 05 00:00:01 2007
00:00 Netsplit over, joins: MyCatVerbs
00:00 Netsplit over, joins: Reiver
00:00 mode/#code [+o Reiver] by ChanServ
00:01 ChalcyPhone [~Chalcedon@Nightstar-15747.ue.woosh.co.nz] has joined #Code
00:01 Serah [~Z@87.72.35.ns-26506] has joined #Code
00:01 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has quit [Operation timed out]
00:01 Netsplit DeepThought.NY.US.Nightstar.Net <-> Blargh.CA.US.Nightstar.Net quits: MyCatVerbs, ChalcyPhone, @Serah, @Reiver
00:01 mode/#code [+o Serah] by ChanServ
00:01 Netsplit DeepThought.NY.US.Nightstar.Net <-> Troika.TX.US.Nightstar.Net quits: @Thaqui, @Vornicus, @Pi, @jerith, Raif, @ChAfk
00:01 Otto_Flick [lenin@Nightstar-13557.8.5.253.se.wasadata.net] has joined #Code
00:01 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has joined #code
00:01 mode/#code [+o ToxicFrog] by ChanServ
00:02 gnolam [lenin@Nightstar-13557.8.5.253.se.wasadata.net] has quit [Ping Timeout]
00:02 Netsplit over, joins: ChAfk, jerith
00:02 mode/#code [+o ChAfk] by ChanServ
00:02 Netsplit over, joins: Raif
00:02 Vornicus [~vorn@Admin.Nightstar.Net] has joined #Code
00:02 Netsplit over, joins: Pi
00:02 mode/#code [+o jerith] by ChanServ
00:02 mode/#code [+o Vornicus] by ChanServ
00:02 Netsplit over, joins: Thaqui
00:02 mode/#code [+o Pi] by ChanServ
00:02 mode/#code [+o Thaqui] by ChanServ
00:02 Otto_Flick is now known as gnolam
00:02 Netsplit over, joins: MyCatVerbs
00:02 Netsplit over, joins: Reiver
00:02 Netsplit over, joins: ChalcyPhone
00:02 Netsplit over, joins: Serah
00:02 mode/#code [+o Reiver] by ChanServ
00:02 mode/#code [+o Serah] by ChanServ
00:11 ChalcyPhone is now known as Chalcedon
00:55 gnolam [lenin@Nightstar-13557.8.5.253.se.wasadata.net] has quit [Quit: Z?]
01:08 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has quit [Operation timed out]
01:13 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has joined #code
01:13 mode/#code [+o ToxicFrog] by ChanServ
01:34
< Chalcedon>
should break break the loop or stop the function?
01:35
<@Vornicus>
Break breaks a loop.
01:35
<@Vornicus>
To kill a function entirely use return or raise as appropriate.
01:35
< Chalcedon>
ok... so why is it breaking my function then...
01:35
<@Vornicus>
Show me?
01:35
< Chalcedon>
what does raise do?
01:35
< Chalcedon>
how about I post it to LJ? It's a fair amount of code
01:35
<@Vornicus>
raises an exception. Generally you only do that when you have come upon an error you can't fix.
01:35
< Chalcedon>
ah!
01:35
< Chalcedon>
right
01:36
<@Vornicus>
pastie.
01:36
< Chalcedon>
I feel uncomfortable with that (yes, I'm silly, I know)
01:37
<@Vornicus>
yes, you are silly.
01:38
< Chalcedon>
at least I admit it
01:38
< Chalcedon>
or I could flood the channel
01:39 Forjehdon [~Forjadon@Nightstar-15747.ue.woosh.co.nz] has joined #code
01:39
< Chalcedon>
this is the loop:
01:39
< Chalcedon>
.
01:39
< Chalcedon>
-er-
01:39
< Chalcedon>
while column < 4:
01:39
< Chalcedon>
if BMI < categories[column]:
01:39
< Chalcedon>
break
01:39
< Chalcedon>
else:
01:39
< Chalcedon>
column += 1
01:39
< Chalcedon>
(where the if and else are in line)
01:39
<@Vornicus>
Right, right
01:40
<@Vornicus>
And is it doing the stuff after the end of the while loop
01:40
<@Vornicus>
?
01:40 Chorj [~Forjadon@Nightstar-15747.ue.woosh.co.nz] has quit [Ping Timeout]
01:40
< Chalcedon>
I'm not sure.
01:40
< Chalcedon>
it gives me this error:
01:40
< Chalcedon>
Traceback (most recent call last):
01:40
< Chalcedon>
File "<pyshell#5>", line 1, in -toplevel-
01:40
< Chalcedon>
generatePhysicalDescription(20)
01:40
< Chalcedon>
File "D:\Installations\Python 24\Human.py", line 53, in generatePhysicalDescription
01:40
< Chalcedon>
descriptLine = descriptions.next()
01:40
< Chalcedon>
StopIteration
01:40
< Chalcedon>
and doesn't print like it's supposed to
01:40
<@Vornicus>
well that's a new one.
01:40
< Chalcedon>
So, I guess thats a no, it doesn't do stuff after the end of the loop
01:41
<@Vornicus>
I wonder why it's raising an exception.
01:41
<@Vornicus>
Um.
01:41
< Chalcedon>
actually
01:41
<@Vornicus>
Do me a favor, pastebin the entire function.
01:41
< Chalcedon>
descriptLine = descriptions.next() is after the end of the loop
01:41
<@Vornicus>
...oh.
01:42
<@Vornicus>
Yeah, you shouldn't generally call next() yourself.
01:42
< Chalcedon>
ok.
01:42
< Chalcedon>
ok, I'm looking at the wrong bloodly loop
01:42 * Chalcedon thwap head
01:43
< Chalcedon>
the problem is I have a file (CSV) with categories at the top and a list underneath
01:43
< Chalcedon>
so I only want the first line initially then I don't want hte first line at all
01:43
<@Vornicus>
next()'s definition is that it should raise StopIteration when it's out of things to iterate over.
01:43
< Chalcedon>
right.
01:44
< Chalcedon>
descriptLine = descriptions.next()
01:44
< Chalcedon>
while descriptLine != None:
01:44
< Chalcedon>
if descriptLine[column] != "":
01:44
< Chalcedon>
availableDescriptions.append(descriptLine[column])
01:44
< Chalcedon>
descriptLine = descriptions.next()
01:44
< Chalcedon>
I think I may see how to do it.
01:44
< Chalcedon>
I just dont' know how to do it in Python
01:44 * Chalcedon hunts for Pythons error handling stuff
01:44
< Chalcedon>
StopIteration is an exception?
01:45
<@Vornicus>
uh, like this:
01:45
<@Vornicus>
for descriptLine in descriptions:
01:45
<@Vornicus>
if descripLine[column] != "":
01:45
<@Vornicus>
availableDescriptions.append(descriptLine[column])
01:46
< Chalcedon>
and then delete the first item in the list?
01:46
<@Vornicus>
StopIteration is an exception, and one you shouldn't really ever have to see.
01:46
<@Vornicus>
nope. It will iterate over them naturally.
01:48
< Chalcedon>
ok... it's almost working now
01:48
< Chalcedon>
(and now that I've done it I see why you don't need to exclude the top line)
01:50
< Chalcedon>
helps if you convert the string to a floating point number
01:51 * Chalcedon cookies Vorn
01:51
< Chalcedon>
my head is too full of C#
01:52
<@Vornicus>
heh
01:52
<@Vornicus>
Yeah, that, uh, happens
01:52
< Chalcedon>
that and I have a lot to learn about programming
02:00
< Chalcedon>
hem
02:00
< Chalcedon>
*hrm
02:00
< Chalcedon>
new question: can I call next() on a csv twice? (with out going file.next() \n file.next())
02:01
< Chalcedon>
maybe it's not necessary
02:01
<@Vornicus>
Um
02:01
<@Vornicus>
Don't Use next() Unless You Mean It.
02:01
<@Vornicus>
for ... in ...: works better.
02:01
< Chalcedon>
is there another way to retrieve just one line?
02:02 * Chalcedon nods
02:02
<@Vornicus>
Gah, okay, what are you doing?
02:02
< Chalcedon>
same thing, except there's two sets of categories
02:02
< Chalcedon>
(I'm making a random NPC generator - like for inkeepers and random people)
02:02
<@Vornicus>
Obviously I'm missing it. Show me the entire code. Pastie is preferred over LJ because pastie will do syntax highlighting.
02:03
< Chalcedon>
is it possible to make it private in Pastie?
02:03
< Chalcedon>
also, I haven't actually written this bit of code, I'm just trying to work out how
02:05
<@Vornicus>
Generally pastebins don't give that ability. I know I saw one that allows private posts, sorta, but I don't remember where it was.
02:05
< Chalcedon>
I found a box for locking the paste
02:05
< Chalcedon>
do you want the whole class or just the function?
02:06
< Chalcedon>
This paste will be private. (it's next to the language)
02:06
<@Vornicus>
The whole class.
02:07
< Chalcedon>
http://pastie.caboo.se/private/e58ainsjcpabylmaot
02:08
<@Vornicus>
Okay, hm.
02:09
< Chalcedon>
I'd paste the data, but I don't htink that'll work so well
02:09
<@Vornicus>
I'm going to need to see /some/ of it
02:09
< Chalcedon>
Male 66 72 79
02:09
< Chalcedon>
Female 61 67 79
02:09
< Chalcedon>
short average tall
02:09
< Chalcedon>
tiny medium lanky
02:09
< Chalcedon>
squat middle towering
02:09
< Chalcedon>
the column under male/female is blank
02:09
< Chalcedon>
so its 4 columns wide
02:09
<@Vornicus>
hm.
02:09 * Vornicus wonders if there's a pastebin-alike that does tables. that'd be awesome.
02:10
< Chalcedon>
I'll see if I can persuade LJ to do a table
02:10 You're now known as TheWatcher[zZzZ]
02:10
<@Vornicus>
Not hard.
02:10
<@Vornicus>
But yeah, I see what you're getting at.
02:11
<@Vornicus>
And shouldn't it be "thin" instead of "medium" and "fat" instead of "middle"?
02:11
<@Vornicus>
But, uh, seriously
02:11
<@Vornicus>
This doesn't look or feel like a single table, so it shouldn't be in a single file.
02:12
<@Vornicus>
Not like this, anyway.
02:13
<@Vornicus>
If you use a more structured file format then maybe.
02:13
< Chalcedon>
good idea
02:13
< Chalcedon>
(with thin and fat)
02:14
< Chalcedon>
how do you mean with the format?
02:14 * Reiver eyes that code.
02:14
<@Reiver>
tiny/medium/lanky?
02:14
< Chalcedon>
:p
02:15
<@Vornicus>
I mean to say that you have one data table that has just genders and heights, and another data table that's descriptions of various height/weight combinations.
02:15
<@Reiver>
Stumpy/medium/lanky, or solid/medium/lanky would be more logical?
02:15
< Chalcedon>
it's not finished!!
02:16
< Chalcedon>
it's not supposed to be height/weight combinations
02:16
< Chalcedon>
just heights
02:16
<@Vornicus>
And these two tables have only the column names the same, not the data types used or the semantic meaning of a record.
02:16
< Chalcedon>
theres one table for heights one table for weights
02:16
< Chalcedon>
well (BMI, but)
02:17
< Chalcedon>
I don't understand that one Vorn
02:18
< Chalcedon>
http://chalcy.livejournal.com/1936.html
02:18
<@Vornicus>
What I'm trying to say is that your thing has two different kinds of rows, other than the (implied, and missing) header row.
02:18
< Chalcedon>
well, I left the header out because it complicates reading the file
02:19
<@Vornicus>
And this is a Bad Thing To Have when working with CSV: the implied contract is that each row has the same kind of stuff in it, except for the header row if it's present.
02:20
< Chalcedon>
so how should I do it then?
02:20
< Chalcedon>
because determining which category in one file and getting the description out of another just makes it ridiculously complicated
02:21
<@Vornicus>
How so?
02:21
< Chalcedon>
I've always found that the more files there are, the harder they are to keep track of
02:21
<@Vornicus>
Sure, it makes the initial formatting of the data a bit complicated, but it also makes the code a hell of a lot cleaner and simpler, and you don't need to have as rigid a format.
02:22
< Chalcedon>
plus if the two bits of info are in different places it makes trying to actually read the file (as opposed to using a program to read it) difficult
02:22
<@Vornicus>
I mean, what if I wanted to make a race with three genders
02:22
< Chalcedon>
well, I don't see how it can be made less rigid
02:22
< Chalcedon>
i can't see me wishing to do this
02:22
<@Vornicus>
I can see /me/ wishing to do this.
02:23
< Chalcedon>
I can see what you're getting at. I don't agree with you in this case. But I can see what you mean.
02:24
<@Vornicus>
The thing I'm trying to get at, though, is that you're trying to stuff two data tables into a single file where CSV is decidedly not capable of that kind of work with any sense of reliability or cleanliness.
02:25
< Chalcedon>
I had reached that conclusion
02:25
< Chalcedon>
the argument is not being assisted by the fact that I'm getting cold and grumpy for reasons entirely unrelated to this conversation
02:26
<@Vornicus>
You /can/ use two files and just read it in and make the file go away though.
02:26
< Chalcedon>
?
02:26
<@Vornicus>
This is, in fact, the Right Way To Do It.
02:26
< Chalcedon>
the cold is making my brain stop working. please explain?
02:26
<@Vornicus>
Load your files in, put the data in some structures that are accessible to everything that needs it, and then close the files and forget they exist.
02:27
<@Vornicus>
Unless you're doing full-on file manipulation, this is preferred.
02:27
< Chalcedon>
so, like a 2D array?
02:27
<@Vornicus>
Yes.
02:28
< Chalcedon>
ok, I think that works
02:28
< Chalcedon>
(in my brain)
02:29 * Chalcedon decides to leave implementing this for when her brain is cooperating
02:29 * Chalcedon hugs and cookies Vorn, thanks for the help
02:29 * Vornicus hugs and nroms.
02:31 Chalcedon is now known as ChalcyAFK
04:19 ChalcyAFK is now known as Chalcedon
04:56 * Chalcedon pokes it
04:56
< Chalcedon>
I decided to work on an easier problem
05:07
<@Vornicus>
Heh, ok
05:31
< Chalcedon>
that one was a bit complex for my brain at the moment
05:39
<@Vornicus>
What'd you decide on?
06:41 * Raif wonders what the project is.
06:45 * Serah pokes Raif.
06:46 * Raif pokes back
06:48 Chalcedon is now known as ChalcyOut
06:49 GeekSoldier|Bed is now known as GeekSoldier
06:51 Serah [~Z@87.72.35.ns-26506] has quit [Killed (NickServ (GHOST command used by Ev3))]
06:51 Serah [~Z@87.72.35.ns-26506] has joined #Code
06:51 mode/#code [+o Serah] by ChanServ
07:05 Takyoji [~caleblang@Nightstar-25812.dhcp.roch.mn.charter.com] has joined #code
07:05
< Takyoji>
One thing I'm very curious about.. How could a person actually assemble hardware and design a driver for it?
07:06
< Takyoji>
I know it's quite complex, but what actual process would be necessary?
07:10
<@Vornicus>
Well, you start with a schematic, usually
07:11
<@Vornicus>
Which says where the inputs and outputs are, and sometimes some more interesting things.
07:11
<@Vornicus>
Then you look at that and... you know, I really should just link to the French Waiter Analogy.
07:11
<@Vornicus>
http://samba.org/ftp/tridge/misc/french_cafe.txt
07:12
<@Vornicus>
This talks about throwing things at a file server, not a hardware peripheral, but the process is approximately the same
07:18
<@jerith>
Well, if you design and construct the hardware you don't really need to reverse-engineer stuff.
07:19
<@jerith>
The complexity pretty much depends on the hardware and drivers involved.
07:31
< Raif>
Yep.
07:32
< Raif>
You can write a COM port driver in a matter of hours.
07:32 Forjehdon [~Forjadon@Nightstar-15747.ue.woosh.co.nz] has quit [Ping Timeout]
07:32
< Takyoji>
ahh
07:32
< Raif>
USB isn't all that complex either, I don't think, provided you've got the hardware.
07:33
<@Vornicus>
A lot of USB stuff has pretty standard drivers, too.
07:33
< Raif>
I'm assuming the device isn't a clone of some other existing device (e.g. keyboards)
07:33
<@Vornicus>
Keyboards and mice, other HIDs, storage... the entire class of devices uses the same driver.
07:34
< Takyoji>
I mean just something utterly simple as sensors
07:34
< Takyoji>
water temperature, power management, etc
07:34
<@Vornicus>
heh. If you know the spec, you're done in five minutes.
07:35
<@Vornicus>
well, I lie, but.
07:35
< Takyoji>
I hardly know much though, which sucks
07:35
< Raif>
Easy stuff.
07:35
< Takyoji>
A friend of mine knows a little more than I
07:35
< Raif>
Granted, I dunno whether the new WDDM stuff for Vista makes things harder or easier...
07:35
< Takyoji>
I used to fiddle with eletronics, but didn't get very indepth on it
07:36
< Raif>
Now that I think about it, I've written some pretty cool drivers.
07:37
< Raif>
One class I took in college... I needed to wire up an RC car to a PIC chip, and then write assembly for the chip that controlled the car.
07:37
< Raif>
We did some pretty crazy shit with square waves and pulses.
07:37
< Takyoji>
heh, interesting
07:38
< Raif>
Interesting fact about this particular car's steering: It was based on frequency. So you send a constant signal to the steering motor, and if you increase the frequency it turned right, and a lower frequency turned it left.
07:39
< Takyoji>
ahh
07:39
< Raif>
People who didn't know that had some funny bugs. This chip only had two pulse timers, so one for the drive and one for the steering.
07:39
< Takyoji>
And the strength of the signal defined the speed?
07:39
< Takyoji>
erm
07:39
< Takyoji>
ahh
07:40
< Raif>
We had three devices (we wrote a square wave generator to power a speaker), so we actually borrowed the steering pulse and made it play short snippets of sound before returning control to the drive.
07:41
< Takyoji>
ahh
07:42
< Raif>
The sounds were short enough that we could steal the steering control and give it back between notes for quick steering adjustments... pretty cool stuff. :)
07:42
< Takyoji>
So somebody could actually edit an audio file an use it to steer it? :P
07:42
< Raif>
You'd never notice that the steering cut out whenever a tone played, because we didn't have any really long notes. If we did, the steering would just stop responding until the end of the note. :)
07:42
< Raif>
No, the audio was embedded in the rom as source code.
07:42
< Takyoji>
oh
07:43
< Raif>
plus it was seperate... if you piped it into the steering control you'd just get left turns for low notes and right turns for high notes. :)
07:43
< Raif>
(At least that's my assumption. We never actually tried it)
07:44
<@Vornicus>
...wait, you played music from the same pulse generator that you steered the car with?
07:44
< Raif>
Had to.
07:44
< Raif>
Essentially all that means is whenever a note was playing the car had to go straight.
07:45
< Raif>
(No signal at all meant "cut power to the steering moter")
07:46
< Raif>
actually, I'm not sure if I'm misremembering that. Either it defaulted to go straight or cutting power. I vaguely remember the car could turn when we played sound, so I think it just cut the power and left the wheels in whatever position they were in last.
07:46
< Raif>
Anyway, I think it was spiffy. :)
07:47
< Raif>
IIRC, we also borrowed the drive timer, but I don't remember what for.
07:49
< Raif>
As to the purpose of your question, we had a bit you could set that would switch which output got the pulse signal, so the steering and the speakers weren't getting the signal at the same time.
07:49
< Raif>
(Though that would be both fucked up AND hilarious)
07:49
< Takyoji>
Was it directly wired to the computer, or did you operate it wirelessly?
07:50
< Takyoji>
It was wired directly, right?
07:50
< Raif>
Everything went through a peg board.
07:50
< Raif>
So yeah, direct wiring.
07:51
< Takyoji>
ahh
07:52
< Raif>
As in, we hijacked the cables the radio controller would have used.
07:53
< Takyoji>
oh
07:53
< Raif>
The only thing we didn't have was debug LED's, which could have been really useful.
07:53
< Takyoji>
yea
07:53
< Raif>
So yeah, drivers aren't all that bad, depending on your hardware. :)
07:54
< Takyoji>
How exactly do you create a driver though?
07:54
< Raif>
It can be as simple as saying "Set this register to 0x7F" if you want it to be.
07:54
< Takyoji>
ahh
07:54
<@Vornicus>
Exactly like we've said.
07:55
<@Vornicus>
Well, okay, you usually write it in C, and you often have to conform to an API on the OS side.
07:55
< Raif>
In the case of a PC, you just use API's to say "I want to send this signal to pin 1 on COM 0" (that's a simplification, but yeah).
07:55
<@Vornicus>
...wow. using "the OS side" as the high level end of a glue layer is not something I usually do.
07:55
< Raif>
Yeah, ain't it grand?
07:55
< Raif>
But this is what the kernel was designed to do: abstract the hardware.
07:56
< Raif>
actually, drivers do that, but whatever. :P
07:57
< Raif>
Anyway, off to watch another movie.
07:57
< Takyoji>
Bye Raif
07:57
< Raif>
Toodles.
08:15 Vornicus is now known as Vornicus-Latens
08:17 Serah [~Z@87.72.35.ns-26506] has quit [Killed (NickServ (GHOST command used by Ev3))]
08:17 Serah [~Z@87.72.35.ns-26506] has joined #Code
08:17 mode/#code [+o Serah] by ChanServ
08:25 Takyoji [~caleblang@Nightstar-25812.dhcp.roch.mn.charter.com] has quit [Quit: ]
09:10 You're now known as TheWatcher
09:42 Serah [~Z@87.72.35.ns-26506] has quit [Killed (NickServ (GHOST command used by Ev3))]
09:42 Serah [~Z@87.72.35.ns-26506] has joined #Code
09:42 mode/#code [+o Serah] by ChanServ
10:18 Forj [~Forj@Nightstar-15747.ue.woosh.co.nz] has joined #code
10:26 ChalcyOut is now known as Chalcedon
11:03 Chalcedon [~Chalcedon@Nightstar-15747.ue.woosh.co.nz] has quit [Quit: Gone]
11:47 Forj [~Forj@Nightstar-15747.ue.woosh.co.nz] has quit [Quit: Gone]
13:53 gnolam [lenin@Nightstar-13557.8.5.253.se.wasadata.net] has joined #Code
13:53 mode/#code [+o gnolam] by ChanServ
14:20 ToxicFrog is now known as ToxicFrog|W`rkn
14:21 Thaqui [~Thaqui@Nightstar-26828.jetstream.xtra.co.nz] has left #code [Leaving]
15:05 GeekSoldier_ [~Rob@Nightstar-4257.pools.arcor-ip.net] has joined #code
15:06 GeekSoldier [~Rob@Nightstar-5216.pools.arcor-ip.net] has quit [Ping Timeout]
15:17 GeekSoldier_ is now known as GeekSoldier
15:23 Serah [~Z@87.72.35.ns-26506] has quit [Killed (NickServ (GHOST command used by Ev3))]
15:23 Serah [~Z@87.72.35.ns-26506] has joined #Code
15:23 mode/#code [+o Serah] by ChanServ
15:50 Reiver is now known as ReivZzz
16:34 McMartin [~mcmartin@Nightstar-9497.dsl.pltn13.sbcglobal.net] has quit [Quit: brb]
16:44 KarmaBot [~fark.off@87.72.35.ns-26506] has joined #Code
16:44 mode/#code [+v KarmaBot] by ChanServ
16:49 Serah [~Z@87.72.35.ns-26506] has quit [Killed (NickServ (GHOST command used by Ev3))]
16:49 Serah [~Z@87.72.35.ns-26506] has joined #Code
16:49 mode/#code [+o Serah] by ChanServ
17:08 You're now known as TheWatcher[afk]
18:07 GeekSoldier_ [~Rob@Nightstar-4526.pools.arcor-ip.net] has joined #code
18:07 GeekSoldier [~Rob@Nightstar-4257.pools.arcor-ip.net] has quit [Ping Timeout]
18:14 Serah [~Z@87.72.35.ns-26506] has quit [Killed (NickServ (GHOST command used by Ev3))]
18:14 Serah [~Z@87.72.35.ns-26506] has joined #Code
18:14 mode/#code [+o Serah] by ChanServ
18:14 KBot [~fark.off@87.72.35.ns-26506] has joined #Code
18:16 KarmaBot [~fark.off@87.72.35.ns-26506] has quit [Ping Timeout]
18:16 KBot is now known as KarmaBot
18:17 GeekSoldier_ [~Rob@Nightstar-4526.pools.arcor-ip.net] has quit [Ping Timeout]
18:17 GeekSoldier_ [~Rob@Nightstar-6277.pools.arcor-ip.net] has joined #code
18:18 You're now known as TheWatcher
18:24 GeekSoldier_ is now known as GeekSoldier
19:35 Chalcedon [~Chalcedon@Nightstar-15747.ue.woosh.co.nz] has joined #code
19:35 mode/#code [+o Chalcedon] by ChanServ
20:04
<@ToxicFrog|W`rkn>
Ok, here's where having 0-indexed arrays would be handy.
20:04
<@ToxicFrog|W`rkn>
I can't remember whether I decided that Maps are 0-indexed (the way they are stored) or 1-indexed (the way Lua likes things)
20:05
<@ToxicFrog|W`rkn>
...on the other hand, I can implement it however the hell I like, because accessing Map.tiles directly is Wrong.
20:05 * ToxicFrog|W`rkn huggles encapsulation
20:07
<@ToxicFrog|W`rkn>
...hmmm.
20:07
<@ToxicFrog|W`rkn>
I have a number./
20:07
<@ToxicFrog|W`rkn>
I need to round it up to the next -power- of two.
20:08
<@ToxicFrog|W`rkn>
I do not have access to log2.
20:14
<@Vornicus-Latens>
Integer, or float?
20:14
<@Vornicus-Latens>
Anddo you have access to any log?
20:16 * Vornicus-Latens assumes of course you have * / < and >, which is all you need.
20:18
<@Vornicus-Latens>
for integers: result = 1; while (result < n) result *= 2; return result
20:18
<@Vornicus-Latens>
use <= instead of < if you want 2 to round to 4 instead of 2.
20:21
<@Vornicus-Latens>
(this of course only works with positive numbers.)
20:23
<@Vornicus-Latens>
Floats you need to do a similar thing with heading away from 1 in the other direction.
20:23 You're now known as TheWatcher[afk]
20:26 Vornicus-Latens is now known as Vornicus
20:31
<@Chalcedon>
how do you create a copy of a variable again?
20:31
<@Chalcedon>
(ie copy one variable into another)
20:38
<@Vornicus>
a copy? in Python, copy(foo) creates a copy.
20:38
<@Vornicus>
there's also the deepcopy module, which does more.
20:39
<@Chalcedon>
nono, thats alll I wanted :)
20:39
<@Chalcedon>
thanks
20:40
<@Vornicus>
(copy creates shallow copies - both copies refer underneath to the same object)
20:44
<@Chalcedon>
so changing one changes the other?
20:46
<@ToxicFrog|W`rkn>
Vornicus: floats, but I can floor them first to make things easier. and I have access to log10 and loge.
20:46
<@ToxicFrog|W`rkn>
And, yeah, I already came up with that, I was hoping for a simpler formula~
20:47
<@ToxicFrog|W`rkn>
Vornicus: how does copy() differ from assignment, then?
20:47
<@Vornicus>
2**floor(log10(n)/log10(2) + 1)
20:47
<@Vornicus>
Um
20:47
<@Vornicus>
Both copies refer underneath to any objects that they would refer to. Let me describe again.
20:47
<@ToxicFrog|W`rkn>
I mean, if copy just copies by reference, how do "foo = bar" and "foo = copy(bar)" differ?
20:47
<@ToxicFrog|W`rkn>
Aah.
20:47
<@ToxicFrog|W`rkn>
Yes, that makes more sense.
20:48
<@Vornicus>
except that it doesn't appear to be a builtin either.
20:48
<@Vornicus>
gah, hang on.
20:48
<@ToxicFrog|W`rkn>
Chalcedon: the copy is a distinct object, and changing it won't change the original. However, if the original referred to -other- objects too, the copy will refer to the same objects rather than copies of those as well.
20:49
<@Chalcedon>
ah. I think I see.
20:49
<@Chalcedon>
create a copy of /this/ object but leave those other objects (that this object refers to) alone.
20:49
<@ToxicFrog|W`rkn>
Indeed.
20:50
<@Chalcedon>
excellent :)
20:50 * Chalcedon now understands :)
20:50
<@Vornicus>
So if you copy a list of lists, using append() on one of the inner lists will change the inner list, which is referred to by both copies.
20:50
<@Chalcedon>
yay my NPC generator is nearly finished :)
20:50
<@Vornicus>
yay
20:50 * Chalcedon nods at Vornicus
20:51
<@Chalcedon>
so if I needed a completely distinct copy of a list of lists, I'd need to use the deep copy module?
20:51
<@ToxicFrog|W`rkn>
...hmm. The SS1 map format appears to top out at 128x128 tiles.
20:51
<@Chalcedon>
I just need to sort out the slightly complicated bit from yesterday and tidy up the output
20:51 * Chalcedon contemplates a GUI
20:51
<@ToxicFrog|W`rkn>
256x256, sorry.
20:52
<@ToxicFrog|W`rkn>
The object xref table supports 65536x65536, but the master object table uses one byte.
20:55 * Chalcedon hugaVorn
20:56
<@Chalcedon>
I realised that your idea really is the best way of doing it because I'll have the racial boundaries in separate files, but the descriptions (short, average, tall) won't really vary from race to race.
20:58
<@ToxicFrog|W`rkn>
Hmm. Being able to pass ASTs around would come in handy here.
20:58 * Chalcedon supplies cookies
20:59
<@Vornicus>
Chalcy: yes.
21:00 * Vornicus hugaChalcy, nroms cookies.
21:01
<@Chalcedon>
I just couldn't see that yesterday, I'm pleased I left it overnight
21:01
<@Chalcedon>
I also cleared up another problem I was having
21:03
<@ToxicFrog|W`rkn>
Yay!
21:05 Serah [~Z@87.72.35.ns-26506] has quit [Killed (NickServ (GHOST command used by Ev3))]
21:05 Serah [~Z@87.72.35.ns-26506] has joined #Code
21:05 mode/#code [+o Serah] by ChanServ
21:05 KBot [~fark.off@87.72.35.ns-26506] has joined #Code
21:07 KarmaBot [~fark.off@87.72.35.ns-26506] has quit [Ping Timeout]
21:07 KBot is now known as KarmaBot
21:24
<@ToxicFrog|W`rkn>
getmetatable(io.stdout).__index.printf = fprintf -- I cannot believe that worked
21:37 You're now known as TheWatcher
21:40 * Chalcedon pokes python
21:41
<@Chalcedon>
can one not do: if x and y: (then)
21:41
<@Chalcedon>
*?
21:42
<@Chalcedon>
never mind, I sorted it
22:30 Serah [~Z@87.72.35.ns-26506] has quit [Killed (NickServ (GHOST command used by Ev3))]
22:30 Ev3 [~Z@87.72.35.ns-26506] has joined #Code
22:39 You're now known as TheWatcher[T-2]
22:40
<@Chalcedon>
(it's alive)
22:40
<@Vornicus>
(woot)
22:43 You're now known as TheWatcher[zZzZ]
23:15
< Ev3>
Which Wiki would you suggest for an RPG/Coding based wiki?
23:15
< Ev3>
And do you know of any wiki with syntax highlight? (ROR/PHP especially)
23:17
<@Vornicus>
Mediawiki is made of awesome, and you can probably find syntax highlighting modules for it.
23:17
< Ev3>
I far prefer MoinMoin :p
23:18 Ev3 is now known as Serah
23:18
<@Vornicus>
I have found Moin to be rather fragile.
23:20
< Serah>
Fragile?
23:21
<@Vornicus>
Yeah. I upgraded my moin install and I ended up with a very broken search.
23:21
< Serah>
Oh.
23:21
<@Vornicus>
Also I have to reinstall it every time I upgrade Python.
23:21
<@Vornicus>
Fragile.
23:22
<@Chalcedon>
woe :(
23:22 * Chalcedon should probably upgrade her Python
23:28
<@Vornicus>
There are also some Rails wikis floating around, they probably can handle a lot of different things.
23:33 Chalcedon is now known as ChalcyAFK
--- Log closed Fri Jul 06 00:00:08 2007
code logs -> 2007 -> Thu, 05 Jul 2007< code.20070704.log - code.20070706.log >