code logs -> 2008 -> Sun, 26 Oct 2008< code.20081025.log - code.20081027.log >
--- Log opened Sun Oct 26 00:00:10 2008
--- Day changed Sun Oct 26 2008
00:00 * Serah most noisly makes accompanied noises for Vorn.
00:06
< Vornicus>
my hand is starting to hate me for this.
00:19 AnnoDomini [~farkoff@Nightstar-29568.neoplus.adsl.tpnet.pl] has quit [Quit: beer_pump.c:335: robust error in 'traffic_cone()' - 'traffic_light' is not a budgerigar]
00:21
< Vornicus>
There. Now to verify I did it right.
00:47
<@Serah>
Your hand?
00:48
< Vornicus>
Yeah.
00:49
< Vornicus>
Process for creating a dude takes 10 repetitive keystrokes and 1 mouse click each time.
00:51 You're now known as TheWatcher[T-2]
00:55
<@Serah>
A dude?
00:56
< Vornicus>
A character file.
01:00 * Vornicus completes the verifier, now has to do the actual analysis.
01:05 You're now known as TheWatcher[zZzZ]
01:08 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
01:14 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
01:14 mode/#code [+o Reiver] by ChanServ
01:02
<@gnolam>
Oh dear. I'm tired again.
01:02 * Vornicus gives gnolam a pillow?
01:03
<@gnolam>
It appears that misreading "widget" as "midget" is a chronic tiredness symptom with me.
01:03 GeekSoldier [~Rob@Nightstar-8573.midstate.ip.cablemo.net] has quit [Quit: Praise "BOB"!]
01:03
<@gnolam>
It does make UI programming much more fun though.
01:06 Consul [~consul@Nightstar-3044.dsl.sfldmi.ameritech.net] has joined #code
01:07 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
01:13 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
01:13 mode/#code [+o Reiver] by ChanServ
01:13 GeekSoldier [~Rob@Nightstar-8573.midstate.ip.cablemo.net] has joined #code
02:01
< Vornicus>
Okay. 64 categories: 4 classes * 4 difficulties * 4 continents.
02:03
< Vornicus>
For each of these, I need army types and dwellings.
02:41
<@gnolam>
Shou: "Sofargone" - the /other/ Parisian University.
02:41 Bob_work [~c6b3e33a@Nightstar-23098.shawnetworks.com] has joined #code
02:41
< Bob_work>
Ok, found a problem with my code from earlier, and would like some help understanding what I screwed up.
02:42
< Bob_work>
C program: If statement: Is this valid: "if ( 0 < X < 10)"
02:44
< Bob_work>
I thought it would be a shortened version of "if ( 0 < X && X > 10), but apparently, the program treats it as "if (0 < X)"
02:44
< Vornicus>
The former does not work
02:45
< Vornicus>
< returns 1 or 0.
02:45
< Vornicus>
Python I know can handle that kind of trick, but i don't know how it does.
02:45
< Bob_work>
I thought the if statement as a WHOLE returned a 1 or 0
02:45
< Vornicus>
Nope. Programming languages are not nearly that smart.
02:45
< Bob_work>
Gotcha.
02:54
< Vornicus>
...to detect whether a dwelling exists, I have to examine its position; if the position is 0, then the dwelling does not exist.
02:56
<@ToxicFrog>
Bob_work: in more detail, it is actually (0 < X) < 10
02:56
<@ToxicFrog>
So, it first evaluates (0 < X), and gets 0 (false) or 1 (true)
02:56
<@ToxicFrog>
Then evalutes, say, 1 < 10
02:57
<@ToxicFrog>
(getting 1)
02:57
<@ToxicFrog>
And that's the result of the entire expression.
02:57
< Bob_work>
I...oh.
02:58
< Bob_work>
Mine, I think, was doing the opposite.
03:01
< Bob_work>
My code was if ( 0 < winning_number < 13). If the number was higher than 13, it declared them a winner still.
03:02
< Bob_work>
So I think it was checking X > 13 first, declaring it false, then checking 0 < X, declaring it true, and making the statement true.
03:04
<@ToxicFrog>
No. It's left to right. Think it through:
03:04
<@ToxicFrog>
(say it's 15)
03:04
<@ToxicFrog>
0 < 15: true (1)
03:04
<@ToxicFrog>
1 < 13: true
03:05
<@ToxicFrog>
If: succeeds./
03:05
< Bob_work>
Well, yeah, they're both true.
03:06
< Bob_work>
wait, nm
03:06
< Bob_work>
I see your point.
03:09
< Bob_work>
It was replacing the 0 < 15 with 1. Then evaluating the next expression.
03:09 * Bob_work will keep that in mind next time.
03:14
< Vornicus>
...why isn't this working.
03:16
< Bob_work>
Because your dwelling on something that doesn't exist?
03:22 DBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
03:23 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
03:23 DBot is now known as DiceBot
03:23 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
03:25 Vash [~Vash@Nightstar-26938.dsl.sndg02.sbcglobal.net] has joined #code
03:27 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
03:27 mode/#code [+o Reiver] by ChanServ
03:28
< Vornicus>
No, because I used the wrong offset, and so it was reading the much larger (and with many more valid locations) Enemy Army location table instead of the one for dwellings.
03:31
< Bob_work>
Ah.
03:32
< Vornicus>
...holy shit, I've run up against an Excel thing I don't know how to do nicely.
03:32
< Bob_work>
?
03:34
< Vornicus>
Got a table. Three 'key' fields, "Class", "Difficulty", and "Continent", and 25 'data' fields, each with a distinct name. I want to be able to view the sum of all the elements in each data field (individually) based on whether it matches a particular key.
03:35
< Vornicus>
in SQL: SELECT sum(peasants) GROUP BY continent;
03:36
< Vornicus>
except all of the non-key fields.
03:37
< Bob_work>
hmmm.
03:38
< Vornicus>
I suspect I can do it with a Stupid PivotTable trick, but damned if I can figure it out.
03:40
< Bob_work>
Well, you're already ahead of me. I was thinking of using a macro to find it, but that'd be some ugly code, I'm sure.
03:40 gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has quit [Quit: Z?]
03:48 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
03:49 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
03:51 Vash is now known as Strawberry
03:54 Strawberry is now known as Vash
03:55 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
03:55 mode/#code [+o Reiver] by ChanServ
03:57 * Vornicus pulls it off with SUMIF, which he did not know existed until now.
03:57 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
03:59
< Vornicus>
...and /that/ data explains why I always seem to recall getting so many Elves on Forestria: they're twice as common as even the commons.
04:03
< Vornicus>
(it appears that there are, for each continent, several "common" critters on each continent. I should probably check to see if their dwellings always exist, or if they're just "common" - I have seen that in other cases, in particular spells, you're guaranteed to get at least one of each.)
04:05
<@Reiver>
Ooh, SUMIF is lovely
04:05
< Bob_work>
SUMIF?
04:05
<@Reiver>
SUMIF(Range, Condition)
04:05
<@Reiver>
Or something like that, I forget the exact details.
04:05 * Bob_work adds that to his repository of knowledge, because he just KNOWS it's gonna bite him in the arse if he doesn;t.
04:05
<@Reiver>
"I want to sum everything in this column /except/..."
04:06
< Bob_work>
nice.
04:06
< Vornicus>
SUMIF(condrange,cond,sumrange)
04:07
< Vornicus>
for item, value in zip(condrange, sumrange): if item == cond: sum += value
04:09 * Bob_work steps away to take down the as400
04:10
< Vornicus>
Difficulty and Class do not seem to affect it.
04:13
< Vornicus>
Yeah, they don't appear to affect distribution at all.
04:14
< Vornicus>
If I'm correct: Continentia will /always/ have at least two Peasants, one Sprites, one Wolves, one Skeletons, one Gnomes, and one Orcs; similar things will be true about the other three continents.
04:15
< Vornicus>
Which will happen to add 320 to the counts of each of these things.
04:16
< Vornicus>
...no, it is not true.
04:17
< Vornicus>
The remaining is too low on those to be the explanation.
04:19
< Vornicus>
So we have commons, rares, and the supercommon elves on forestria.
04:22
< Vornicus>
(I can tell because if this were true, and the distribution were otherwise equal, then the average for rares and common - 320 would both be 100, and they're not - it's about 80 for common-320)
05:29 Bob_work [~c6b3e33a@Nightstar-23098.shawnetworks.com] has quit [Quit: CGI:IRC]
07:02 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
07:03 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
07:10 Serah [~Z@Nightstar-5401.atm2-0-1041217.0xc329e232.boanxx12.customer.tele.dk] has quit [Quit: Be right back, got some smiting and righteous justice to attend to.]
07:12 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
07:13 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
07:13 mode/#code [+o Reiver] by ChanServ
07:26 AnnoDomini [~farkoff@Nightstar-29568.neoplus.adsl.tpnet.pl] has joined #Code
07:26 mode/#code [+o AnnoDomini] by ChanServ
08:05 Doctor_Nick [~.@Nightstar-12626.tampfl.fios.verizon.net] has quit [Quit: Reconnecting]
08:05 Doctor_Nick [~.@Nightstar-12626.tampfl.fios.verizon.net] has joined #code
08:08 Vornicus is now known as Vornicus-Latens
08:08 Doctor_Nick [~.@Nightstar-12626.tampfl.fios.verizon.net] has quit [Quit: leaving]
08:08 Doctor_Nick [~nick@Nightstar-12626.tampfl.fios.verizon.net] has joined #code
08:09 Doctor_Nick [~nick@Nightstar-12626.tampfl.fios.verizon.net] has quit [Quit: leaving]
08:14 Vash [~Vash@Nightstar-26938.dsl.sndg02.sbcglobal.net] has quit [Quit: *poofs into nothingness*]
08:15 Doctor_Nick [~nick@Nightstar-12626.tampfl.fios.verizon.net] has joined #code
08:15 Doctor_Nick [~nick@Nightstar-12626.tampfl.fios.verizon.net] has quit [Quit: leaving]
09:13 You're now known as TheWatcher
09:21 Attilla [~The.Attil@Nightstar-9469.cdif.cable.ntl.com] has quit [Connection reset by peer]
09:22 Attilla_ [~The.Attil@Nightstar-9469.cdif.cable.ntl.com] has joined #code
09:24 Attilla_ is now known as Attilla
09:25
<@AnnoDomini>
I need to find CLIPS exercises, so I can exercise. Can't seem to find them using Google, though.
09:25
<@McMartin>
... CLIPS?
09:25
<@McMartin>
Like, the expert system language?
09:25
<@AnnoDomini>
Yes.
09:26
<@McMartin>
Wow.
09:26
<@McMartin>
I haven't seen that language in 20 years
09:26
<@McMartin>
(On take-your-child-to-work day)
09:35
<@AnnoDomini>
I see.
09:37
<@McMartin>
It is probably the third computer language I was ever exposed to.
09:37
<@McMartin>
I'm astonished it's still alive.
09:37
<@McMartin>
(The second was BASIC. The first was Prolog, although that was admittedly a Dad taking a 3-year-old in to bang on an expert system and Really Test Its Robustness)
09:48
<@AnnoDomini>
Yay. Found a tutorial.
09:48
<@AnnoDomini>
We're gonna be learning Prolog too.
10:01 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
10:01 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
10:01 mode/#code [+o Reiver] by ChanServ
10:04 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
10:04 Reivles [~reaverta@Admin.Nightstar.Net] has joined #Code
10:05 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
10:06 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
10:06 mode/#code [+o Reiver] by ChanServ
10:07 Reivles [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
10:15 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
10:22 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
10:22 mode/#code [+o Reiver] by ChanServ
10:24 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
11:41
<@AnnoDomini>
http://pastie.org/300748
11:42
< Shou|Sofargone>
..................
11:42 Shou|Sofargone is now known as Shoukanjuu
11:42
< Shoukanjuu>
You should be ashamed of yourself XD
11:47
< Shoukanjuu>
Aero bounce is so broken...
12:16 Reivles [~reaverta@Admin.Nightstar.Net] has joined #Code
12:18 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
12:22 Reivles [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
12:23 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
12:23 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
12:23 mode/#code [+o Reiver] by ChanServ
12:30 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
12:32 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
12:33 DBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
12:33 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
12:34 DBot is now known as DiceBot
12:38 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
12:38 mode/#code [+o Reiver] by ChanServ
12:47 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
12:48 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
12:48 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
12:48 mode/#code [+o Reiver] by ChanServ
12:56 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
13:18 gnolam [lenin@Nightstar-1382.A163.priv.bahnhof.se] has joined #Code
13:18 mode/#code [+o gnolam] by ChanServ
13:32 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
13:33 DBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
13:33 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
13:33 ReivDamnit [~reaverta@Admin.Nightstar.Net] has joined #Code
13:34 DBot is now known as DiceBot
13:37 ReivDamnit is now known as Reiver
13:48 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
13:49 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
13:50 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
13:50 mode/#code [+o Reiver] by ChanServ
13:57 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
14:20 ReivDamnit [~reaverta@Admin.Nightstar.Net] has joined #Code
14:21 DBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
14:22 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
14:22 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
14:23 DBot is now known as DiceBot
15:34 ReivDamnit [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
15:35 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
15:35 mode/#code [+o Reiver] by ChanServ
15:35 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
15:38 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
15:51 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
15:51 mode/#code [+o Reiver] by ChanServ
15:58 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
16:08 Doctor_Nick [~nick@Nightstar-12626.tampfl.fios.verizon.net] has joined #code
16:19 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
16:20 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
16:25 Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code
16:25 mode/#code [+o Reiver] by ChanServ
16:29 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
16:35 Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
16:35 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
16:37 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
16:38 * jerith stabbystabs Project Euler problem 45.
16:43
< GeekSoldier>
heh.. I had a brute force run on that... took well over 24hrs, then crashed.
16:43
<@jerith>
I'm up over a million tri/pent/hex numbers and it hasn't found another match yet.
16:45
<@jerith>
Oh, I broke my algorithm.
16:48 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
16:50 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
16:51 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
16:51 mode/#code [+o Reiver] by ChanServ
16:51
<@ToxicFrog>
45 looks very brute-forceable, yes.
16:53 * Vornicus-Latens checks 45 to see what it is.
16:54
< Vornicus-Latens>
oh, fun.
16:57
< Vornicus-Latens>
...well, okay, step 1.
16:57
< Vornicus-Latens>
Hex(k) = Tri(2k)
16:58
< Vornicus-Latens>
Or thereabouts; you can reduce out the triangular one because /all/ hex numbers are also triangular.
17:02 * GeekSoldier blinks.
17:02
<@jerith>
Ah, right.
17:02
<@jerith>
I forgot about that.
17:02
<@jerith>
I seem to have optimised away correctness, though.
17:03
< Vornicus-Latens>
...heh. I got a result in under a second.
17:03 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
17:04
< Vornicus-Latens>
Ding!
17:04
< GeekSoldier>
haha.
17:04 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
17:05 * Vornicus-Latens used a 'merge iterators' sort of pattern on hex and pent.
17:05 Vornicus-Latens is now known as Vornicus
17:11 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
17:12 mode/#code [+o Reiver] by ChanServ
17:14 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
17:16 mode/#code [+oooooo Attilla C_tiger Consul crem Doctor_Nick GeekSoldier] by Vornicus
17:16 mode/#code [+oov Shoukanjuu Vornicus DiceBot] by Vornicus
17:17
<@AnnoDomini>
Merge the iterators to reverse the pointer polarity? BRILLIANT!
17:17 * Vornicus patpats AnnoDomini.
17:17
<@AnnoDomini>
:]
17:18 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
17:18 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
17:19
<@Vornicus>
...why do none of these people just use the iterative form of the sequences? (I'm looking at the forum now)
17:20
<@Vornicus>
and some madman did it with bash and uniq.
17:21 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
17:21
<@ToxicFrog>
Awesome.
17:22
<@Vornicus>
(generate the two sequences a good long way out, and then you can sort and use uniq -d on them.)
17:22
<@ToxicFrog>
...also, don't you mean Hex(k) = Tri(2k-1)?
17:23
<@Vornicus>
Yes, I was zero-indexing
17:23
<@ToxicFrog>
Zero-indexing doesn't change it; {Hex,Tri,Pent}(0) == 0 in all cases.
17:24
<@Vornicus>
No, no
17:24
<@Vornicus>
In mine, hex[0] == 1
17:24
<@ToxicFrog>
So you're using different formulae.
17:24 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
17:24 mode/#code [+o Reiver] by ChanServ
17:32
<@Vornicus>
Well, not really
17:32
<@Vornicus>
I don't use the index number at all, see
17:32 * Consul gets to figure out how to compile the Nvidia binary wrapper for a new kernel. :-/
17:34
<@Consul>
Well, I don't really need 3D... I could try the open-source ones and see what happens.
17:34 * Vornicus generates hex numbers like this: hex = 1; hex_advance = 5; while 1: hex += hex_advance; hex_advance += 4
17:34
<@Consul>
Oh, wait.. No, I do need OpenGL for some of the UIs for programs I use.
17:34
<@ToxicFrog>
ben@orias ~/devel/Euler
17:34
<@ToxicFrog>
$ time lua 045.lua
17:34
<@ToxicFrog>
[answers redacted]
17:35
<@ToxicFrog>
real 0m0.249s
17:35
<@ToxicFrog>
I just did it with the reference formulae and with optimizing away of tri()
17:36
<@ToxicFrog>
Iterated Hn and Pn upwards until I found a match, then generated the corresponding Tn and done.
17:36 * ToxicFrog ponders question 7.
17:36
<@Vornicus>
0.116654157639 <--
17:36 * ToxicFrog specifically ponders doing question 7 in Haskell.
17:37
<@ToxicFrog>
There's bound to be an elegant way to generate the list of all primes in hs, and then I just ask for the 10001th element of it.
17:39
<@GeekSoldier>
I love the J solution to #7.
17:42 * Vornicus finds his primes generator. Likes his seive: any(k % p == 0 for p in _primes[:bisect(_primes, sqrt(k))])
17:46
<@ToxicFrog>
any()?
17:47
<@Vornicus>
any(seq) returns True if any of the elements of the sequence are True.
17:48 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
17:48
<@Vornicus>
It's a many-input or, and it short circuits like one.
17:49
<@Vornicus>
there's also all(), which is like and
17:50 DBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
17:51 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
17:52 DBot is now known as DiceBot
17:54 * jerith moves on to 46.
17:55 * Vornicus examines his archives, sees he left off his redo at 10.
17:55 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
17:55 mode/#code [+o Reiver] by ChanServ
17:59 * ToxicFrog totally cheeses #20
18:00
<@jerith>
Those ones are easy when your language has arbitrary precision ints.
18:04
<@ToxicFrog>
Mine doesn't.
18:04
<@ToxicFrog>
So, as I said, I cheesed it:
18:04
<@ToxicFrog>
echo 'define fact(n) { if (n <= 1) return 1; return (fact(n-1) * n); }; fact(100)' | bc | lua -e 'data = io.read "*a"; sum = 0; for c in data:gmatch("%d") do sum = sum + tonumber(c) end; print(sum)'
18:05
<@jerith>
Nice.
18:09
<@Vornicus>
you asked bc for it instead.
18:09
<@Vornicus>
sweet.
18:15
<@Vornicus>
oh, god, prime generation is slow when you need 150,000 of them.
18:16
<@jerith>
Or a million.
18:17
<@jerith>
Oh, you only need the ones below a million.
18:17
<@Vornicus>
2 million
18:17 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
18:17 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
18:19 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
18:20 * ToxicFrog ponders that seive
18:20
<@ToxicFrog>
What is _primes[:bisect(_primes, sqrt(k))]?
18:20
<@Vornicus>
_primes is a hidden list of already known primes.
18:21
<@Vornicus>
bisect is a function that given a sorted sequence and an item to search for, will find the correct insertion point to keep the sequence sorted.
18:22
<@Vornicus>
So what that says is: "Give me the part of primes where all the items are below sqrt(k)
18:22
<@ToxicFrog>
Aah
18:23
<@ToxicFrog>
I was expecting bisect() to return a list. Now it makes sense.
18:24
<@ToxicFrog>
All the forums are locked >.<
18:25 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
18:25 mode/#code [+o Reiver] by ChanServ
18:27
<@jerith>
They are until you have a solution.
18:28
<@ToxicFrog>
No
18:28
<@ToxicFrog>
I mean, you can't see them until you have a solution
18:28
<@ToxicFrog>
Once you have a solution, you can see them but AFAICT you can't post
18:28
<@GeekSoldier>
right.
18:28
<@ToxicFrog>
Which was not the case last time I did this
18:29
<@jerith>
Oh.
18:29
<@jerith>
Maybe they lock them after a certain time?
18:29 * Vornicus eyes this, can't figure out what he's doing wrong.
18:29 * jerith gets on with 47.
18:29
<@jerith>
Er, 46.
18:30 * Vornicus tries to figure out what's wrong with his code for 11.
18:33
<@Vornicus>
I don't see anything I missed...
18:35
<@Vornicus>
...oh.
18:35
<@Vornicus>
That's what I missed.
18:36 * Vornicus forgot to catch the backwards diagonal.
18:50 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
18:54 Attilla [~The.Attil@Nightstar-9469.cdif.cable.ntl.com] has quit [Ping Timeout]
18:56 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
18:59
<@GeekSoldier>
cool, I just figured out 26.
19:00
<@jerith>
That's the one you need long division for...
19:01
<@GeekSoldier>
yes.
19:01
<@Vornicus>
26 you don't necessarily need long division for.
19:02
<@Vornicus>
Well, you do need to divide, but it's not like you need to hand-implement that long division algorithm.
19:02
<@GeekSoldier>
I used it, though.
19:03
<@jerith>
You just need remainders, actually.
19:04
<@jerith>
Then cycle-detect on those.
19:05 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
19:06 * Vornicus knows how to tell repeat length without doing the remainder repetition, and can also tell how many digits you need to skip first.
19:07 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
19:07 mode/#code [+o Reiver] by ChanServ
19:17 * Vornicus eyes this one, determines that now would probably be a good time to clean up his divisor code; currently it gets divisors as 2**prime factors time; this can be drastically reduced in situations where multiple copies of particular factors exist.
19:18
<@ToxicFrog>
Yeah, I probably need to upgrade my divisor-finding code as well
19:18
<@ToxicFrog>
It's very naive at the moment and this means #12 is taking forever
19:18
<@ToxicFrog>
Oh, wait, it's done
19:18
<@Vornicus>
hey, join the club.
19:19
<@ToxicFrog>
real 0m22.762s
19:19
<@ToxicFrog>
user 0m22.034s
19:19
<@ToxicFrog>
sys 0m0.057s
19:19
<@Vornicus>
...really though there's only 11 factors there, so no big deal.
19:19
<@ToxicFrog>
This one doesn't use prime factors.
19:19 * jerith heads home.
19:20
<@ToxicFrog>
It iterates from 1 to sqrt(n) and for each k such that n % k == 0, divisors += 2
19:20
<@jerith>
(I might finish 47 tonight.)
19:20
<@Vornicus>
Right, I know
19:21
<@Vornicus>
but with 11 prime factors you only get 2048 possibly duplicate divisors.
19:25 Attilla [~The.Attil@Nightstar-9469.cdif.cable.ntl.com] has joined #code
19:25 mode/#code [+o Attilla] by ChanServ
19:34
<@Vornicus>
(on the other hand, if you do the multiset thing with your prime factors, you can determine the length without going through all the possible divisors)
19:39 * ToxicFrog ponders 24
19:42
<@gnolam>
The answer is "Kiefer Sutherland".
19:42
<@ToxicFrog>
I could just generate all the permutations.
19:42
<@ToxicFrog>
I've definitely got enough memory for it.
19:43
<@Vornicus>
ah, 13. could you /possibly/ be any easier.
19:44
<@ToxicFrog>
That one I cheesed as well
19:44
<@ToxicFrog>
Intersperced them with +, piped to bc | dd bs=1 count=10
19:44 * Vornicus just dumped them into a list nums, then went 'print str(sum(nums))[:10]
20:01 Vornicus is now known as Finerty
20:03 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
20:10 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
20:10 mode/#code [+o Reiver] by ChanServ
20:21
<@gnolam>
Hmm. I wonder if OpenOffice 3.0 is as awful as 2.x.
20:22 * Finerty ponders 16. That'd be a lot trickier if I didn't have longs.
20:23
<@McMartin>
I've been using the NeoOffice fork exclusively for so long I've forgotten how terrible the original is~
20:23
<@McMartin>
But if 3.0 swipes stuff *from* NeoOffice and ports it back away from Cocoa, it's got to be better. =P
20:23
<@ToxicFrog>
I applied bc to 16 as well.
20:23
<@ToxicFrog>
Also, memoization is delicious
20:23
<@Finerty>
Yes, it is.
20:24
<@gnolam>
Finerty: ... I read that as "lungs" first. And I thought that was a pretty obvious conclusion for most anything.
20:24
<@ToxicFrog>
(15 with memoization runs in less than a second. 15 without is at one minute and still not finished)
20:24
<@Finerty>
15?
20:24
<@Finerty>
Dude. Binomial coefficient.
20:24
<@ToxicFrog>
Recursive is easier.
20:24
<@Finerty>
Um. No it's not.
20:24
<@ToxicFrog>
Easier for me
20:24
<@Finerty>
...dammit where's Schlock when I need him?
20:27
<@Finerty>
def binomial_coefficient(pile, choose):
20:27
<@Finerty>
result = 1
20:27
<@Finerty>
if choose < pile / 2:
20:27
<@Finerty>
choose = pile - choose
20:27
<@Finerty>
for k in range(1, pile - choose + 1):
20:27
<@ToxicFrog>
My point being that when I see that sort of problem, I immediately think "recursion", and it takes me less time to write a recursive solution than to come up with a mathematical one.
20:27
<@Finerty>
result = result * (choose + k) / k
20:27
<@Finerty>
return result
20:27
<@Finerty>
20:27
<@Finerty>
print binomial_coefficient(40, 20)
20:27
<@Finerty>
Anyway:: http://rafb.net/p/HZrv1x81.html
20:27
<@ToxicFrog>
local function paths(w, h)
20:27
<@ToxicFrog>
if w == 0 or h == 0 then
20:27
<@ToxicFrog>
return 1
20:27
<@ToxicFrog>
end
20:27
<@ToxicFrog>
return paths(w-1, h) + paths(w, h-1)
20:27
<@ToxicFrog>
end
20:27
<@ToxicFrog>
paths = util.memoize(paths)
20:27
<@ToxicFrog>
print(paths(...))
20:28
<@Finerty>
i guess I've done more combinatorics than you; I saw that and without even thinking went "binomial coefficient!
20:30
<@ToxicFrog>
That seems likely. I'm not even sure what it is you're doing there.
20:33
<@Finerty>
The binomial coefficient a C b or a Choose b or { a \choose b } gives the number of different ways you can pick b things from a pile of a things, without replacement, and without regard for order.
20:34
<@ToxicFrog>
Aah
20:34
<@ToxicFrog>
I am familiar with that, but didn't have it keyed by name.
20:34
<@ToxicFrog>
Probably because I almost never use it.
20:35
<@Finerty>
So, for instance, the number of ways you can have a 40-bit number with exactly 20 1s in it is binomial_coefficient(40, 20), and the number of distinct 5-card poker hands is b_c(52, 5)
20:36
<@gnolam>
Well, the new OpenOffice site is even /worse/ than the previous one. Not a good sign. :P
20:37
<@gnolam>
Slow mirror as well.
20:38
<@ToxicFrog>
I looked at it and went "hmm. Clearly the paths from a point are the number of paths if you move down first, plus the number of paths if you move right first. RECURSE'D
20:42
<@ToxicFrog>
Wow.
20:42
<@ToxicFrog>
The non-memoized one is still running.
20:42
<@Finerty>
Yeah, a hundred billion of those isn't going to be pretty.
20:47
<@ToxicFrog>
19:
20:47
<@ToxicFrog>
for ((month=1; month <= 12; ++month)); do
20:47
<@ToxicFrog>
for ((year=1901; year <= 2000; ++year)); do
20:47
<@ToxicFrog>
cal $month $year | egrep "^ 1"
20:47
<@ToxicFrog>
done
20:47
<@ToxicFrog>
done | wc -l
20:47
<@Finerty>
*snrk*
21:03 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
21:03 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
21:10 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
21:10 mode/#code [+o Reiver] by ChanServ
21:12 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
21:13 * Finerty eyes 17.
21:13
<@Finerty>
okay, I'm missing a thousand characters, and I don't know where.
21:14
<@AnnoDomini>
In the character sheets folder.
21:14 * Finerty bites anno.
21:15
<@AnnoDomini>
!roll 1d20+2
21:15
< DiceBot>
[AnnoDomini] rolled 1d20+2: (3+2) = 5.
21:15 * AnnoDomini is infected with lycanthropy, and will change into a were-Elder God at next full moon.
21:19
<@ToxicFrog>
Vorn: funny, I had the opposite problem
21:19 AbuDhabi [~farkoff@Nightstar-29528.neoplus.adsl.tpnet.pl] has joined #Code
21:19
<@ToxicFrog>
It was writing 30 as "thirty zero", and 1000 as "one thousand, zero hundred and zero"
21:21
<@Finerty>
heh.
21:21 AnnoDomini [~farkoff@Nightstar-29568.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
21:21
<@Finerty>
so lessee. Units; except for the teens, each one appears in each group of ten once. This is 10 * 9 = 90 copies of the units.
21:22
<@Finerty>
Teens; each appears in each group of 100 once, so there's 10 copies.
21:23
<@Finerty>
Hundreds; there's 100 things in each group of 100, and each one has a unit-hundred attached. so that's 100 copies of each unit number, and then 900 "hundred"s.
21:23
<@Finerty>
Ands: there's one of these for everything greater than 100 that's not divisible by 100. so 99*9 of those.
21:23
<@Finerty>
then one thousand, which is 11.
21:24
<@Finerty>
one two three four five six seven eight nine 3 3 5 4 4 3 5 5 4
21:25
<@Finerty>
Oh, and tens, twenty-ninety, each one shows up ten times in each hundred...
21:25
<@Finerty>
that's still short.
21:26 * Finerty is down to 180 missing characters, after fixing a pair of 90s to 100s.
21:31
<@ToxicFrog>
Are you figuring this out by math, or are you writing something to do it for you, counting the output, and cross-checking it by math?
21:32
<@Finerty>
I'm figuring this out by math.
21:36
<@ToxicFrog>
Nod.
21:37
<@ToxicFrog>
(I wrote something to actually print out all the words, then stripped non-alphabetics and lettercounted)
21:37 * Finerty is trying that now.
21:38 * ToxicFrog alternates between working on Project Euler and generating vast quanties of roast lamb in Odin Sphere
22:14 AbuDhabi [~farkoff@Nightstar-29528.neoplus.adsl.tpnet.pl] has quit [Quit: Death is always at your back, for all return to the earth from which they came, the fire of life is at the births to come, the tears of a mourning woman are at your left, and the wind blows forth from your right.]
22:20 Serah [~Z@Nightstar-5401.atm2-0-1041217.0xc329e232.boanxx12.customer.tele.dk] has joined #Code
22:20 mode/#code [+o Serah] by ChanServ
22:50 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
22:52 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
22:58 Reiver [~reaverta@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
22:58 mode/#code [+o Reiver] by ChanServ
22:59 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
23:12 You're now known as TheWatcher[T-2]
23:12 C_tiger [~c_wyz@Nightstar-8414.hsd1.ca.comcast.net] has quit [Ping Timeout]
23:15 You're now known as TheWatcher[zZzZ]
23:20 DBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has joined #Code
23:20
<@McMartin>
Sigh. Bruce Schneier facts.
23:20
<@McMartin>
I admit I laughed at "Bruce Schneier doesn't need a keylogger: he's standing right behind you", though.
23:21 DiceBot [~Reiver@Nightstar-14540.xdsl.xnet.co.nz] has quit [Ping Timeout]
23:22 DBot is now known as DiceBot
23:22
<@Finerty>
I definitely prefer the one about Waldo.
23:24
<@McMartin>
Remind me?
23:24
<@Finerty>
Bruce Scheier can van Eck phreak Waldo on every page from 3 bookshelves away.
23:27
<@gnolam>
Bruce Schneier probably knows where in the world Carmen Sandiego is as well.
23:27
<@McMartin>
Hell, I worked that one out a few times.
23:28
<@gnolam>
One of the few examples of Edutainment Done Right (TM).
23:29
<@Finerty>
I was doing the TA-ish thing in a math class the other day and people pined for Number Munchers.
23:32 * gnolam wikis it.
23:32
<@gnolam>
Ah.
23:39
<@gnolam>
I've pondered entering the edutainment market. I mean, sure, it's enormously overestablished market - but 99.9% of what's on it is absolute /crap/.
23:43
<@McMartin>
USE OF MICROSOFT EXCEL ONLINE
--- Log closed Mon Oct 27 00:00:51 2008
code logs -> 2008 -> Sun, 26 Oct 2008< code.20081025.log - code.20081027.log >