code logs -> 2010 -> Sun, 03 Oct 2010< code.20101002.log - code.20101004.log >
--- Log opened Sun Oct 03 00:00:02 2010
00:00 Ortiha [orthianz@Nightstar-349db330.xnet.co.nz] has quit [Connection reset by peer]
00:07 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has joined #code
00:08 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has quit [Connection reset by peer]
00:16 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has joined #code
00:37 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
00:42 You're now known as TheWatcher[T-2]
00:50 You're now known as TheWatcher[zZzZ]
00:52 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has quit [Connection reset by peer]
00:59 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has joined #code
01:00 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has quit [Connection reset by peer]
01:07 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has joined #code
01:17 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has quit [Connection reset by peer]
01:24 Derakon[AFK] is now known as Derakon
01:37 Kazriko [kaz@Nightstar-e09690fa.client.bresnan.net] has quit [Client closed the connection]
01:42 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has joined #code
01:46 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has quit [Connection reset by peer]
01:53 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has joined #code
02:15 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has quit [Connection reset by peer]
02:21 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has joined #code
02:24 Kazriko [kaz@Nightstar-e09690fa.client.bresnan.net] has joined #code
02:25 mode/#code [+o Kazriko] by Reiver
02:25 * Vornicus actually gets around to doing the Game Maker "Scrolling Shooter" tutorial. This is easy, but he wishes it were a little faster to build event sequences.
02:25 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has quit [Client closed the connection]
02:33 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has joined #code
02:33 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has quit [Client closed the connection]
03:06 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has joined #code
03:06 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has quit [Client closed the connection]
03:15 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has joined #code
03:43 Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [[NS] Quit: ]
03:48 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
04:04 Syloqs_AFH [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
04:05 Syloqs_AFH is now known as Syloqs-AFH
04:15 Ortiha [orthianz@Nightstar-ddad018c.xnet.co.nz] has joined #code
04:17 Orthia [orthianz@Nightstar-349db330.xnet.co.nz] has quit [Ping timeout: 121 seconds]
04:28 kwsn\drunk [kwsn@31356A.5FD175.2259B6.DFACD4] has joined #code
04:30
< kwsn\drunk>
hi everybody :D
04:32 cpux [chatzilla@Nightstar-c978de34.dyn.optonline.net] has joined #code
04:32 kaura [kaura@Nightstar-fd82400d.snfc21.sbcglobal.net] has joined #code
04:35 * Vornicus gives kwsn a cheese.
04:36 * kwsn\drunk noms teh cheese
04:36 * Vornicus also gives kaura an instance of the Cheese class.
04:36
< kwsn\drunk>
speaking of cheese
04:36
< kwsn\drunk>
there's a mouse in the radio station on campus
04:36
< kwsn\drunk>
we named him evo (our name is "the evolution" XD
04:41 Zed [Zed@Nightstar-556ea8b5.or.comcast.net] has quit [Client closed the connection]
04:42 Zed [Zed@Nightstar-556ea8b5.or.comcast.net] has joined #code
04:43 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
04:47 * Vornicus gets the enemies all put in to the scrolling shoooter tutorial.
04:47
<@Vornicus>
Now this game is hard.
04:58
< kwsn\drunk>
what game?
04:58
<@Vornicus>
There's a "scrolling shooter tutorial" for Game Maker 8.
04:59
< kwsn\drunk>
ah
04:59 * kwsn\drunk makes Vornicus suffer through touhou on lunitic
04:59
< kwsn\drunk>
*lunatic
05:03
< kaura>
kwsn: Man, at that point, it isn't a shooter challenge anymore. It's a matter of memorization.
05:03
< kwsn\drunk>
true
05:04
<@Vornicus>
See, here's the thing
05:04
< kwsn\drunk>
kaura: but even all the memorization on the planet won't help you unless you have twitch reflexes
05:04
<@Vornicus>
I have trouble with bullet "aw jeez"
05:05
<@Vornicus>
And sometimes with bullet "oh fiddlesticks"
05:05
<@Vornicus>
Kaura!
05:05
< kaura>
Vorn!
05:06
< kaura>
Kwsn: Not true at all! That's a matter of memorization of both space and time.
05:06
<@Vornicus>
I actually missed a spot last night when we were talking about the stuff you can cut out. load_deck can be excised entirely as well. Also, since we're using a class now, we have to tell it to use the class to load the deck, too, at the start of the program.
05:06
< kwsn\drunk>
haha
05:06
< kaura>
Hrn. Alright.
05:07
<@Vornicus>
You can see how to do that load in the user_load function.
05:09
< kaura>
deck = Deck('decklist.txt'), right?
05:09
<@Vornicus>
Yep.
05:09
<@Vornicus>
Really we should replace this with something that asks what deck file you want to use, but... not yet, we have a couple of other things to write.
05:09
<@Vornicus>
--speaking of which I need to see your code again.
05:11
< kaura>
Here ye go. http://pastebin.starforge.co.uk/396
05:12
<@Vornicus>
Why thank you. Now, let's see. Ah!
05:13
<@Vornicus>
One of the methods in Deck can screw up in a way that we haven't caught in its user_ function. Can you tell which one it is?
05:15
< kaura>
...well, I did just find out that draw() is borking up somehow...
05:16
<@Vornicus>
Heh, that would be a problem, let's look at that first.
05:16
<@Vornicus>
What's it saying?
05:16
< kaura>
"draw() takes exactly 2 arguments (3 given)"
05:17
< kaura>
I'm inputting just 'draw'
05:17
<@Vornicus>
Ah, I see.
05:17
<@Vornicus>
Okay, you say deck.draw(deck, x)
05:17
<@Vornicus>
But what you should /really/ be doing is deck.draw(x)
05:18
< kaura>
Ahhh, just ran across that line, actually, and thought something seemed a bit screwy by how often it referenced "deck"
05:18
<@Vornicus>
The same is true of all ofther locations where you do deck.something(deck...)
05:19
< kaura>
Yep. ...for example, I seem to only be capable of drawing swamps now. o_O
05:20
<@Vornicus>
What
05:20
<@Vornicus>
examine the deck!
05:21 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
05:21
< kaura>
I... ... can't?
05:21 * kaura eyes his code
05:21
< kaura>
Alright, apparently I borked something again.
05:21
<@Vornicus>
Show me what you've got now.
05:22
< kaura>
http://pastebin.starforge.co.uk/397
05:24
<@Vornicus>
You didn't fix examine.
05:24
<@Vornicus>
or shuffle.
05:25
<@Vornicus>
Or peek.
05:26
< kaura>
Mngh. Something's still wrong. Corrections were to be made to the user_ portion, right, not the class?
05:26
<@Vornicus>
(when constructing a call to a method, skip the "self" and go straight to the other parameters)
05:26
<@Vornicus>
Right.
05:27
<@Vornicus>
(if there aren't any other parameters, like in shuffle, peek, or examine, then just pass empty parentheses like we do to random.shuffle)
05:31
< kaura>
Hokay. Function's working again, but all I'm getting's the bottommost entry of the .txt document.
05:31
< kaura>
Made 20 times over, since this list has 20 swamps.
05:32 * kaura headscratches. Lesse, back at the class...
05:33
<@Vornicus>
That's very strange.
05:33
<@Vornicus>
OH.
05:34
<@Vornicus>
No, that's not it.
05:34
<@Vornicus>
But you open the deck_file twice, once before the loop and once as the loop iterator; the first one doesn't need to happen.
05:34
<@Vornicus>
Ah.
05:35
<@Vornicus>
the "for k in range(count):" and its child line should be indented more.
05:35
< kaura>
Ah, you're right. That fixes it.
05:36
<@Vornicus>
What was happening was it was doing the splitting and stuff and then just discarding it --- except for the last time the loop ran, when it finally fell through and saw the next loop.
05:36
<@Vornicus>
By indenting the next loop, that now-inner loop happens for each line.
05:37
< kaura>
Right, I was failing to tell the program to do this loop within the other.
05:37
<@Vornicus>
Right.
05:40
<@Vornicus>
Okay! Now that we've fixed the code so it actually works, let's find the error that I mentioned.
05:41
<@Vornicus>
This particular error goes something like "what if I do ??? but I technically can't because ???"
05:42
< kaura>
Well, you can't draw 0 without triggering a red error, but I'd imagine this isn't the issue...
05:42
< kaura>
search marit lage
05:42
< kaura>
Whups, wrong window
05:43
< kaura>
Right, not search either.
05:43
<@Vornicus>
(that bit there -- using lowercase letters in cards -- is one of the two Crazies I have figured)
05:44
< kaura>
...huh. You can put a blank card on top of the deck. This... oh, right, doesn't keep track of hand.
05:45
<@Vornicus>
Actually that's one that I didn't think of!
05:47
< kaura>
Well, it makes sense. There's absolutely nothing in the code that keeps track of what's in the hand.
05:47
< kaura>
The "top" command merely lets you input a string of any sort.
05:47
<@Vornicus>
Technically all we should do there is complain if user_top gets an empty string.
05:48
<@Vornicus>
and same with user_bottom
05:50
< kaura>
Right.
05:50
<@Vornicus>
That shouldn't be hard at all.
05:50 kwsn\drunk [kwsn@31356A.5FD175.2259B6.DFACD4] has quit [[NS] Quit: ]
05:50
< kaura>
Not at all.
05:51 kwsn\drunk [kwsn@31356A.5FD175.2259B6.DFACD4] has joined #code
05:51
< kwsn\drunk>
fucking isp
05:51
< kaura>
...except it is. Dammit.
05:52
< kaura>
Oh, because I'm using len() to do it, and it really doesn't fit here.
05:54
< kaura>
...feck, no. Why am I screwing something so simple up?
05:57
<@Vornicus>
Actually len works and "fits" too but I wouldn't technically do it that way -- what have you tried?
05:58
< kaura>
http://pastebin.starforge.co.uk/398
05:59
< kaura>
Sorry, I think exhaustion's kicking my ass today. Thinking through a haze of tired right now. It feels as if the solution for this ought to be obvious, but executing it isn't.
05:59
<@Vornicus>
Don't do it in the Deck class.
06:00
< kaura>
...oh, duh. And the samples I was using to figure it out were all in the user_ section too.
06:00
<@Vornicus>
(also, fix that bottom signature; it should look like topwise's signature)
06:02
< kaura>
There we go.
06:03
< kaura>
Works now. Here's the code, after adjusting bottom's signature. http://pastebin.starforge.co.uk/399
06:04
<@Vornicus>
All right. Make sure bottom works though - I wasn't talking about the name.
06:04
< kaura>
Eh? Yeah, it works. ... yeah, works fine.
06:05
<@Vornicus>
Okay good.
06:07
< kaura>
Right, now back to the error..
06:08 Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
06:08
< kaura>
Ah. Could it be any prompt not defined? "randomstringofgibberish" spits out red and kicks you out of the program, for example.
06:08
<@Vornicus>
Oh, right, we have to fix that too.
06:09
<@Vornicus>
Have we used the "in" boolean operator? I don't think so.
06:09
< kaura>
Nnno.
06:10
<@Vornicus>
Okay. If I say a = [1, 2, 3]... "1 in a" will give True; "4 in a" will give False; "1 not in a" will give False.
06:10
<@Vornicus>
This also works on tuples, and on dictionaries -- where the thing it's looking for must be a key.
06:11
< kaura>
So "(command) in CMND_NAMES"
06:11
<@Vornicus>
so we have to do something before we try this first: we need the lower-case version of the command string.
06:12
< kaura>
Does it help that they are in lowercase already?
06:12
<@Vornicus>
... the other way around.
06:13
< kaura>
or would it be CMND_NAMES.lower()?
06:13
<@Vornicus>
We don't want DRAW triggering the help page; we want it doing whatever "draw" does.
06:14
<@Vornicus>
We have to make the input command lowercase.
06:14
< kaura>
Ahh. so "input.lower() in CMND_NAMES" rather?
06:15
<@Vornicus>
(since we'll also need it later, let's make it early -- probably as we split it off the input -- and keep it.)
06:15
<@Vornicus>
(that'd be the "function = split_cmnd[0]" line that I'm talking about.
06:16
< kaura>
Ah.
06:16 Syloqs_AFH [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
06:17 Syloqs_AFH is now known as Syloqs-AFH
06:18
<@Vornicus>
Then check function against the CMND_NAMES -- but, since we actually want to change it if it's not there, use "not in"
06:20
< kaura>
Ah, that's actually really simple. A single "if" line with a return text, huh?
06:20
<@Vornicus>
No, don't return anything; what we're going to do is change function to "help" :)
06:20
< kaura>
Ooh, smarter.
06:22
<@Vornicus>
(I actually forgot that I hadn't done this; it was supposed to happen when we added the help in the first place.)
06:24
<@Vornicus>
Anyway show me the code of request_input when you're done futzing with it.
06:25
<@Vornicus>
Andthen we can get back to finding the error that I was looking for in the first place!
06:25
<@Vornicus>
(the ones you have found are pretty good though)
06:26
< kaura>
...hrn. Soon as I figure out why "helpinfo" isn't triggering the helptext...
06:27 Anno[Laptop] [annodomini@Nightstar-03624f38.adsl.tpnet.pl] has joined #code
06:27
<@Vornicus>
Show me?
06:28
< kaura>
http://pastebin.starforge.co.uk/400
06:28
< kaura>
Probably doing it entirely wrong...
06:29
<@Vornicus>
Set it to the /string/ "help" -- which is what it then looks up.
06:37
<@Vornicus>
See how that works?
06:39
< kaura>
...hrn. "TypeError: programhelp() takes no arguments (1 given)"
06:40
<@Vornicus>
Show me the code
06:40
< kaura>
(but, yeah, I see now where I was going wrong by inputting a variable instead of a string)
06:40
<@Vornicus>
Oh, oh.
06:41
<@Vornicus>
Oh, I see what happened.
06:41
<@Vornicus>
Give programhelp() a dummy parameter -- like we did for, say, user_peek, or user_examine
06:42
<@Vornicus>
(we could also make programhelp give more detailed help on specific commands, but... not now.)
06:44
< kaura>
Ah, there we are. Had to tweak it to assign programhelp() a variable upon bootup, but it'll take anything and spit out the same result anyhow.
06:44
<@Vornicus>
Right. Dummy parameter.
06:45
<@Vornicus>
Okay. Let's get back to finding that error!
06:45
< kaura>
Right!
06:46
<@Vornicus>
Now, a bit more detail: this error is one that, in other situations, would be a perfectly normal command.
06:46
<@Vornicus>
But in a specific condition, will give you an error.
06:47
< kaura>
Ah. Peeking when the deck's out of cards.
06:47
< kaura>
"IndexError: list index out of range."
06:47
<@Vornicus>
\o/
06:48 kwsn\drunk is now known as kwsn
06:48
<@Vornicus>
Okay, so, catch that error in user_peek and say something that makes more sense!
06:48 Derakon is now known as Derakon[AFK]
06:50
< Alek>
xxx: I just got a spam, "Hey, I live in the house opposite, here's my email, let's get acquainted." I replied that I live across from a morgue, and such acquaintances frighten me.
06:55
< kaura>
Like so? http://pastebin.starforge.co.uk/402
06:58
<@Vornicus>
Perfect.
06:58
< kaura>
\o/
06:58
<@Vornicus>
All right. Now, let's upgrade our input prompt, shall we?
06:58
< kaura>
Aye.
06:59
<@Vornicus>
First things first, let's make it so you can find out the number of cards left in a Deck object more easily.
07:00
<@Vornicus>
to do this, we're going to write a method in Deck called __len__
07:01
<@Vornicus>
it should take only "self" as a parameter, and it should return the number of items in the deck.
07:05
<@Vornicus>
(what this does is, it makes Deck objects work with the len function.)
07:06
<@Vornicus>
(there are many other special methods that you can write, but this is one of the more important ones. __nonzero__ and __cmp__ (and __eq__, __ne__, __gt__, __ge__, __lt__, and __le__, if you want more detail)
07:07
<@Vornicus>
are also very important.
07:09
< kaura>
Hrn... not quite working as expected. Missing a step.
07:10
<@Vornicus>
It's not nearly as hard as it looks. It's one function call inside it.
07:11
< kaura>
Was it supposed to be "def __len__(self): return len(deck)"?
07:11
<@Vornicus>
where would it get deck? You talk about the deck's length somewhere else in your class.
07:13
<@Vornicus>
(and you talk about the deck itself all over the place in there.)
07:13
< kaura>
Ah, len(self.deck)
07:13
<@Vornicus>
There you are.
07:14
<@Vornicus>
Okay, now let's go back down to request_input, and find the line where we toss up a prompt.
07:14
< kaura>
Yeah, that ought to have been obvious I've used the exact same line before, after all.
07:17
<@Vornicus>
(and put that line in here)
07:20
< kaura>
...'m not sure I completely understand. By request_input, you mean command(), or the CMND_NAMES dict?
07:20
<@Vornicus>
er, is that what it's called now? Yeah, command
07:20
< kaura>
Ah-hah.
07:22
<@Vornicus>
(though apparently we no longer toss up an actual prompt, oh well.)
07:23
<@Vornicus>
Anyway, find the line where you ask the user to type something, and copy that into here.
07:27 kwsn is now known as kwsn\t-2
07:28
< kaura>
...Dammit. this isn't tricky...
07:29
<@Vornicus>
Look at each line in command() -- probably bottom to top is best -- and ask yourself where it got the stuff used in each line. The one where you say "the user typed this in directly" is the line in question.
07:31
< kaura>
raw_input(), right? Can't wrap my head around where to append __len__, though.
07:32
< kaura>
(or how)
07:32
<@Vornicus>
Well, see, raw_input takes an argument.
07:32
<@Vornicus>
And that argument is a string that gets printed before the cursor appears.
07:33
<@Vornicus>
In a certain sense, the python interactive interpreter is built around a call that goes like "raw_input(">>> ")
07:33
<@Vornicus>
only wihout that " at the beginning. :P
07:34
<@Vornicus>
So try using raw_input("> ") instead of just raw_input() there, see what happens. Then we'll get to the next step.
07:34
< kaura>
Ahh.
07:35 kwsn\t-2 is now known as kw-sleep-n
07:35 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
07:41
<@Vornicus>
So anyway, having tried that, we now need to take the length of the deck and put it in there before the >.
07:41
<@Vornicus>
So here we are: raw_input(str(len(deck)) + "> ")
07:42
< kaura>
Ah... came up with something close to that but flawed. raw_input(len(deck)) works, but won't accept the remainder of the message.
07:42
<@Vornicus>
Int-string problems? Yeah, saw that coming.
07:43
<@Vornicus>
Anyway: as you can see, __len__ makes len() work.
07:44
< kaura>
Aye.
07:47
<@Vornicus>
So anyway as you can see we've now made several improvements: we've caught the peek error, made sanity checks to top and bottom, gotten help to appear when we fuck up. In fact I think we're about ready to tackle the crazy things. Next time, though.
07:48
< kaura>
Yay, crazy things!
07:48
<@Vornicus>
One of which we can actually technically do with just the stuff we know now; the other, on the other hand, will take some Doing.
07:48
< kaura>
I like the sound of Doing. It sounds like an increased skillset.
07:49
<@Vornicus>
Indeed it is.
08:01
<@Vornicus>
But both of them take some explaining so we won't be doing them tonight.
08:01 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has joined #code
08:06
<@Vornicus>
I should mention what they /are/ though.
08:07
<@Vornicus>
1. making it so the program lets you use mis-cased names (so "mountain" and "Mountain" both work) and remembers the right casing; 2. making it so examine actually produces something that looks like the input file.
08:10
< kaura>
I can see why 2 would be hard. 1.'s just an application of the lowercase() method, right?
08:11
<@Vornicus>
It's a little more complicated than that, actually.
08:12
<@Vornicus>
We have to remember the right casing for each term, and associate it with the lowercase version.
08:13
< kaura>
Ahh... involved.
08:15
<@Vornicus>
That's... actually not that hard either, and one of the advantages of putting Deck in a class is that we don't have to drag that along in a separate variable too -- but it still requires a bit of trickery.
08:17 Derakon[AFK] is now known as Derakon
08:18
<@Vornicus>
oh, right, I was gonna have you write reload, and also set up a prompt to ask for a deck filename before actually getting into the meat of the program.
08:20
<@Vornicus>
But before we get there, let's do a bit of cleaning. That part where you load the deck for the first time, and that part where you print the program help, drag both of those to the bottom, just before the loop with command
08:24
< kaura>
Done.
08:28
<@Kazriko>
eh. item[lcase(key)] = [key, otherdata]
08:30
<@Vornicus>
Kaz: remember we're dealing with someone who's been programming for two weeks, not 10+ years. :)
08:30
<@Kazriko>
ok. :)
08:34
<@Vornicus>
Kaura: okay, so let's write reload. This is probably not quite the /nicest/ way to do it, but it avoids data corruption because of the way it's done.
08:34
<@Vornicus>
What we're going to do is get deck's deck_file, and create a new Deck object from it, and assign that to the global deck.
08:36
<@Vornicus>
Actually we could probably write a... clone method into Deck to do this, which is probably a good idea -- just have it return a fresh deck using the existing deck_file and then use that in user_reload -- but you don't have to.
08:40
<@Vornicus>
(the alternative I thought of -- rejiggering the deck in-place -- fails if you have updated the deck file and have accidentally screwed it up, because it then mangles the existing data and /then/ blows up in your face)
08:40
<@Vornicus>
(Rules of failure: Fail early, fail loudly, fail safely.)
08:48
< kaura>
...hrn. "reload" seems to be a preexisting function. IDLE's outputting it as purple instead of the blue of a "normal" new function. Rewrite it as "__reload__", right, to avoid conflict?
08:49
<@Vornicus>
oh, right, reload is a special function, forgot that.
08:50
<@Vornicus>
and no, don't do that.
08:50
<@Vornicus>
rename it, idunno, refresh
08:50
< kaura>
k
08:51
<@Vornicus>
(__yadda__ is for Special Things That Python Knows About)
08:51
< kaura>
Ahh.
08:51
<@Vornicus>
(the actual reload function is for those extremely rare cases when you want a module to get completely rebuilt and reloaded. I've never used it.)
08:52
<@Derakon>
I use it regularly at work. One of our programs has a built-in Python console, so I can make changes to a module, reload it, and have the program recognize those changes on the fly.
08:59
< kaura>
Hrn... not doing this right, obviously.
09:00
< kaura>
Even know where the first error is. >_>
09:00
<@Vornicus>
Show me.
09:00
< kaura>
It's not "def refresh(deck_file): deck = deck_file" Because deck_file isn't defined...
09:02
<@Vornicus>
start with global deck
09:02
<@Vornicus>
then where is deck_file being kept?
09:04
<@Vornicus>
or, rather, where is deck's deck_file being kept?
09:08
<@Vornicus>
and then how do you make a fresh deck from that?
09:15
<@Vornicus>
Still stumped?
09:15
< kaura>
...meh, pretty sure this is wrong in a lot of ways.
09:15
< kaura>
http://pastebin.starforge.co.uk/403
09:15
< kaura>
Basically, it occurred to me that it shouldn't be too different from user_load, but...
09:15
<@Vornicus>
Not too bad.
09:16
<@Vornicus>
Refresh however should merely take a dummy parameter -- it has to get deck_file from somewhere else: /inside deck/
09:16
<@Vornicus>
Also, since this is essentially a user_ function, it should return a string -- which deck particularly is not.
09:17
<@Vornicus>
(user_load, now that I look at it, also has to do this. I'd say user_load should return deck_file + " loaded."
09:18 ToxicFrog [ToxicFrog@ServerAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
09:19 ToxicFrog [ToxicFrog@ServerAdministrator.Nightstar.Net] has joined #code
09:19 mode/#code [+o ToxicFrog] by Reiver
09:20
<@Vornicus>
So: how do we get deck_file from inside deck?
09:22
< kaura>
Actually, I'm stumped on that.
09:23
<@Vornicus>
There's a particular thing that we use to talk about something's ...something.
09:25
<@Vornicus>
It's used rather a bit in this program.
09:26
<@Vornicus>
in fact most of the time you've probably used it without thinking too much about it.
09:26
<@Vornicus>
We stored deck_file somewhere. Where?
09:27
<@Vornicus>
(on what line, particularly)
09:28
< kaura>
Eh... I think deck_file was defined on line "deck = Deck('decklist.txt'), just prior to the initial help print and the while True loop.
09:29
<@Vornicus>
That's where we got it -- at some point, however, that thing /stores/ "decklist.txt" somewhere. Where?
09:30
<@Vornicus>
(hint: where's the next place it goes when seeing that line)
09:30
< kaura>
...__init__, was it?
09:31
< kaura>
(gah, don't know why I'm so stuck on this)
09:33
<@Vornicus>
__init__, yeah. Now go through that. Somewhere in there we store deck_file.
09:34
< kaura>
open(deck_file)
09:35
<@Vornicus>
nope -- that /uses/ deck_file, but it doesn't put it anywhere.
09:35
< kaura>
>_<
09:36
< kaura>
Wait. By storage, you mean how it puts all of the content into self.deck?
09:37
<@Vornicus>
No.
09:37
<@Vornicus>
We're storing the /name/ of the deck file -- which is to say, deck_file.
09:40
<@Vornicus>
This is a hell of a lot more obvious than you're probably thinking.
09:40
< kaura>
...the only place I can see it possibly going is into the function signature, but that doesn't sound right.
09:40
<@Vornicus>
What's the line after it do?
09:41
<@Vornicus>
(the line after the signature, that is)
09:43
< kaura>
That was the open(deck_file) line I mentioned previously.
09:43
<@Vornicus>
That's weird, cuz that's not the line i see after the signature.
09:44
<@Vornicus>
(nad if the entire line is open(deck_file) then that line isn't doing anything and shouldn't be there - it may "open the file" but since the handle isn't being assigned to anything it gets collected immediately and the file recloses.)
09:45
< kaura>
Alright. Don't quite remember how it ended up there, but the line after is self.deck = []
09:46
<@Vornicus>
....paste the whole of __init__ please, I think you deleted the wrong line when I told you about open(deck_file) before.
09:46
<@Vornicus>
Which may be while you're having trouble: I might have been assuming that you have still been holding on to deck_file in the class when you have not!
09:47
< kaura>
http://pastebin.starforge.co.uk/404
09:47
<@Vornicus>
Yeah, you did.
09:47 * kaura headdesks
09:47
<@Vornicus>
http://pastebin.starforge.co.uk/397 <--- look here, you'll see that you deleted a line. It's a line that should not have been deleted.
09:48
<@Vornicus>
(but /do/ delete the line that says "open(deck_file)" and nothing more, because as I said it does nothing.)
09:48
< kaura>
Oh, huh. How'd that get deleted...
09:49
< kaura>
So self.deck_file
09:49
<@Vornicus>
Is how you talk about it within the Deck class; how do we get that from outside?
09:49
< kaura>
deck.deck_file, I think
09:49
<@Vornicus>
(on a variable named deck. Actually, really, we should rename deck to my_deck so it's easier to tell apart)
09:50
<@Vornicus>
Yay!
09:50
<@Vornicus>
So how do we load up a fresh deck based on that filename?
09:51
< kaura>
def user_refresh(x): return deck.deck_file + " loaded", right?
09:52
< kaura>
Whups, not quite right.
09:53
<@Vornicus>
That's the return, but you need to do something else first.
09:53
< kaura>
Right.
09:54
<@Vornicus>
Where else do we load up a fresh deck?
09:55
< kaura>
user_load)
09:55
< kaura>
er, user_load()
09:56
<@Vornicus>
okay, so how did we do it there.
09:57
< kaura>
deck = Deck(deck_file), actually (and, yeah, should've used an alt to Deck a few times back)
09:59
<@Vornicus>
Okay, so knowing that the filename is in deck.deck_file, how do we change that.
09:59
< kaura>
Ahh.. so, for refresh, we instead write up "deck = Deck(deck.deck_file)"
09:59
<@Vornicus>
Yep.
09:59
<@Vornicus>
And there's refresh written. Yay!
10:00
< kaura>
Man, I think I nearly caved my desk in from all the headbanging. I wasn't quite on the ball with that one.
10:00
<@Vornicus>
And that is more than enough for tonight, this has been ridiculous.
10:01
< kaura>
Sorry about that.
10:01
<@Vornicus>
(but if you want, call all of the instances of "deck" outside the class "my_deck", and all the instances /inside/ the class "cards")
10:01
< kaura>
Yes, that'd be a better idea.
10:04
<@Vornicus>
(outside the class we are talking about a Deck object; within we're talking about a list of, well, cards.)
10:05
<@Vornicus>
(technically they could also be tiles, or dominos, or other things like that -- but cards are the most obvious.)
10:06
< kaura>
Right. The categorization's mostly for our sake, so we don't wonder what the heck a, b, c, d, e and f are later.
10:06
< kaura>
And how they relate with each other.
10:06
<@Vornicus>
Source code's for humans.
10:07
<@Vornicus>
(also, all this talk of deck has me reminded of a Magic game I played a couple months back.)
10:08
<@Vornicus>
(his black graveyard manipulation vs my blue mill/control. I won. At one point I shouted "MORE MILL THAN YOUR BODY HAS ROOM FOR")
10:08
<@Vornicus>
(I did not, however, actually deck him. He lost with three cards left in his library.)
10:08
< kaura>
pfft
10:08
< kaura>
That's an inherently hard matchup for mill, though. I'm surprised.
10:09
<@Vornicus>
Well, it ran out, every turn he'd drop two cards straight from library to graveyard, and then only draw one, which means that he didn't have control over what went into the graveyard.
10:10
< kaura>
Yeowch.
10:10
<@Vornicus>
Which means that 2/3 of his graveyard manipulation cards were going in there and he couldn't really get them back out.
10:12
< kaura>
Haha, that's one way to beat graveyard recursion~
10:12 You're now known as TheWatcher
10:14
<@McMartin>
Heeeeey, TW
10:19 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection closed]
10:20
<@Vornicus>
right, bedtime.
10:21
< kaura>
Night, Vorn.
10:22 Vornicus is now known as Vornicus-Latens
10:25 Zed [Zed@Nightstar-556ea8b5.or.comcast.net] has quit [Client closed the connection]
10:42 * TheWatcher actually looks at IRC now, wave vaguely
10:52 kw-sleep-n [kwsn@31356A.5FD175.2259B6.DFACD4] has quit [Ping timeout: 121 seconds]
10:57 kw-sleep-n [kwsn@31356A.5FD175.2259B6.DFACD4] has joined #code
13:29 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
15:18
< gnolam>
Huh. DjVu is pretty neat,.
15:50 kw-sleep-n [kwsn@31356A.5FD175.2259B6.DFACD4] has quit [Ping timeout: 121 seconds]
15:55 kw-sleep-n [kwsn@31356A.5FD175.2259B6.DFACD4] has joined #code
17:06 aoanla [AndChat@Nightstar-a50a53fd.range217-42.btcentralplus.com] has joined #code
17:16 kw-sleep-n is now known as kwsn
17:56 kwsn is now known as kwsn\packers
18:01 Anno[Laptop] is now known as Dusk
18:44 RichardBarrell [mycatverbs@Nightstar-689c9c54.cable.virginmedia.com] has joined #code
18:44
< RichardBarrell>
I'm feeling really stupid now. How do people represent angles in three dimensions?
18:44
<@Derakon>
Theta and phi.
18:45
< RichardBarrell>
I understand that Euler angles (yaw, pitch) apparently cause issues due to something called the "hairy ball theorem".
18:45
<@Derakon>
Oh, you want quaternions then.
18:47
< RichardBarrell>
I'm almost certain that someone once drilled how quaternions work into my head, but all I can remember right now are matrices representing affine transforms.
18:50
<@Derakon>
I never bothered to learn how to use 'em, sorry.
18:50
<@Derakon>
I just know they're the solution for this problem.
18:52
< RichardBarrell>
BRB exhausting the remainder of my natural lifespan delving wikipedia.
18:52
< RichardBarrell>
Tell my family that I loved them.
18:53
< gnolam>
The hairy ball theorem is related to gimbal lock?
18:54
< gnolam>
Anyway. Whether or not you need quaternions or vector/angle instead of plain Euler angles depends on the application.
18:54
< RichardBarrell>
I don't know. I'd heard the name (and it's an amusing mental image). I believe so.
18:55
< RichardBarrell>
Gimbal lock is when you put pitch to one of its extremities and varying yaw suddenly has no effect, right?
18:56
< RichardBarrell>
(in a "tank turret" example, since that's the easiest to visualise)
18:56
<@Vornicus-Latens>
Yep.
18:58
< gnolam>
In short, it's the loss of one degree of freedom. Which is why switching to a 4D representation fixes it.
18:58
<@Vornicus-Latens>
I've never actually figured out quats, personally - I use vector/angle when I want to turn stuff. It makes for some hairy vectors but at least I understand them.
18:59
<@Vornicus-Latens>
hairy matrices, rather.
19:38 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has quit [Connection closed]
19:54
<@Vornicus-Latens>
Oh. that's why Minecraft feels like Infiniminer. Minecraft's dev saw Infiniminer and said "I can do this better"
19:55
<@Vornicus-Latens>
And then /did/
19:55
< aoanla>
Yeah, apparently.
19:56
< aoanla>
Not that I got around to actually playing it, of course.~
19:57
<@Vornicus-Latens>
Nor I, but at least it makes sense now.
19:57
< aoanla>
Right. It also remined me of Wurm Online.
19:58
< aoanla>
Turns out that Notch's previous game was... Wurm Online.
19:58
< aoanla>
Small world, indie development, apparently.
19:59
<@Vornicus-Latens>
Heh
20:00 Vornicus-Latens is now known as Vornicus
20:00 * Vornicus is here, by the way.
20:49 aoanla [AndChat@Nightstar-a50a53fd.range217-42.btcentralplus.com] has quit [[NS] Quit: ]
21:02 Vornicus is now known as Finerty
21:06 kwsn\packers is now known as kwsn
21:39 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
21:40 celticminstrel [celticminst@Nightstar-f8b608eb.cable.rogers.com] has joined #code
22:05 Kazriko [kaz@Nightstar-e09690fa.client.bresnan.net] has quit [Connection closed]
22:08 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
22:14 Dusk is now known as AnnoDomini
22:16 Kazriko [kaz@Nightstar-e09690fa.client.bresnan.net] has joined #code
22:16 mode/#code [+o Kazriko] by Reiver
22:23 kwsn [kwsn@31356A.5FD175.2259B6.DFACD4] has quit [[NS] Quit: ]
22:54
< celticminstrel>
I have a rather odd problem. Some websites are showing up in italics for no clear reason. :/
22:57 kwsn [kwsn@31356A.5FD175.2259B6.DFACD4] has joined #code
23:16 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
23:28!Deepthought.NY.US.Nightstar.Net *** Finerty invited KarmaBot into the channel
23:28 KarmaBot [karma.bot@Nightstar-c8453cc1.80-203-16.nextgentel.com] has joined #code
23:31 kwsn [kwsn@31356A.5FD175.2259B6.DFACD4] has quit [Ping timeout: 121 seconds]
23:31
<@Finerty>
doh, wrong channel.
23:37 kwsn [kwsn@31356A.5FD175.2259B6.DFACD4] has joined #code
23:48 You're now known as TheWatcher[T-2]
23:51 You're now known as TheWatcher[zZzZ]
--- Log closed Mon Oct 04 00:00:03 2010
code logs -> 2010 -> Sun, 03 Oct 2010< code.20101002.log - code.20101004.log >