code logs -> 2010 -> Tue, 28 Sep 2010< code.20100927.log - code.20100929.log >
--- Log opened Tue Sep 28 00:00:17 2010
--- Day changed Tue Sep 28 2010
00:00
<@jerith>
I'm sure you can get one. There isn't one built in, as far as I'm aware.
00:00
<@ToxicFrog>
Yeah, I was wondering if there's one built in.
00:00
<@ToxicFrog>
Ditto for sshfs?
00:01 kwsn [kwsn@Nightstar-a0abd809.dyn.centurytel.net] has joined #code
00:01
<@jerith>
Yeah. Although it has NFS by default.
00:03
<@ToxicFrog>
Yeah, that won't cut it with SHARCNet
00:04 kwsn [kwsn@Nightstar-a0abd809.dyn.centurytel.net] has quit [Client closed the connection]
00:05 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has quit [Ping timeout: 121 seconds]
00:05 kwsn [kwsn@Nightstar-a0abd809.dyn.centurytel.net] has joined #code
00:13 Anno[Laptop] [annodomini@Nightstar-f5d6e71d.adsl.tpnet.pl] has quit [[NS] Quit: leaving]
00:37 TarinakyMob [Tarinaky@37647E.0002A6.410380.573FBB] has joined #code
00:37
< TarinakyMob>
My router's PPP test is failing - any idea what that means?
00:38
< TarinakyMob>
I'd google but the internet is down.
00:38
< Vornicus>
DSL?
00:38
< TarinakyMob>
ADSL
00:39
< Vornicus>
Same thing. So, DSL uses something called PPPoE to communicate with the upstream routers. If it's not succeeding at that, there's something wrong somewhere between those two endpoints. Might be anything from a backhoe issue to your modem screwing up to their routers screwing up.
00:40
< celticminstrel>
I wish the Finder's ftp client could write as well as read. <_<
00:40
< TarinakyMob>
The line test passes.
00:43
<@ToxicFrog>
celticminstrel: who still uses FTP? o.O
00:44 * TarinakyMob tries to remember how to do wireless in Linux.
00:45
< celticminstrel>
Some people. I dunno.
00:46
< TarinakyMob>
I don't think I'm getting any signals apart from my own router. Lame.
00:47
<@ToxicFrog>
TarinakyMob: "do wireless" in what sense?
00:47
<@ToxicFrog>
Generally, it just works and is accessible from the little network icon in the systray.
00:47
<@ToxicFrog>
If you want, say, all the gory details of every network in range, try "iwlist scan".
00:47
< TarinakyMob>
Find unsecured network, steal bandwidth so I can finish my forum post and not have to chat on a mobile phone.
00:48
< TarinakyMob>
Iwlist scan needed me to remember how to bring the interface up though.
00:48
<@ToxicFrog>
ifconfig <interface> up
00:48
< TarinakyMob>
Thought so.
00:49
<@ToxicFrog>
make sure the wireless switch on your machine is enabled if it has one, too.
00:49
< TarinakyMob>
Wirel ess switch?
00:50
< TarinakyMob>
Is that a laptop thing?
00:50
<@ToxicFrog>
Most laptops have a hardware or firmware switch that lets you disable the wireless card independently of the OS.
00:50
<@ToxicFrog>
If it's a desktop wireless card this is a nonissue.
00:51
< TarinakyMob>
I'll be pissed off if this is down all night.
00:51
<@ToxicFrog>
Call your isp and tell them about it? Who're you on?
00:53
< TarinakyMob>
Plus net. I don't know what the number is or their hours.
00:53
< TarinakyMob>
I'd google but...
00:55
< Vornicus>
0845 140 0080 for their "broadband and telephone faults", if I'm getting the right place from Google.
00:56
< Vornicus>
Which is apparently manned 24/7.
00:57
< Vornicus>
Looks it, from your whowas results.
00:58
< TarinakyMob>
Cool. A telephone fault line sounds silly.
00:59 RichardB_ [mycatverbs@Nightstar-3b2c2db2.bethere.co.uk] has joined #code
00:59
< TarinakyMob>
I'm on hold :/
00:59
< TarinakyMob>
Yay power ballards.
01:00
< Vornicus>
Not spectacularly surprising, but it's better by some measure than "I have no idea who to call"
01:00 RichardBarrell [mycatverbs@Nightstar-3b2c2db2.bethere.co.uk] has quit [Ping timeout: 121 seconds]
01:00
< Orthia>
Think yourself lucky
01:00
< TarinakyMob>
True.
01:00
< Orthia>
Half the ones here loop their ads
01:01
< TarinakyMob>
Haha
01:01
< Orthia>
This is bad enough.
01:01
< Orthia>
When their total advertisement speils last approximately ninety seconds, and they have them on infinite loop?
01:02
< Orthia>
atrocious
01:02
< TarinakyMob>
Owww.
01:04 kwsn is now known as kwsn\packers
01:04
< Vornicus>
Orthia: I have you beat. When the ad spiels last /fifteen/ seconds.
01:04
< Orthia>
Vorn: Yowza.
01:06 TarinakyMob [Tarinaky@37647E.0002A6.410380.573FBB] has quit [Ping timeout: 121 seconds]
01:07
< Vornicus>
On the other hand one time I got one that played the actual, non-muzak'd Girl From Ipanema.
01:08 TarinakyMob [Tarinaky@37647E.0002A6.6691A5.72184E] has joined #code
01:09
< TarinakyMob>
I got through. They wated me to take the panel off the phone socket and all sort.
01:09
< TarinakyMob>
Will have to wait until morning or my dad will be po with me.
01:22 TarinakyMob [Tarinaky@37647E.0002A6.6691A5.72184E] has quit [Ping timeout: 121 seconds]
01:25 Derakon[AFK] is now known as Derakon
02:24 RichardB_ [mycatverbs@Nightstar-3b2c2db2.bethere.co.uk] has quit [Ping timeout: 121 seconds]
02:29 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: KABOOM! It seems that I have exploded. Please wait while I reinstall the universe.]
02:46 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
02:54 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?]
04:03 Stalker [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Ping timeout: 121 seconds]
04:16 * Orthia realises he is creating the Mother Of Pathfinding Nightmares.
04:17 * Vornicus gives Orthia A* and No-Doz.
04:18
< Orthia>
Worse
04:18 * Vornicus then pokes vaguely at Kaura.
04:18
< Orthia>
In fact I am going to have to run it through my head three times to be able to explain it so I can go ask a lecturer if there is even a solution.
04:18
< Orthia>
Because what the hell.
04:26
< Vornicus>
Unless you're doing something absolutely batshit, there's probably things you can do. What are you up to?
04:27
< Orthia>
http://pastebin.starforge.co.uk/381
04:27
< Orthia>
Step 1: Trying to explain what is needed. >_<
04:27 TarinakyWeb [50e51fec@Nightstar-992d69e3.mibbit.com] has joined #code
04:27
< TarinakyWeb>
Yay! Connection stuff sorted itself out while I was playing GSB.
04:28
< Orthia>
Vorn: Does that make even the slightest bit of sense?
04:28
< Orthia>
I realise there will be a lot of variables - variables I am fine with, they are something you tweak.
04:30
< Vornicus>
You're doing... profit maximization?
04:31
< Orthia>
I think so, via pathfinding yeah.
04:33 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
04:33 kaura [kaura@Nightstar-fd82400d.snfc21.sbcglobal.net] has quit [[NS] Quit: HydraIRC -> http://www.hydrairc.com <- Organize your IRC]
04:37
< Vornicus>
Do you have roads in this, or not?
04:39
< Vornicus>
...which is to say -- is there a reason why I would not be able to build the complete graph and have it work.
04:41
< Vornicus>
Anyway, just having "supply" and "demand" doesn't work all that well: you need to model sources and sinks.
04:48 kwsn\packers is now known as kwsn\burn_refs
04:51
< Vornicus>
You're going to end up explicitly modeling things until you have gotten enough going that simulating it with simpler algorithms actually works.
04:57
< Vornicus>
(because without that, you don't really get a sense of how it's supposed to actually feel.)
05:12 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!]
05:18
< Orthia>
hn
05:19
< Orthia>
[Sorry, had a brief BRB that turned int oa rather larger one]
05:19
< Orthia>
No roads, though there are probably distance limits - regardless of profit, paths will be limited in range.
05:20
< Orthia>
So... infinite blank concrete, but you need to stop at towns to grab gas~
05:27
< Orthia>
Vornicus: Anyway, I presume by graph you mean 'every point connected to every other point' ?
05:27
< Vornicus>
By "complete graph", yes
05:27 * Orthia thinks.
05:28
< Orthia>
Is it a major hurdle to be limited to a certain range?
05:31
< Vornicus>
It's a hurdle. But not as much of one as "heavily-trafficked routes get cheaper"
05:34
< Orthia>
Yeah, that's going to be the challenge
05:34
< Orthia>
Basically I want this thing to be a self-forming network.
05:34
< Orthia>
Much like roads do, in the grand timescale of things - a road gets built, then the current road gets extended from because it was already there
05:35
< Orthia>
Then eventually people decide a direct route is valuable and that crops up too, if it's ever needed.
05:37
< Vornicus>
Hm...
05:44
< Orthia>
Just /how much/ is weighted on this depends heavily on the variables, of course
05:50
< Vornicus>
Right. You're building a heavily chaotic system.
05:50
< Vornicus>
Without some sense of how that system "feels", you won't be able to get it right.
05:50
< Orthia>
Yeah, this is fair enough.
05:50
< Orthia>
So!
05:51
< Orthia>
What should I be doing to get this system of chaos workin'?
05:52
< Vornicus>
1. sources and sinks. Consider how your various things are produced. Do they need other things to be produced?
05:52
< Orthia>
hmm.
05:52
< Orthia>
Are you suggesting my first step is to craft a node model?
05:52
< Vornicus>
Something like that.
05:52
< Orthia>
Then I guess I should start calling nodes planets.
05:53
< Orthia>
Or systems, but that's just a matter of scale.
05:54
< Vornicus>
Right.
05:54
< Orthia>
OK.
05:54
< Orthia>
Basic economic models 101 then!
05:55
< Orthia>
I guess we will call it all... hm. Resources, utilisations, and constructions.
05:56
< Orthia>
You can have a world full of tasty green plains. This means it has a high Food resource. Utilise it, and you get to *have* food. Food lets you build Population [minor caveat on that one but what the hell it's a start].
05:57
< Orthia>
Minerals are mined into industry. Probably various kinds of mineral; there's a distinction between steelworks for shipbuilding and silicone/lithium for electronics and cellphones afterall, even if you don't want to go any deeper than that.
06:07 * Orthia thinks. So, then: Resources[], ResourceMines[], Industries[]... hm, what am I missing
06:10
< Orthia>
Possibly some idea of Wealth. And I should be careful of the assumption that every industry will be linked to a specific resource - tourism, commerce and the like, afterall, tend to be derivative of other stuff.
06:12 kaura [kaura@Nightstar-fd82400d.snfc21.sbcglobal.net] has joined #code
06:12 * Vornicus gives Kaura a cheese.
06:13
< kaura>
nom
06:14 * Orthia tries to think.
06:15
< Orthia>
Am I overcomplicating this initial stage?
06:15
< Orthia>
What we really want is "Has spare ore" and "Eats spare ore", right?
06:15 kwsn\burn_refs is now known as kwsn
06:15
< Vornicus>
Makes ore, eats ore.
06:16
< Vornicus>
That's all you need. However: in the real world, consumers have limits -- I can't eat five cheeseburgers!
06:16
< kaura>
Unless they were White Castle miniburgers. Those are pretty small, iirc.
06:16
<@Derakon>
Not all at once, anyway.
06:16
< Vornicus>
Yeah, I could chew through those pretty quickly.
06:16 cpux is now known as shade_of_cpux
06:17
< Orthia>
Also in the real world, production is going to be something that gets ramped up when people think there is a demand, and will continue ramping up until it hits the local capacity, or demand plateaus
06:17
< Orthia>
(and with a clever spot of lag-inducing into the production, you can even have boom/bust cycles)
06:19
< Vornicus>
oh, Orthia
06:19
< Vornicus>
Look into Railroad Tycoon 3
06:20
< Orthia>
?
06:20
< Vornicus>
It does this sort of economic modeling.
06:23
<@ToxicFrog>
Doesn't openTTD as well, and has the advantage of being open source
06:23
<@ToxicFrog>
?
06:23
< Vornicus>
OpenTTD does not.
06:24
< Vornicus>
OpenTTD randomizes production and price curves. Railroad Tycoon 3 actually simulates non-railroad agents moving goods to figure pricing.
06:26
< Orthia>
funky.
06:31
< Orthia>
OK, so
06:31
< Vornicus>
Kaura: ready to improve on the Deckmangler?
06:34
< kaura>
Yep.
06:34
< kaura>
Alright, what was up next?
06:35
< Vornicus>
Well, we've got quite a few different places we can make improvements, but the one I want to think about first is the interface to drawing cards.
06:35
< Vornicus>
As you've probably noticed by now, you have to say "draw 1" to draw a single card.
06:36
< kaura>
Right.
06:37
< Vornicus>
I want to be able to say just "draw" and draw a card.
06:38
< kaura>
So have "draw" have a default value of 1?
06:39
< Vornicus>
Yeah. So the way we're going to do this is we're first going to make the draw function have a default "x" value of 1: say "x = 1" instead of just "x" in the function signature.
06:40
< Vornicus>
This means that if we call draw with just one parameter, it will set the second parameter to 1 because that's the default value.
06:41
< kaura>
Hm. So an if statement saying that if there's no input, just set x at 1?
06:42
< Vornicus>
Not in draw. In draw, we just put that thing there in the function signature, just like I described.
06:44
< kaura>
so "draw(deck, x = 1)?"
06:44
< Vornicus>
Yep.
06:44
< kaura>
Right.
06:44
< Vornicus>
That's all we need to do there. Now let's go over to user_draw; there's quite a few things we need to do here.
06:46
< Vornicus>
First off, we need to check our parameter for an empty string; if there is one, then we call draw(deck) and return that.
06:47
< Vornicus>
--er, actually, that feels wrong especially considering what else we have to do in there.
06:48
< Vornicus>
Instead of that: check our parameter for an empty string; if it's empty, set the card-draw count (I'd call it count; you overwrote x) to 1; otherwise set it to str(x) as you already have.
06:51
< Vornicus>
Do you see what I'm saying?
06:51
< kaura>
Lesse... like this? http://pastebin.starforge.co.uk/382
06:52
< kaura>
Ooh, wait, missing a line, I think.
06:53
< Vornicus>
not quite -- the x = int(x) actually is in the else, and the draw is after it.
06:53
< Vornicus>
Also, use ==
06:53 Derakon is now known as Derakon[AFK]
06:54
< kaura>
Right, error messages aplenty out of that one...
06:55
< Vornicus>
(after it as in, after everything.)
06:55 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
06:56
< Orthia>
Vorn: I'm halfway surprised you're not using polymorphism.
06:56
< kaura>
polyhuh
06:57
< Orthia>
Kaura: It's fun
06:57
< Vornicus>
Orthia: I don't see a use for it here.
06:57
< Orthia>
Vorn: To slip into Javaese
06:57
< Orthia>
Draw() vs Draw(int n)
06:57
< kaura>
Vorn: Actually, I think I caught an earlier error. When you had me set x = 1 on the function signature, it wasn't playing quite nicely with the appended code to user_draw(x). When I removed it, "draw" and "draw #" both worked.
06:57
< Vornicus>
kaura: show me?
06:58
< Vornicus>
Orthia: we did add that to draw; however, we won't be using it because there's something else that we want to do here. ...though now that I think about it I suspect handling that something else in draw, sort of, is a better idea.
06:58
< Orthia>
That was my thinking, yes.
07:00
< kaura>
http://pastebin.starforge.co.uk/383
07:01
< Vornicus>
I don't see how it interfered, but okay. Anyway.
07:02
< Vornicus>
Now: what happens if we try to draw more cards than are in the deck?
07:02
< kaura>
Gives a blank line.
07:02
< Vornicus>
THat's actually kind of surprising!
07:02
< kaura>
O_o
07:03 * Vornicus expected it to give you an exception.
07:03
< kaura>
...weird, it did for draw 61, but not for draw 100
07:04
< kaura>
Correction: it didn't if you tried to draw more cards than there are in the deck, prior to actually drawing cards from the deck. Let's see if that still holds true for 61 in the initial condition...
07:04
< kaura>
...
07:04
< kaura>
Now it's giving me error messages as expected.
07:04 * kaura eyes his computer
07:05
< Vornicus>
Weird.
07:05
< kaura>
O_o Alright, this is weird. Can't make it spit out that blank line anymore.
07:05
< Vornicus>
Well, now it's working like it should.
07:05
< kaura>
Right.
07:05
< Vornicus>
You'll notice a couple of things: the error message is "Can't pop from empty list" or something like that.
07:06
< kaura>
Right.
07:06
< Vornicus>
This means that accidentally drawing more cards than you have 1. doesn't show you the cards you drew, and 2. /murders the entire deck anyway/
07:07
< Vornicus>
This is not cool; so what we're going to do is check for this condition before actually drawing any cards, and raise our own error when that happens.
07:08
< kaura>
So elif x > 60: return "error message" right?
07:08
< Vornicus>
This happens in draw; in user_draw we're going to catch the error.
07:08
< Vornicus>
There aren't always 60 cards in the deck.
07:08
< kaura>
...ooh, wait, not q- yeah, just realized that.
07:08
< Vornicus>
And we don't use return.
07:10
< Vornicus>
so, in the line before the return, compare x to the number of cards currently in deck.
07:12
< Vornicus>
then, if x is bigger than the number of cards, do this: raise ValueError, "Can't draw more cards than are in the deck!"
07:12
< kaura>
...is it just a matter of assigning "x > deck?"
07:13
< Vornicus>
No, use if
07:13
< kaura>
Well, elif x > deck:
07:13
< Vornicus>
where the hell are you putting that
07:13
< kaura>
Would it automatically compare the deck quantity, or is more work to be done?
07:13
< kaura>
user_draw, right?
07:13
< Vornicus>
no, this is in draw
07:13
< kaura>
Ahh.
07:13
< Vornicus>
user_draw will catch the error.
07:17
< kaura>
Hrn. Still not quite right...
07:18
< Vornicus>
Show me what you tried
07:18
< kaura>
Oh, right. I think I got it. Forgot to append an else: condition. As it is, even after raising the Value Error, it'll try to run the return... I think.
07:19
< kaura>
...nno.
07:19
< Vornicus>
Nope. Raising skips absolutely /everything/ until there's a try/except around it.
07:21
< kaura>
http://pastebin.starforge.co.uk/384
07:21
< Vornicus>
deck, unfortunately, won't tell you its size unless you ask for it specifically.
07:22
< kaura>
Right, I thought I was missing that. ...hn...
07:22 You're now known as TheWatcher
07:23
< kaura>
'lo TW
07:26
< Vornicus>
So how do you get the number of things in something?
07:26
< Vornicus>
(I think we've used this but I don't actually remember where!)
07:26
< kaura>
The... length, I think. So len(deck)?
07:27
< Vornicus>
Yep.
07:28
< kaura>
Success!
07:28
< Vornicus>
Woot
07:28
< Vornicus>
Now, back over to user_draw
07:33
< Vornicus>
Having raised an exception, we must now catch it. We've done this before somewhere else.
07:34
< kaura>
Was down at command(), for len(split_cmnd) == 0: return "No command given" right?
07:34
< Vornicus>
Nope.
07:34
< kaura>
...hrn.
07:35
< Vornicus>
Read up a bit; I mentioned the thing that you need.
07:35
< kaura>
Oh, try/except
07:36
< Vornicus>
Right. We've used this once before, but we're going to be a little fancier about it now.
07:39
< Vornicus>
Wrap... well, all right, pretty much the entire contents of user_draw in a try: block, and then you need an "except Exception as e:" after it. THis says we want all kinds of errors to get caught, and we want the error to be named e when we've got one.
07:40
< kaura>
"except Exception as e:"? So it it's "except" followed by defining "Exception" as variable "e"?
07:41
< Vornicus>
It's actually saying "this except block handles all exceptions of type Exception (or any of its subtypes; all the exceptions you want to deal with are of a subtype of Exception)
07:41
< Vornicus>
and will call any exception it receives "e'
07:42
< kaura>
Ah.
07:47 TarinakyWeb [50e51fec@Nightstar-992d69e3.mibbit.com] has quit [[NS] Quit: http://www.mibbit.com ajax IRC Client]
07:47
< Vornicus>
And once we're in the except there, just return str(e)
07:51
< kaura>
Alright. ...so what exactly is str(e) and how does it interact with the earlier ValueError?
07:51
< kaura>
Oh, it just prints out the string after the exception that's triggered.
07:51
< kaura>
Oooh.
07:51
< Vornicus>
str(e) is a stringification of the error's parameters.
07:52
< kaura>
Ah, I see it now.
07:53
< Vornicus>
Anyway by wrapping the entire contents of the function in that try block, we also neatly take care of a somewhat different problem.
07:54
< Vornicus>
See, there's one other thing in user_draw that can reasonably be expected to spew an error.
07:55
< kaura>
A negative draw? >_>
07:55
< Vornicus>
Actually that just won't do anything.
07:55 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has joined #code
07:55
< kaura>
Oh, you're right.
07:56
< kaura>
Oh, a non-integer draw.
07:56
< Vornicus>
Yep.
07:58
< kaura>
Yep, that spits out an exception properly now.
07:58
< Vornicus>
It's kinda of a hairy, horrible exception, but let's leave that for now.
07:58
< Vornicus>
What does it actually say when you draw 7 cards from a fresh deck?
07:59
< kaura>
['Ichorclaw Myr', 'Plague Stinger', 'Swamp', 'Plague Stinger', 'Drowned Catacombs', 'Swamp', 'Island']
07:59
< Vornicus>
Kinda a pain to read, isn't it.
07:59
< kaura>
Yeah. Should probably list each string as a separate line, huh?
08:00
< Vornicus>
Which is exactly what we're about to do.
08:00
< kaura>
Yay~
08:00
< kaura>
But gimme a sec. Need a quick break and more ice water.
08:00
< Vornicus>
We want to do this in user_draw; note that there, we can't use print: we have to figure out how to glom together a string with a bunch of line breaks in it, instead.
08:00
< Vornicus>
ok
08:04 kwsn [kwsn@Nightstar-a0abd809.dyn.centurytel.net] has quit [Ping timeout: 121 seconds]
08:09 You're now known as TheWatcher[afk]
08:25
< kaura>
Right, back.
08:26
< kaura>
The opposite of line.strip then? A command to insert a line break after every string?
08:26
< kaura>
er, every entry
08:26
< Vornicus>
Yep.
08:27
< Vornicus>
Meet string's "join" method.
08:28
< Vornicus>
my_str.join(list) will make a string where each element in list is joined together by my_str: "-".join(['a','b','c']) gives "a-b-c"
08:28
< Vornicus>
In this case, however, we want to use "\n" instead of "-" -- \n is the line break thingy.
08:28
< kaura>
Right.
08:29
< Vornicus>
And since draw() produces a list...
08:31 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection closed]
08:32
< kaura>
...hm... not doing this right...
08:33
< Vornicus>
So, draw produces a list.
08:33
< Vornicus>
We want to get in between producing that list and returning something.
08:33
< kaura>
Ah. So delete "return" from draw(deck, x), and have the return line instead spit out that plus the appended breaks.
08:34
< Vornicus>
yeah. you can actually just wrap the draw in the join.
08:35
< kaura>
Well, it's working. There's only the small problem now that it returns a blank line when I first try a command, but works normally thereafter. O_o
08:36
< Vornicus>
...what the fuck
08:36
< Vornicus>
show me your code
08:36
< kaura>
http://pastebin.starforge.co.uk/385
08:37
< kaura>
Reseting IDLE fixes it. I suspect it's nothing wrong with the code itself.
08:37 * kaura eyes his computer again
08:37
< Vornicus>
Yeah, I'm gonna say it's IDLE being odd.
08:37
< kaura>
...a nicely playable hand, that sample...
08:42 * Vornicus examines draw. Was there anything else he wanted to do with it...
08:42
< Vornicus>
actually I don't think so!
08:43
< Vornicus>
Oh. I did have a question: is there any situation where a player can be asked to draw more cards than he has, and it doesn't kill him.
08:44
< kaura>
Yes, Platinum Angel. Controlling player cannot lose the game. Including via deck out, poison counters, loss of life, or cards that otherwise say that the opponent wins the game or player loses it.
08:44
< Vornicus>
Okay. So we're going to need a "soft" draw.
08:45
< Vornicus>
Copy user_draw wholesale into a function called user_soft_draw
08:45
< kaura>
k
08:46
< Vornicus>
And then draw wholesale into a function called soft_draw
08:46
< Vornicus>
and change user_soft_draw to call soft_draw instead of draw.
08:47
< kaura>
Right.
08:48
< Vornicus>
Okay, now we're going to make exactly one change: in that if statement, instead of raising, set x to len(deck)
08:50
< Vornicus>
And once that's done, add user_soft_draw to our command dispatch, but I don't know what to call it. You only get one word though.
08:51
< kaura>
Hrn, So, wait. user_soft_draw(x): try: if: x == "": x = len(deck)?
08:52
< Vornicus>
No, no.
08:52
< Vornicus>
Do the change in soft_draw, not user_soft_draw
08:52
< kaura>
Oh, whups
08:54
< kaura>
so soft_draw(deck, x): if x == len(deck):
08:54
< kaura>
Shouldn't it be >=?
08:55
< Vornicus>
>
08:56
< Vornicus>
(and the change is inside the block - we're replacing the raise.)
09:01
< Vornicus>
Did you die?
09:01
< kaura>
Not quite, but a few distractions came up. Lesse...
09:03
< kaura>
Wait. How is x > len(deck): in soft_draw different from the if line in draw? The code looks identical so far - or is it supposed to, and we're only now about to change it?
09:03
< Vornicus>
That if line isn't supposed to change.
09:03
< kaura>
Ah.
09:04
< Vornicus>
What we're changing is what happens when it /is/ over: specifically, instead of complaining, it should just give you all the cards that are left.
09:04
< Vornicus>
We're going to do this by changing x from what it was, to len(deck)
09:04
< kaura>
Ooh, so if x > len(deck): x == len(deck)
09:04
< Vornicus>
Not ==
09:05
< Vornicus>
(that's comparison)
09:05
< kaura>
Ah.
09:05
< kaura>
Right, just once to assign.
09:05
< Vornicus>
Right.
09:05
< Vornicus>
And now that that's done we can go add it to the dispatch dict; idunno what to call it though. "softdraw" might be the best name.
09:06
< kaura>
Had it as "pull."
09:06
< Vornicus>
Works too.
09:08
< Vornicus>
And that, I think, is enough for tonight.
09:08
< kaura>
Alright. Sorry for the delays, and thank you again for your guidance.
09:09 * kaura eyes QC
09:09
< kaura>
Aw, Hanners is cute.
09:10
< Vornicus>
<3 Hanners
09:10 Vornicus is now known as Vornicus-Latens
09:18 Anno[Laptop] [annodomini@Nightstar-912353ec.adsl.tpnet.pl] has joined #code
09:54 You're now known as TheWatcher
10:02 Anno[Laptop] [annodomini@Nightstar-912353ec.adsl.tpnet.pl] has quit [[NS] Quit: Uniwards.]
11:08 Anno[Laptop] [annodomini@F67919.F326B3.98D923.BDA7B6] has joined #code
11:59 * Anno[Laptop] grapples with Java.
12:00
< Anno[Laptop]>
This error just came out of nowhere: non-static variable this cannot be referenced from a static context.
12:01
< Anno[Laptop]>
http://pastie.org/1186242
12:01
< Anno[Laptop]>
The error shows up on "MagFrame frame = new MagFrame();".
12:02
< Anno[Laptop]>
The error appeared when I wrote the last three lines, but won't disappear after they're commented out.
12:02
< Anno[Laptop]>
Help?
12:04 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
12:06
< Anno[Laptop]>
I have no idea what to do.
12:06
< Anno[Laptop]>
celticminstrel: You any good with Java?
12:12
<@TheWatcher>
Is MagFrame in a different .java file, or in the same one as your Main class?
12:12
< Anno[Laptop]>
Same as Main.
12:13
<@TheWatcher>
Put it in a different file
12:13
< celticminstrel>
Sort of.
12:13
<@TheWatcher>
Java gets funny about having more than one class in a file sometimes
12:13 gnolaptop [wintermute@Nightstar-e88b6e38.eduroam.liu.se] has joined #code
12:14
< gnolaptop>
Oh joy. Internet outage.
12:15
< gnolaptop>
Which means that I can either work or check documentation. Not both.
12:16
< Anno[Laptop]>
Now it's reaching the end of file while parsing.
12:17
< Anno[Laptop]>
TheWatcher: It's the same code as before, but I put MagFrame in its own file.
12:18
< Anno[Laptop]>
The last curly bracket in the Main file gets underline and flagged as an error.
12:18
<@TheWatcher>
Add another - you need one to close your main() method, and one to close the class
12:18 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!]
12:20
< Anno[Laptop]>
Huh. I have no idea where one of them has gone.
12:20
< Anno[Laptop]>
Thank you.
12:24 Rhamphoryncus [rhamph@Nightstar-473f8685.abhsia.telus.net] has quit [Client exited]
12:25
< gnolaptop>
Anno: stolen by brace gnomes.
12:26 kaura is now known as Kaura|zzz
12:27
< Anno[Laptop]>
Damn gnomes. This is why they were exiled to the Monster Manual in 4e.
12:27 * Anno[Laptop] finds that he has completely forgotten how to handle button events in Java.
12:28
< Anno[Laptop]>
Well, actually, I do remember that the way I was taught to do it was with a three-fold nested construct of new objects and stuff. Very arcane.
12:33
< Anno[Laptop]>
There we go. I found some old code.
12:47 Anno[Laptop] [annodomini@F67919.F326B3.98D923.BDA7B6] has quit [[NS] Quit: Enough work for the day.]
13:02 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
13:27 Anno[Laptop] [annodomini@Nightstar-912353ec.adsl.tpnet.pl] has joined #code
14:01 kwsn [kwsn@Nightstar-a0abd809.dyn.centurytel.net] has joined #code
14:05 kwsn [kwsn@Nightstar-a0abd809.dyn.centurytel.net] has quit [Ping timeout: 121 seconds]
14:38 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Client closed the connection]
14:38 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
14:44 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has quit [Connection closed]
14:54 You're now known as TheWatcher[afk]
15:44 gnolaptop [wintermute@Nightstar-e88b6e38.eduroam.liu.se] has quit [[NS] Quit: Z?]
16:07 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
16:20 PinkFreud is now known as Perl
16:21 Perl is now known as PinkFreud
17:02 Anno[Laptop] is now known as EbonDragon
17:41
<@ToxicFrog>
Hmm. I can't remember if Java's GUI libraries are of the "extend GUI classes, override event handler methods" or the "attach anonymous objects to signals in an unnecessarily convoluted manner" type.
17:59 You're now known as TheWatcher
18:04
<@TheWatcher>
You attach listeners to events
18:07
<@TheWatcher>
you'll generally either make your class implement one of the various *Listener interfaces, and do a component.addActionListener(this) or use anonymous inner class listeners (component.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { .... } });
18:08
<@TheWatcher>
The fact I can remember this, not having touched swing for nearly 2 years, is a good indication of how badly it scarred my headbones~
18:38
<@ToxicFrog>
Aah yes, now I remember why I hate GUI programming in Java~
18:39
< Namegduf>
s/GUI // in my case.
18:40 * Namegduf has had to use Swing
18:42
<@ToxicFrog>
Well, yes, but I hate GUI programming in Java for specific reasons in addition to my dislike of Java as a whole.
18:42
<@ToxicFrog>
Reasons which probably wouldn't be an issue if, for example, using a Java binding to a different toolkit.
19:02 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
19:36 * Vornicus-Latens found gui programming in JS to be rather relaxing except for the occasional "IE doesn't do this and you have to support IE" bullshit.
19:37
< Namegduf>
Me too.
19:37
< Namegduf>
And IE is better at JS than it is at HTML/CSS.
19:44
< gnolam>
Doesn't say much though. :P
20:52 Kaura|zzz is now known as Kaura
21:20 Derakon[AFK] is now known as Derakon
21:21 Rhamphoryncus [rhamph@Nightstar-473f8685.abhsia.telus.net] has joined #code
22:08 EbonDragon is now known as AnnoDomini
22:22 You're now known as TheWatcher[T-2]
22:24
<@jerith>
22:56 < mithrandi> <glyph> tenth: you still can't tell the Windows ME clients to die in a fire yet?
22:24
<@jerith>
22:56 < mithrandi> <tenth> We've tried
22:24
<@jerith>
22:56 < mithrandi> <tenth> One of them did actually die in a fire
22:24
<@jerith>
22:56 < mithrandi> <glyph> okay I'm trying to feel like a bad person for saying that now
22:24
<@jerith>
22:56 < mithrandi> <glyph> but I can't muster it
22:25 You're now known as TheWatcher[zZzZ]
22:29 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection closed]
22:38 Derakon [Derakon@Nightstar-cfae48c3.ca.comcast.net] has left #code []
22:38 Derakon [Derakon@Nightstar-cfae48c3.ca.comcast.net] has joined #code
22:38
< Derakon>
Whups.
22:38 mode/#code [+o Derakon] by Reiver
23:10
< gnolam>
Aight. Text output actually works pretty well now. Now I just have to decide which parts of the basic multilingual plane I care about.
23:11
<@McMartin>
Only noncombining characters, zomg
23:21
< gnolam>
Looks like I get away with Latin-1 (0000-00ff) + Cyrillic (0400-04ff). Sweet. Only need two glyph atlases then.
23:21
< gnolam>
*atlasses
23:21
<@McMartin>
Watcha doin'?
23:24
< gnolam>
Right now? Trying to wrap FreeType in some remotely sane way.
23:32 shade_of_cpux is now known as cpux
23:33 * gnolam stabs OpenGL for setting the RGB components of a GL_ALPHA texture to 0 instead of 1.
23:36 Kaura is now known as Kaura|bbl
23:46 AnnoDomini [annodomini@Nightstar-912353ec.adsl.tpnet.pl] has quit [[NS] Quit: leaving]
23:59 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has joined #code
--- Log closed Wed Sep 29 00:00:57 2010
code logs -> 2010 -> Tue, 28 Sep 2010< code.20100927.log - code.20100929.log >