2012-01-07T00:37:06 *** Fandekasp has joined #aichallenge 2012-01-07T00:40:20 *** dorisabayon has quit IRC (Ping timeout: 252 seconds) 2012-01-07T01:06:25 *** jstrong has left #aichallenge 2012-01-07T01:11:19 *** spacebat_ has quit IRC (Read error: Operation timed out) 2012-01-07T01:13:14 *** heinrich5991 has quit IRC (Ping timeout: 276 seconds) 2012-01-07T01:14:26 *** spacebat has joined #aichallenge 2012-01-07T01:22:53 *** sigh has joined #aichallenge 2012-01-07T01:23:19 *** heinrich5991 has joined #aichallenge 2012-01-07T01:56:59 *** alehorst has joined #aichallenge 2012-01-07T02:11:15 *** Jak_o_Shadows has joined #aichallenge 2012-01-07T02:18:03 *** Fandekasp has quit IRC (Ping timeout: 240 seconds) 2012-01-07T02:30:57 *** Logician has quit IRC (Read error: Connection reset by peer) 2012-01-07T02:36:09 *** u_ has quit IRC (Quit: u_) 2012-01-07T03:04:55 *** Palmik has joined #aichallenge 2012-01-07T03:06:33 *** Accoun has quit IRC () 2012-01-07T03:18:51 *** Kurnevsky has joined #aichallenge 2012-01-07T03:24:32 *** Accoun has joined #aichallenge 2012-01-07T03:30:11 *** epicmonkey has joined #aichallenge 2012-01-07T03:35:16 *** Fandekasp has joined #aichallenge 2012-01-07T03:37:41 *** X-Scale has quit IRC (Remote host closed the connection) 2012-01-07T03:40:20 *** dorisabayon has joined #aichallenge 2012-01-07T03:40:53 *** Fandekasp has quit IRC (Ping timeout: 248 seconds) 2012-01-07T03:52:42 *** amstan has quit IRC (Quit: Konversation terminated!) 2012-01-07T04:06:37 *** epicmonkey has quit IRC (Ping timeout: 244 seconds) 2012-01-07T04:28:25 *** Accoun has quit IRC () 2012-01-07T04:31:50 *** epicmonkey has joined #aichallenge 2012-01-07T04:36:13 *** Accoun has joined #aichallenge 2012-01-07T05:14:30 *** Blkt has joined #aichallenge 2012-01-07T05:18:41 *** kilae has joined #aichallenge 2012-01-07T05:23:19 *** antimatroid1 has joined #aichallenge 2012-01-07T05:23:55 *** antimatroid has quit IRC (Read error: No route to host) 2012-01-07T05:25:23 *** lhb__ has joined #aichallenge 2012-01-07T05:28:43 *** raemde_ has quit IRC (Ping timeout: 240 seconds) 2012-01-07T05:33:45 *** choas has joined #aichallenge 2012-01-07T05:38:03 *** Jak_o_Shadows has quit IRC (Remote host closed the connection) 2012-01-07T05:38:09 *** foRei has joined #aichallenge 2012-01-07T05:40:30 *** Jak_o_Shadows has joined #aichallenge 2012-01-07T05:40:43 *** kire has joined #aichallenge 2012-01-07T05:47:33 *** g0llum has joined #aichallenge 2012-01-07T06:03:00 *** Akranis has joined #aichallenge 2012-01-07T06:06:17 good day everyone 2012-01-07T06:24:14 *** mcstar has joined #aichallenge 2012-01-07T06:27:53 *** UncleVasya has joined #aichallenge 2012-01-07T06:34:01 *** conor_f has joined #aichallenge 2012-01-07T06:37:56 *** Fandekasp has joined #aichallenge 2012-01-07T06:41:08 *** dorisabayon has quit IRC (Ping timeout: 240 seconds) 2012-01-07T06:44:13 *** UncleVasya has quit IRC (Read error: Connection reset by peer) 2012-01-07T06:47:28 *** AlliedEnvy has quit IRC (Remote host closed the connection) 2012-01-07T06:49:36 *** ikaros has joined #aichallenge 2012-01-07T06:52:03 *** AlliedEnvy has joined #aichallenge 2012-01-07T07:03:04 *** lhb__ is now known as raemde 2012-01-07T07:43:33 *** Jak_o_Shadows has quit IRC (Remote host closed the connection) 2012-01-07T07:56:02 friggin latex formatting on /r/math sucks 2012-01-07T08:00:48 *** pairofdice has quit IRC (Quit: When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl.) 2012-01-07T08:09:11 I never understood what latex is, just a markup for math symbols? 2012-01-07T08:10:10 its a programming language 2012-01-07T08:10:29 like postscript 2012-01-07T08:10:48 weird 2012-01-07T08:10:51 the output is a formatted document 2012-01-07T08:11:03 I see I'm lagging well behing in PE lol 2012-01-07T08:12:26 those sites using "latex" dont really use latex, i believe, only a subset of it 2012-01-07T08:12:38 just to display math symbols like you said 2012-01-07T08:13:05 yeah 2012-01-07T08:13:19 I never knew it could make vector graphics or anything lol 2012-01-07T08:13:43 i dont think it can by itself 2012-01-07T08:13:49 but you can draw with packages 2012-01-07T08:14:09 hmm kk 2012-01-07T08:14:26 did you ever play piano by any chance? 2012-01-07T08:14:58 yes 2012-01-07T08:15:00 http://www.youtube.com/watch?v=wxu14FAUKV4 2012-01-07T08:15:08 then you can appreciate how hard that is 2012-01-07T08:15:20 and the teachers realized i shouldnt attend music school 2012-01-07T08:15:21 improv part starts around 1:00 2012-01-07T08:15:38 do you still play piano? 2012-01-07T08:16:14 as i implied, i never learnt it 2012-01-07T08:16:32 oh, see I thought you learnt it pretty well 2012-01-07T08:16:40 the opposite 2012-01-07T08:16:44 still though, that guys incredible 2012-01-07T08:17:02 I've been playing since I was like 9 but could never do that 2012-01-07T08:17:13 his timing is just ridiculous :O 2012-01-07T08:17:41 conor_f: it's worth learning LaTeX if you go into scienc 2012-01-07T08:18:07 antimatroid1: not looking at science :) 2012-01-07T08:18:16 software dev or something 2012-01-07T08:18:21 staying a good bit away from science 2012-01-07T08:18:23 it's the standard for academic papers etc. and just looks nicer 2012-01-07T08:18:29 but I suppose it's not that hard to learn 2012-01-07T08:18:31 still worth learning then 2012-01-07T08:18:53 probably only a day long thing to learn? 2012-01-07T08:18:54 once you are familiar with how LaTeX looks everything else looks gross 2012-01-07T08:19:56 it still takes time to do advanced layouts in it 2012-01-07T08:20:08 antimatroid1: did you do a big-ass poster in latex by any chance? 2012-01-07T08:20:12 yes, but to do assignments or whatever you don't need advanced layouts 2012-01-07T08:20:17 i did not 2012-01-07T08:20:27 it took pretty long for me 2012-01-07T08:20:59 i got the trinary triumph award on pe 2012-01-07T08:21:08 :) nice 2012-01-07T08:21:14 lame 2012-01-07T08:21:23 oh, sorry 2012-01-07T08:21:29 i didnt want to say it out load 2012-01-07T08:21:33 heh 2012-01-07T08:21:59 :P 2012-01-07T08:22:07 antimatroid1: youve got the most awards among my friends 2012-01-07T08:22:08 I need to try and catch rwest_ 2012-01-07T08:22:13 same with me 2012-01-07T08:22:27 strcat and my other friend are tied on 70 problems solved 2012-01-07T08:22:28 rwest: 2012-01-07T08:22:44 but still his shabby morals make it easy for him to just use wolfram alpha :P 2012-01-07T08:22:45 antimatroid1: you should have added mcleo 2012-01-07T08:23:02 i will get his friend thing later 2012-01-07T08:23:19 I have mcleo, thestinger, antimatroid1, mcstar and rwest_ :P 2012-01-07T08:23:32 sigh would put us all to shame 2012-01-07T08:23:42 how many problems have McLeopold and rwest solved? 2012-01-07T08:23:48 antimatroid1: what would I do? 2012-01-07T08:23:50 i only have 1 other friend, other than you guys 2012-01-07T08:23:55 McLeopold: 74 2012-01-07T08:23:57 sigh: put us to shame on project euler 2012-01-07T08:23:59 rwest 30 :P 2012-01-07T08:24:07 sigh: befriend me 87839112121588_5bb1270f8fa7b38e44fd06f20fd13ff3 2012-01-07T08:24:11 oh I haven't done project euler for over a year 2012-01-07T08:24:12 sigh: wanna share friend key? 2012-01-07T08:24:18 doesn't sigh have like hundreds done? 2012-01-07T08:24:21 yeah the site is a bit different now 2012-01-07T08:24:33 changed a lot alright 2012-01-07T08:24:35 sure, how do I do that... I haven't used it since for a while 2012-01-07T08:24:38 nicer now :) 2012-01-07T08:24:42 log in and go to friends 2012-01-07T08:24:47 just go to Friends, paste your key here 2012-01-07T08:24:47 then add the new friend key 2012-01-07T08:25:05 or better 2012-01-07T08:25:11 just paste your friend key 2012-01-07T08:25:12 these guys started hammering the problems out 2012-01-07T08:25:14 my key is 6666134423868_029bce60358e4f2a72641d5c385e0ea0 2012-01-07T08:25:16 so i thought i better keep in front :P 2012-01-07T08:25:31 257 2012-01-07T08:25:33 wow 2012-01-07T08:25:34 yikes 2012-01-07T08:25:37 thats ridiculous 2012-01-07T08:25:39 10 awards 2012-01-07T08:25:43 *slow clap* 2012-01-07T08:25:53 lol 818 days ago :P 2012-01-07T08:25:54 i was at a 100% for a while :P 2012-01-07T08:25:55 sigh: thanks for the motiavtion 2012-01-07T08:26:12 he's not quite 200 problems ahead! 2012-01-07T08:26:39 i need to write some script to automate the solutions... 2012-01-07T08:26:39 yeah, easily reachable antimatroid1 ;) 2012-01-07T08:26:53 sigh: all in PY? 2012-01-07T08:27:11 a few in c when python was too slow or took too much memory 2012-01-07T08:27:19 but mostly python 2012-01-07T08:27:25 wow 2012-01-07T08:27:28 impressive 2012-01-07T08:27:44 what happened to 257 and 258 man?!? 2012-01-07T08:27:48 letting us down :P 2012-01-07T08:28:03 haha 2012-01-07T08:28:40 yeah... around that time I fell behind then kind of stopped to have time to do other things :) 2012-01-07T08:34:01 antimatroid1: why have you skipped 12? :P 2012-01-07T08:34:11 sigh: don't talk to me about 12 :P 2012-01-07T08:34:20 i haven't looked at it in ages, but i could never get it 2012-01-07T08:34:39 everytime i looked at it i got extremely frustrated with myself 2012-01-07T08:34:42 antimatroid1: have you still not gotten it? 2012-01-07T08:34:53 just so you know, even I've gotten that one ;) 2012-01-07T08:34:54 haven't looked at it recently 2012-01-07T08:34:58 yeah i know :P 2012-01-07T08:35:22 just find the first triangle number with more then 500 divisors? 2012-01-07T08:36:00 * antimatroid1 goes to try it 2012-01-07T08:36:09 you don't need to do anything special at all 2012-01-07T08:36:21 my horribly unoptimized brute force runs in like 1 min 2012-01-07T08:38:23 if you want to be faster, then don't find the actual divisors, just find the prime factors and you can count divisors from that 2012-01-07T08:38:40 oh? 2012-01-07T08:38:46 how so? 2012-01-07T08:39:37 12 looks like i didnt write that code 2012-01-07T08:39:41 ofc thats impossible 2012-01-07T08:39:55 if x = p1^a1 * p2^a2 * ... * pn^an, then x has (a1+1)*(a2+1)*...*(an+1) divisors 2012-01-07T08:40:21 huh 2012-01-07T08:40:24 never knew that 2012-01-07T08:40:36 would it be that much faster though? 2012-01-07T08:40:36 because for each divisor you have to pick have many of each prime factor you want to include 2012-01-07T08:40:47 maybe if you stored the first 500 primes or something 2012-01-07T08:41:05 my python code runs in less than a second including factoring and has nothing precomputed 2012-01-07T08:41:13 ok 2012-01-07T08:41:17 so it is faster :P 2012-01-07T08:41:57 lol in the irish rankings 2012-01-07T08:42:04 1=325+ solved 2012-01-07T08:42:10 2=174 solved 2012-01-07T08:42:11 lol 2012-01-07T08:42:33 :) 2012-01-07T08:43:04 my solution http://codepad.org/afpAEVEd 2012-01-07T08:43:10 i figured out the problem 2012-01-07T08:43:16 i have several folders 2012-01-07T08:43:27 for storing pe problems, for haskel, cpp, lisp 2012-01-07T08:43:35 and i did it in cl 2012-01-07T08:43:49 and i was checking the c++ version, and i didnt write that one :) 2012-01-07T08:43:52 hmm 2012-01-07T08:44:01 * conor_f wonders which problem to do next 2012-01-07T08:44:22 *** UncleVasya has joined #aichallenge 2012-01-07T08:44:36 it has a prime factorization in there thats why its so lomg 2012-01-07T08:44:38 conor_f: mcstar's code uses the prime decomposition 2012-01-07T08:45:03 I wouldn't know, functional languages are ridiculous 2012-01-07T08:45:05 *to me 2012-01-07T08:45:18 :) 2012-01-07T08:45:34 that code is fully imperative imho 2012-01-07T08:45:40 I don't understand much of it either.... just looking at "n-of-divs (1+ v)" 2012-01-07T08:47:04 well... I understand it by virtue of the fact that I know what it is computing :P 2012-01-07T08:47:59 http://codepad.org/hQPbP8vi 2012-01-07T08:48:07 mcstar: recursion ^^ :) 2012-01-07T08:48:22 I'm learning 2012-01-07T08:49:07 definitely 2012-01-07T08:49:22 just use 2 spaces instead of 8, pls 2012-01-07T08:49:33 haha 2012-01-07T08:49:39 I would switch to 4 or 6 2012-01-07T08:49:47 but why does it matter to you? :P 2012-01-07T08:50:01 formatting matters 2012-01-07T08:50:06 isn't it obvious what belongs where lol 2012-01-07T08:50:10 and it's consistent 2012-01-07T08:50:10 my eye needs to travel too much 2012-01-07T08:50:15 sigh: opinions? :P 2012-01-07T08:50:35 I use 2 or 4 2012-01-07T08:50:45 At work I have to use 2 2012-01-07T08:50:50 why? 2012-01-07T08:50:54 2 sounds awful... 2012-01-07T08:50:58 I used to use 4 at home... but now I'm getting used to 2 2012-01-07T08:51:27 * antimatroid1 uses 4 2012-01-07T08:51:39 conor_f: do you need to copy the triangle vector-vector every time? 2012-01-07T08:51:43 sigh: how is work? ruling it like you own the place yet? 2012-01-07T08:51:52 i got phd funding for at utas :) 2012-01-07T08:52:14 antimatroid1: going pretty well... I'm actually starting to be productive so that's good :P 2012-01-07T08:52:16 mcstar: yeah, I could just make it a global vector and just edit the same one but meh 2012-01-07T08:52:25 antimatroid1: well done :) 2012-01-07T08:52:26 conor_f: no 2012-01-07T08:52:28 damn 2012-01-07T08:52:32 ? 2012-01-07T08:52:33 use pointers or references 2012-01-07T08:52:42 * conor_f gets sick 2012-01-07T08:52:50 pointer to a 2d vector 2012-01-07T08:53:01 my brain would shrivel up and die.... 2012-01-07T08:53:07 why? 2012-01-07T08:53:14 reference would be ok I suppose 2012-01-07T08:53:17 abstract all the things 2012-01-07T08:53:24 you can use a reference too... minimal code change: vector >& triangle 2012-01-07T08:53:31 but you should try to get used to pointers 2012-01-07T08:53:36 antimatroid1: bad experience with C and passing 2d arrays to functions 2012-01-07T08:53:43 it's not a hard concept, but it's important 2012-01-07T08:53:50 yeah 2012-01-07T08:53:59 I understand them, just don't like using them 2012-01-07T08:54:01 you dont understand c if you dont understand pointers 2012-01-07T08:54:17 memory management, thats what c is 2012-01-07T08:54:21 nothing more 2012-01-07T08:54:34 c++ adds some typechecks over that, thats all 2012-01-07T08:54:58 mcstar: I do understand pointers mostly 2012-01-07T08:55:03 I just don't like them at all 2012-01-07T08:55:13 then start using them instead of thinking in globals 2012-01-07T08:56:16 yeah, suppose 2012-01-07T08:56:24 I really do see the time boost too 2012-01-07T08:56:43 0.015s down to 0.006s by using references 2012-01-07T08:56:45 and memory use shrinks too 2012-01-07T08:57:02 by a huge amount considering its recursive 2012-01-07T08:57:10 it becomes much more important in the longer running problems 2012-01-07T08:57:10 you are using the stack to allocate the arguments 2012-01-07T08:57:11 lol, it took AGES but my brute force 12 worked 2012-01-07T08:57:18 so you run ot of stack space much earlier 2012-01-07T08:57:22 how long is ages? 2012-01-07T08:57:31 570s :P 2012-01-07T08:57:46 :P 2012-01-07T08:57:47 antimatroid1: do you know how to compute the number of divisors from the prime factorisation? 2012-01-07T08:58:00 i saw it and will look now 2012-01-07T08:58:10 i just let what i programmed up quickly run to see what'd happen 2012-01-07T08:58:11 antimatroid1: you can just find divisors up to its square root and multiply it by 2? 2012-01-07T08:58:15 antimatroid1: you should be able to prove that result yourself :P 2012-01-07T08:58:15 I hope you did that :P 2012-01-07T08:58:35 a^n-1 * b^n-1 ... 2012-01-07T08:58:39 conor_f: yeah didn't notice until after it started running 2012-01-07T08:58:41 and just left it 2012-01-07T08:58:44 heh 2012-01-07T08:58:46 sigh's way is the right way anyway 2012-01-07T08:58:54 that would knock a decent chunk off ;) 2012-01-07T08:59:01 but yeah, sigh is right I imagine 2012-01-07T08:59:27 http://projecteuler.net/problem=21 2012-01-07T09:00:15 create a class and in it store the number, and the sum of its divisors 2012-01-07T09:00:33 and then check if they're amicable? 2012-01-07T09:00:46 or does that sound like a horrible way to do things 2012-01-07T09:00:47 class seems like overkill 2012-01-07T09:00:52 yeah 2012-01-07T09:00:54 but sounds about right 2012-01-07T09:00:55 struct :P 2012-01-07T09:01:19 don't need that 2012-01-07T09:01:25 just store it in a map 2012-01-07T09:01:35 or an array 2012-01-07T09:01:43 sorry, map 2012-01-07T09:02:14 * conor_f shudders 2012-01-07T09:02:20 maps are really easy 2012-01-07T09:02:27 amic[n_] := With[{tmp = Total@Most@Divisors@n},If[tmp != n, If[Total@Most@Divisors@tmp == n, n, 0], 0]] 2012-01-07T09:02:28 Total@Table[amic[i], {i, 2, 9999}] 2012-01-07T09:02:33 nuh-uh antimatroid1 2012-01-07T09:02:40 I tried using them with ants 2012-01-07T09:02:45 #include ... map myMap; myMap[2] = 3; etc. 2012-01-07T09:03:00 hmm 2012-01-07T09:03:09 oh miread the problem... an array or vector should be enough 2012-01-07T09:03:13 it sounds simple but my experience is yelling no :P 2012-01-07T09:03:14 *misread 2012-01-07T09:03:14 yeah 2012-01-07T09:03:25 just think of it like map f then it's like f:X->Y where you do f[x] 2012-01-07T09:03:32 a simple int array[1000][2] would do it 2012-01-07T09:03:51 still too complicated :P 2012-01-07T09:03:58 i like that 2012-01-07T09:04:03 not needed for this problem 2012-01-07T09:04:07 but in general i like that syntax 2012-01-07T09:04:17 conor_f: what are you storing in there? 2012-01-07T09:04:24 antimatroid1: I never thought of it that way 2012-01-07T09:04:36 sigh: the root number and the sum of it's divisors 2012-01-07T09:04:57 and 0 if the number of divisors is > 10000 or something 2012-01-07T09:05:00 and using that, how will you find an amicable pair? 2012-01-07T09:05:26 search through it all ;) 2012-01-07T09:05:27 lol 2012-01-07T09:05:50 why is there no data type like perl hashes in C++? :@ 2012-01-07T09:06:09 like if you know that d(220) = 284 - like in the example - how will you check that it is a valdi pair? 2012-01-07T09:06:16 map is close enough conor_f 2012-01-07T09:06:20 to a perl hash 2012-01-07T09:06:30 not close enough :P 2012-01-07T09:06:46 1 for loop should do it 2012-01-07T09:06:48 what is missing? auto-vivification? :P 2012-01-07T09:06:59 loop over all the values? 2012-01-07T09:07:05 yeah 2012-01-07T09:07:09 iterators 2012-01-07T09:07:15 for the later 2012-01-07T09:07:25 oh 2012-01-07T09:07:36 no, I thought I had a good idea :P 2012-01-07T09:07:40 I don't though 2012-01-07T09:07:45 conor_f: wouldn't it be much easier if you could look up the value of d(284) without looping over everything? 2012-01-07T09:08:01 yes, it sure would 2012-01-07T09:08:07 like a hash in perl :P 2012-01-07T09:08:22 search for key/value simply 2012-01-07T09:08:30 yup, a map will do that too :) 2012-01-07T09:08:38 but here... you can do that with an array 2012-01-07T09:08:58 just use int array[1001] 2012-01-07T09:09:15 then the index into the array can be the number you are searching for 2012-01-07T09:09:22 is it easy to initialise an array to a constant value? 2012-01-07T09:09:41 i've always just found vectors easier, like vector prime(10000, 1); 2012-01-07T09:09:43 antimatroid1: yes 2012-01-07T09:09:54 array[x] = {0} 2012-01-07T09:09:57 *; 2012-01-07T09:10:07 or vector >(200, vector(200, 0)); etc. 2012-01-07T09:10:08 sigh: >_< 2012-01-07T09:10:10 yes 2012-01-07T09:10:26 antimatroid1: interchange vector and array as appropriate in my explanations... I'm not really worring about the details here :P 2012-01-07T09:10:26 thats what I meant :P 2012-01-07T09:10:42 i was asking for my own sake 2012-01-07T09:10:58 I g2g now 2012-01-07T09:11:01 ty sigh 2012-01-07T09:11:02 ttyl 2012-01-07T09:11:07 cya 2012-01-07T09:11:09 like can you do bool thing[200][200]; initialised to 1 somehow? 2012-01-07T09:12:09 antimatroid1: hmmm... not sure 2012-01-07T09:12:51 i pretty much abuse the hell out of vectors because i can initialise them to any constant value in one line for any number of dimensions 2012-01-07T09:13:10 yeah 2012-01-07T09:15:44 for(int i=0; i<200; i++) for(int j=0; j<200; j++) thing[i][j]=true; 2012-01-07T09:16:40 #30 solved 2012-01-07T09:18:00 btw, on a sidenote, contructors are typically used for initialization 2012-01-07T09:18:19 so its a moot argument saying in a fully oo language you "cant" initialize something 2012-01-07T09:18:52 by that argument c++ isn't "fully oo" :P 2012-01-07T09:19:27 why? 2012-01-07T09:19:42 arrays come from C 2012-01-07T09:20:17 just write a damn wrapper around them , make your class and be happy with it 2012-01-07T09:20:23 or use the c++ array class 2012-01-07T09:20:26 haha 2012-01-07T09:20:27 or whatever 2012-01-07T09:20:45 that's why antimatroid1 was using vector :) 2012-01-07T09:21:06 but a vector of vectors is lame in my eyes 2012-01-07T09:21:11 why? 2012-01-07T09:21:20 id only use that if the length of rows are not the same 2012-01-07T09:21:29 or i dont have time to use something else 2012-01-07T09:21:41 i'm a lazy typist 2012-01-07T09:21:49 and like minimal lines 2012-01-07T09:22:18 antimatroid1: http://en.cppreference.com/w/cpp/container/array 2012-01-07T09:22:24 it has a fill funtion 2012-01-07T09:22:55 that's 2 lines 2012-01-07T09:23:07 thats why i said do your 2d array 2012-01-07T09:23:12 you only need to write it once 2012-01-07T09:23:22 i did one for Ants 2012-01-07T09:23:40 meh, vector <3 2012-01-07T09:24:15 oh 2012-01-07T09:24:40 im sure you can concoct some kind of macro do initilize an array(and define it) 2012-01-07T09:24:55 to* 2012-01-07T09:25:02 memset(my_array, 1, sizeof(my_array))? 2012-01-07T09:25:06 *** sigh has quit IRC (*.net *.split) 2012-01-07T09:25:07 *** mayanks43 has quit IRC (*.net *.split) 2012-01-07T09:25:07 *** cYmen has quit IRC (*.net *.split) 2012-01-07T09:25:07 *** rb__ has quit IRC (*.net *.split) 2012-01-07T09:25:07 *** hkraal_ has quit IRC (*.net *.split) 2012-01-07T09:25:07 *** greghaynes has quit IRC (*.net *.split) 2012-01-07T09:25:10 no 2012-01-07T09:25:19 you cant memset a 2d static array 2012-01-07T09:25:30 only while looping over 1 dimension 2012-01-07T09:25:32 and that sucks 2012-01-07T09:25:42 *** sigh has joined #aichallenge 2012-01-07T09:25:43 *** mayanks43 has joined #aichallenge 2012-01-07T09:25:43 *** cYmen has joined #aichallenge 2012-01-07T09:25:43 *** rb__ has joined #aichallenge 2012-01-07T09:25:43 *** hkraal_ has joined #aichallenge 2012-01-07T09:25:43 *** greghaynes has joined #aichallenge 2012-01-07T09:29:10 *** sigh has quit IRC (Remote host closed the connection) 2012-01-07T09:35:02 antimatroid1: http://codepad.org/1WgAOYCr 2012-01-07T09:35:53 this is better http://codepad.org/3lolmUxv 2012-01-07T09:36:05 (the first one doesnt really demonstrate it :) 2012-01-07T09:36:19 *** grwip has joined #aichallenge 2012-01-07T09:36:48 what happened to type between array2d(...) and name[rows][cols];? 2012-01-07T09:37:56 *** dorisabayon has joined #aichallenge 2012-01-07T09:38:25 also, is there arraynd? 2012-01-07T09:38:49 i think i had some 4d vectors in pw 2012-01-07T09:39:08 antimatroid1: i dont understand your 1st question 2012-01-07T09:39:34 #define array2d(type, name, rows, cols, init) **type** name[rows][cols]; 2012-01-07T09:39:39 array2d(bool, boolAr, 10, 10, true) **** boolAr[0][0]=false; 2012-01-07T09:39:52 oh 2012-01-07T09:39:53 nm 2012-01-07T09:40:01 it's late :P 2012-01-07T09:40:13 ok :) 2012-01-07T09:40:28 you can have arraynd if you write it 2012-01-07T09:40:35 for n=3,4,5, ... 2012-01-07T09:40:47 a general one, im not sure if possible with macros 2012-01-07T09:40:50 maybe it is 2012-01-07T09:41:13 with some kind of clever recursive text substitution 2012-01-07T09:41:30 the proper solution ofc would be to use some templated class 2012-01-07T09:41:31 *** Fandekasp has quit IRC (Ping timeout: 276 seconds) 2012-01-07T09:41:44 templated in type and in dimension 2012-01-07T09:41:52 sorry, rank 2012-01-07T09:44:53 *** UncleVasya has quit IRC (Read error: Connection reset by peer) 2012-01-07T10:19:12 *** saint_ has joined #aichallenge 2012-01-07T10:19:38 *** saint_ is now known as Guest59223 2012-01-07T10:40:50 *** alehorst has quit IRC (Remote host closed the connection) 2012-01-07T10:54:33 *** u_ has joined #aichallenge 2012-01-07T11:08:18 *** epicmonkey has quit IRC (Ping timeout: 268 seconds) 2012-01-07T11:23:02 *** CowTipperVirus has joined #aichallenge 2012-01-07T11:24:57 @janzert: Thanks for the debugging tip, but do you have a few minutes to chat? I don't see that output when logged in 2012-01-07T11:24:58 CowTipperVirus: No! 2012-01-07T11:25:06 janzert: Thanks for the debugging tip, but do you have a few minutes to chat? I don't see that output when logged in 2012-01-07T11:25:40 way too long since I've used IRC... 2012-01-07T11:27:15 *** Blkt` has joined #aichallenge 2012-01-07T11:29:17 *** Blkt has quit IRC (Ping timeout: 252 seconds) 2012-01-07T11:51:36 *** Blkt`` has joined #aichallenge 2012-01-07T11:51:39 *** choas has quit IRC (Ping timeout: 252 seconds) 2012-01-07T11:54:14 *** Blkt` has quit IRC (Ping timeout: 255 seconds) 2012-01-07T12:04:14 *** Garf has joined #aichallenge 2012-01-07T12:06:20 *** CowTipperVirus has quit IRC (Quit: Page closed) 2012-01-07T12:18:27 done 21 :) 2012-01-07T12:18:49 31? 2012-01-07T12:18:55 no, 21 :P 2012-01-07T12:19:22 i mean try that now 2012-01-07T12:20:09 oh 2012-01-07T12:20:11 ok 2012-01-07T12:20:15 let me see first 2012-01-07T12:20:48 oh 2012-01-07T12:20:51 this is just math 2012-01-07T12:20:56 I think.... 2012-01-07T12:21:22 bleh, brute force :p 2012-01-07T12:22:18 my first approach took 17minutes 2012-01-07T12:22:23 the next one 200ms 2012-01-07T12:22:37 lol 2012-01-07T12:22:40 basically, i wrote the second one while the first one run 2012-01-07T12:22:47 brute force vs. smart way? 2012-01-07T12:22:54 i recommend that for you, because i want to show my solutiojn 2012-01-07T12:22:59 yes 2012-01-07T12:23:06 kk 2012-01-07T12:23:14 it is very short, and has a fine recursion in it 2012-01-07T12:23:21 but you WILL understand 2012-01-07T12:23:32 let me try to do it first :) 2012-01-07T12:23:35 yes 2012-01-07T12:31:47 *** kire has joined #aichallenge 2012-01-07T12:33:22 mcstar: 2012-01-07T12:33:32 ? 2012-01-07T12:33:37 since you know the smart way, how many different ways can you make 10p? 2012-01-07T12:34:57 11 2012-01-07T12:35:04 ty 2012-01-07T12:35:05 1,2,5,10 2012-01-07T12:35:16 ? 2012-01-07T12:35:20 from those coins 2012-01-07T12:35:25 oh, yes 2012-01-07T12:35:35 you can't make 10p from 20p ;) 2012-01-07T12:36:12 :/ 2012-01-07T12:36:17 how many? 2012-01-07T12:36:24 thought it had something to do with pascals triangle 2012-01-07T12:36:31 I'm wrong though, back to recursion 2012-01-07T12:38:05 *** Fandekasp has joined #aichallenge 2012-01-07T12:41:13 *** dorisabayon has quit IRC (Ping timeout: 244 seconds) 2012-01-07T12:43:03 mcstar: does it have something to do with pascals triangle? 2012-01-07T12:43:33 i dont know if theres a closed formula 2012-01-07T12:43:49 oh 2012-01-07T12:43:54 so, no i dont use pascals triangle 2012-01-07T12:44:01 or any other "named" things 2012-01-07T12:44:02 kk 2012-01-07T12:44:11 I just noticed 2012-01-07T12:44:16 1p = 1 way 2012-01-07T12:44:19 2 = 2 2012-01-07T12:44:20 3 = 2 2012-01-07T12:44:38 4=3 2012-01-07T12:44:41 5=4 2012-01-07T12:44:51 6=10 (I think :P) 2012-01-07T12:44:54 these equations dont hold 2012-01-07T12:45:06 and that follows down along the triangle 2012-01-07T12:45:21 not in a straight line, but in a zig-zag lol 2012-01-07T12:46:05 either way, I know theres a way you can do it smartly by working upwards instead of downwards 2012-01-07T12:46:26 (instead of recursion where you take away from 200) 2012-01-07T12:46:43 you should be able to go up in a sequence I imagine.... 2012-01-07T12:46:46 [1,2,2,3,4,5,6,7,8,11,12,15,16,19,22,25,28,31,34,41,44,51,54,61,68,75,82,89,96,109,116,129,136,149,162,175,188,201,214,236,249,271,284,306,328,350,372,394,416,451,473,508,530,565,600,635,670,705,740,793,828,881,916,969,1022,1075,1128,1181,1234,1311,1364,1 2012-01-07T12:47:15 1364,1441,1494,1571,1648,1725,1802,1879,1956,2064,2141,2249,2326,2434,2542,2650,2758,2866,2974,3121,3229,3376,3484,3631,3778,3925,4072,4219,4366,4563] 2012-01-07T12:47:35 for amounts from 1 to 100 2012-01-07T12:49:23 conor_f: i dont see a correspondence to pascals triangle 2012-01-07T12:49:26 bleh, brute force will probably be easier 2012-01-07T12:49:31 mcstar: I don't either now :( 2012-01-07T12:51:23 I might have the recursive way done 2012-01-07T12:51:30 but this will take ages.... 2012-01-07T12:52:11 *** Redgis has joined #aichallenge 2012-01-07T12:52:14 I even changed the formatting, just for you :P 2012-01-07T12:53:32 no, its wrong 2012-01-07T12:53:38 wow, its amazingly wrong :O 2012-01-07T12:54:28 saying 10 is 129 o.O 2012-01-07T12:55:06 >_< 2012-01-07T12:55:31 This code will get every permutation, like nPr instead of nCr 2012-01-07T12:55:59 like 1, 1, 2; 2, 1, 1 and 1, 2, 1 2012-01-07T12:56:03 yeah, youve got to sort them out 2012-01-07T12:56:06 when it should only get one of them :( 2012-01-07T12:56:15 youre close though 2012-01-07T13:00:53 I have nfi how to do this part.... 2012-01-07T13:01:32 http://codepad.org/6iiiiN2W 2012-01-07T13:01:36 thats what I've got 2012-01-07T13:02:41 coins[8] 2012-01-07T13:02:46 you dont need the 8 there 2012-01-07T13:02:49 XD 2012-01-07T13:02:52 :p 2012-01-07T13:03:01 C style to leave it out though ;) 2012-01-07T13:03:35 no 2012-01-07T13:06:15 :( 2012-01-07T13:06:20 I thought I had this one 2012-01-07T13:08:31 *** bugnuts has quit IRC (Quit: Leaving) 2012-01-07T13:09:42 conor_f: http://codepad.org/Lu2WqE1m 2012-01-07T13:10:32 thats basically the translation of my haskell code 2012-01-07T13:11:28 I don't understand tbh.... 2012-01-07T13:11:36 this is the brute force one? 2012-01-07T13:11:55 I think it's the 'i' thats confusing me.... 2012-01-07T13:12:18 this is not the brute force 2012-01-07T13:12:35 so the i is very important 2012-01-07T13:12:38 the brute force is the loop over every count of all the coints, and testing for 200 2012-01-07T13:12:45 *** Fandekasp has quit IRC (Ping timeout: 252 seconds) 2012-01-07T13:13:41 this one seems to just check the coins i and i+1 2012-01-07T13:13:42 not just the i is important there 2012-01-07T13:13:46 instead of all of them 2012-01-07T13:13:50 i do a different pattern of recursion 2012-01-07T13:13:56 yeah 2012-01-07T13:15:14 conor_f: http://codepad.org/Z2gzfC1H maybe this is clearer 2012-01-07T13:15:34 :P 2012-01-07T13:15:37 interesting though, optimized versions run in 150ms for c++ and 200ms for haskell 2012-01-07T13:15:39 very close 2012-01-07T13:16:01 *** Israfel has quit IRC (Ping timeout: 276 seconds) 2012-01-07T13:16:34 conor_f: i really mean that its clearer, i dont exaggerate 2012-01-07T13:16:35 so why does it work? 2012-01-07T13:16:42 the pattern is clearer than in the c verison 2012-01-07T13:17:09 solve 0 _ = 1 2012-01-07T13:17:22 obviously if the sum is 0, you have a solution 2012-01-07T13:17:32 thats 1 in the recursive sum 2012-01-07T13:17:37 solve _ [] = 0 2012-01-07T13:17:54 if there are no more coins, and the sum didnt reach 0, you have to get back with 0 2012-01-07T13:17:58 i.e. no solution 2012-01-07T13:18:02 clear? 2012-01-07T13:18:26 no 2012-01-07T13:18:29 in the haskell version, i take the list apart, which holds the coins 2012-01-07T13:18:30 well 2012-01-07T13:18:32 sort of 2012-01-07T13:18:37 its like the i index in c++ 2012-01-07T13:18:41 still annoyed I couldn't do it :@ 2012-01-07T13:18:56 solve s coins@(c:cs) = if (s-c)<0 then solve s cs else (solve (s-c) coins) + (solve s cs) 2012-01-07T13:19:04 this is the general case 2012-01-07T13:19:11 (s-c)<0 2012-01-07T13:19:23 this means, you are subtracting the current coin from the sum 2012-01-07T13:19:31 and since if this is <0, you dont want it 2012-01-07T13:19:37 -if 2012-01-07T13:19:51 so you call solve, with the SAME amount, as before 2012-01-07T13:20:05 but, you took the "wrong" coin off the list 2012-01-07T13:20:19 if s-c not < 0 2012-01-07T13:20:19 yeah 2012-01-07T13:20:20 bleh 2012-01-07T13:20:27 you call the sum of 2 recursive calls 2012-01-07T13:20:46 in the first you go with the same coin, and subtract its value from the sum 2012-01-07T13:21:00 in the other you go with the other coins, and dont subtract from the sum 2012-01-07T13:21:20 :( 2012-01-07T13:21:21 (it will subtract, when it is run, in the first part of the same sum) 2012-01-07T13:21:27 I should have gotten this one 2012-01-07T13:22:28 well, try again 2012-01-07T13:22:40 yeah 2012-01-07T13:22:43 I am 2012-01-07T13:22:46 wait a couple of years(months) and once you have forgotten the solution, try again 2012-01-07T13:23:05 :P 2012-01-07T13:23:18 *** epicmonkey has joined #aichallenge 2012-01-07T13:23:26 my recursive skills are getting better though :P 2012-01-07T13:24:13 mine as well 2012-01-07T13:24:24 these problems help a lot 2012-01-07T13:24:29 yeah 2012-01-07T13:24:41 I should be sorted for the programming olympiad lol :) 2012-01-07T13:29:16 *** Israfel has joined #aichallenge 2012-01-07T13:32:01 *** Redgis has quit IRC (Quit: ... mains libres) 2012-01-07T13:32:24 *** Redgis has joined #aichallenge 2012-01-07T13:33:37 *** Guest59223 has quit IRC (Ping timeout: 258 seconds) 2012-01-07T13:38:13 mcstar: in the forum for 31 2012-01-07T13:38:19 look at exomos code on page 1 2012-01-07T13:38:52 yes? 2012-01-07T13:39:41 that loop is not necessary 2012-01-07T13:39:56 thats why we do recursion 2012-01-07T13:40:07 *** mleise has joined #aichallenge 2012-01-07T13:40:13 we're hardcore :P 2012-01-07T13:40:18 its nice code though 2012-01-07T13:40:26 no 2012-01-07T13:40:35 what i wrote in c++ for you is nicer 2012-01-07T13:40:42 ofc the haskell is the best 2012-01-07T13:40:56 I found an interesting new GPL file compressor called PAQ 2012-01-07T13:41:11 conor_f: page 8, br3ndanf in f# 2012-01-07T13:41:11 oh? 2012-01-07T13:41:20 that code is basically the same as my haskell one 2012-01-07T13:41:22 no, I will cry 2012-01-07T13:41:24 Especially the PAQ8 series is extremely slow and has a high compression ratio. 2012-01-07T13:41:37 F#, J, K, et al 2012-01-07T13:41:42 *shudder* 2012-01-07T13:42:03 mcstar: I might get to level 1 by tonight :) 2012-01-07T13:42:21 anyway, you seem like you didnt read my pasted c++ code 2012-01-07T13:42:33 although I promised myself I'd go to bed before 00:00 so I will get back in the rhythm for school 2012-01-07T13:42:39 mcstar: I did.... 2012-01-07T13:42:46 oh, joke :P 2012-01-07T13:42:47 i mean why does exomo loop, if he used also recursion? 2012-01-07T13:42:47 get it 2012-01-07T13:42:58 and you say his solution is nice? 2012-01-07T13:43:03 im offended 2012-01-07T13:43:25 conor_f: yes, dont stay awake so long in the night 2012-01-07T13:43:33 its a VERY bad habit 2012-01-07T13:43:44 (i suffer from it) 2012-01-07T13:44:01 (i mean, i suffer from that i cant go to sleep early) 2012-01-07T13:44:07 I've been awake until after 02:00 for the last 2 weeks 2012-01-07T13:44:16 I'm actually becoming nocturnal... 2012-01-07T13:44:27 change while you can 2012-01-07T13:44:34 now school starts again on monday and that means getting up 4 hours earlier then normally 2012-01-07T13:45:03 FP8 is a somewhat sped-up version of PAQ8 that can compress with 2MB/minute! amazing, ain't it? 2012-01-07T13:45:30 mcstar: I said his code was nice because it blended what me and you were doing together 2012-01-07T13:45:38 *** epicmonkey has quit IRC (Ping timeout: 240 seconds) 2012-01-07T13:45:44 I don't see why theres anything wrong with recursion and loops.... 2012-01-07T13:46:11 ok, its probably your parents' fault, not yours 2012-01-07T13:46:11 except for the fact it makes memory usage skyrocket 2012-01-07T13:46:24 ?? 2012-01-07T13:46:41 *** mceier has joined #aichallenge 2012-01-07T13:48:00 mcstar: Hungary is big in the news recently, what's up there with the ruling party? 2012-01-07T13:48:17 i dont care much for politics 2012-01-07T13:48:48 if i wanted to know, id be reading some foreign paper or somehting 2012-01-07T13:48:53 probably i should btw 2012-01-07T13:49:11 mleise: i think youre are more up to date than me 2012-01-07T13:49:52 lol, it looks like some government members slip into a new nationalism. thats bad especially in the context of the eu 2012-01-07T13:51:27 conor_f: dont take that too seriously, i just think it isnt nice to combine the 2 approaches 2012-01-07T13:51:36 but I guess, you are not completely ignorant when you would prefer foreign news papers ;) 2012-01-07T13:51:58 conor_f: but, there are some horrible codes on the forum, so that one was among the nicests 2012-01-07T13:53:10 btw can someone teach me advanced combinatorics? 2012-01-07T13:53:12 mleise: i wonder how other nations view this little political shithole of ours 2012-01-07T13:53:32 and they probably takes sides with reason, not because of prejudice 2012-01-07T13:53:38 (if and when they do) 2012-01-07T13:54:22 count (c:cs) s = sum $ map (count cs . (s-)) [0,c..s] 2012-01-07T13:54:36 mvz's solution, 4 times faster than mine 2012-01-07T13:57:13 mcstar: which one is that for? 2012-01-07T13:57:23 31 2012-01-07T13:57:39 i dont map, i instead recurse too 2012-01-07T13:58:21 oh, I made a n_partitions function 2012-01-07T13:58:25 because there are a bunch of those 2012-01-07T13:58:37 you can do it with dynamic programming 2012-01-07T13:58:55 took me a while to get it fast enough for one of the later ones though 2012-01-07T13:59:33 i still dont get why people say DP DP DP 2012-01-07T13:59:48 go and buy a pron flick and you get DP 2012-01-07T13:59:57 lol 2012-01-07T14:00:19 well, you keep the results from the last calculation in an array and just move closer to what you actually want 2012-01-07T14:00:33 sec, I did it in Go 2012-01-07T14:00:39 have to port it to C++ 2012-01-07T14:00:44 why? 2012-01-07T14:00:55 you broke your go compiler? 2012-01-07T14:01:08 I uninstalled it :P 2012-01-07T14:01:32 thestinger: im happy with this http://codepad.org/Z2gzfC1H 2012-01-07T14:01:51 how fast is it? 2012-01-07T14:01:56 200ms 2012-01-07T14:02:28 oh, I actually have a C version 2012-01-07T14:03:31 *** MettaWorldPeace_ has quit IRC (Ping timeout: 258 seconds) 2012-01-07T14:03:45 lol, i like the mathematica solutions with reduce 2012-01-07T14:05:08 meh, euler won't load for me now 2012-01-07T14:05:29 use wayback machine 2012-01-07T14:06:54 mcstar: ./solution 0.00s user 0.00s system 0% cpu 0.002 total 2012-01-07T14:07:17 anyway... can't check euler atm but hopefully this is getting the right answer 2012-01-07T14:07:20 you broke time too 2012-01-07T14:07:38 /usr/bin/time 2012-01-07T14:07:49 well, that's zsh time 2012-01-07T14:07:54 which time 2012-01-07T14:07:56 /opt/plan9/bin/time 2012-01-07T14:07:58 lol 2012-01-07T14:08:09 0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 508maxresident)k 2012-01-07T14:08:14 o_o 2012-01-07T14:08:26 anyway, it's ugly C and not generic C++ 2012-01-07T14:08:33 not sure why, but I guess I was learning C at the time 2012-01-07T14:08:52 http://sprunge.us/bKCX 2012-01-07T14:12:25 that emulates the recursive pattern wo function calls 2012-01-07T14:12:43 yeah 2012-01-07T14:13:23 iirc, there are a few more partition problems 2012-01-07T14:13:29 I made this because it needed to be a lot faster 2012-01-07T14:13:47 not sure if I ended up actually doing the other problems, I don't think so 2012-01-07T14:14:28 i should make some kind of collection of these useful snippets myself 2012-01-07T14:15:07 yeah, I started putting them in a C++ header 2012-01-07T14:15:13 need to make this generic and I'll stick it in there too 2012-01-07T14:18:35 might as well leave the calloc/free 2012-01-07T14:20:11 my problem is that i used 5 different languages for these problems so far 2012-01-07T14:20:32 I used python for almost all of them, C++ for some and haskell for a few 2012-01-07T14:20:48 c++,cl,haskell,mathematica,python 2012-01-07T14:20:54 when I was doing it before I ended up doing some in C and Go though 2012-01-07T14:23:20 antimatroid1: you around? 2012-01-07T14:26:00 klingon women have great titties http://imgur.com/LncVc 2012-01-07T14:29:14 mcstar: which method are you using to get factors/divisors? 2012-01-07T14:29:17 from the prime factors? 2012-01-07T14:29:29 or fermat's factorization method, etc. 2012-01-07T14:29:55 there are a few questions which I could solve if I could only factor a bit faster... 2012-01-07T14:30:01 maybe python is a bad choice for those 2012-01-07T14:30:13 when i factored i factored by sieve 2012-01-07T14:30:20 if thats why you ask 2012-01-07T14:30:23 what* 2012-01-07T14:30:49 and it is supposed to fast afaik for small numebrs 2012-01-07T14:31:01 or 2012-01-07T14:31:03 or 2012-01-07T14:31:20 theres some method i that is "probabilisitc" 2012-01-07T14:31:25 i dont recall its name 2012-01-07T14:31:34 but it has a minimal chance of being wrong 2012-01-07T14:32:03 probably i should program that 2012-01-07T14:32:19 ive found some haskell module that uses it 2012-01-07T14:32:45 rabin-miller? 2012-01-07T14:33:02 https://en.wikipedia.org/wiki/Miller–Rabin_primality_test 2012-01-07T14:33:17 Ah... I think what I need for my card game is called "hypergeometric distribution" 2012-01-07T14:33:24 I think you can just run it enough times that the chance it will be wrong is lower than the chance that your memory will be corrupted by a solar flare :P 2012-01-07T14:35:20 http://paste.pocoo.org/show/BFzIGcq64BQl9GTmrOef/ I was just getting prime factors like that 2012-01-07T14:35:25 and then getting the factors from it 2012-01-07T14:35:27 but it's too slow 2012-01-07T14:36:43 even in C++ :( 2012-01-07T14:36:49 thats mine http://codepad.org/jWZ2vp8k 2012-01-07T14:37:43 it was fast up to 2^1[1-2]0-1 2012-01-07T14:37:55 or some like that, i was some time ago 2012-01-07T14:37:58 it* 2012-01-07T14:38:29 well, maybe my problem is the prime factors -> divisors part 2012-01-07T14:38:58 I should make my sieve an array.array in python or use numpy, but it's fast 2012-01-07T14:39:46 thestinger: found this site yesterday, itll improve my haskell i think http://www.polyomino.f2s.com/david/haskell/codeindex.html 2012-01-07T14:40:15 *** choas has joined #aichallenge 2012-01-07T14:40:24 heh, I had that bookmarked 2012-01-07T14:40:49 don't remember it though 2012-01-07T14:40:53 "I was just getting prime factors like that and then getting the factors from it" ??? You cannot factorize primes -. 2012-01-07T14:41:20 well, you can get the divisors of a number from the prime factors 2012-01-07T14:41:50 mleise: youre misunderstanding what he said 2012-01-07T14:41:52 there are obviously better ways than what I was doing 2012-01-07T14:41:58 of course you cant factorize prime numbers 2012-01-07T14:42:06 but you factorize numbers with them 2012-01-07T14:42:29 oh right, that's what you need to hack WPA2 2012-01-07T14:42:38 factors = {product(s) for s in powerset(factorize(i, candidates)) if s} 2012-01-07T14:42:41 well, I tried that 2012-01-07T14:42:51 by "factors" there I mean divisors 2012-01-07T14:43:18 factorize is fast as hell now, but that definitely isn't 2012-01-07T14:45:17 Parse error: syntax error, unexpected ';' in /home/admin/domains/projecteuler.net/public_html/static/problems_table_id.php on line 2 2012-01-07T14:45:19 ugh... 2012-01-07T14:46:44 thx for the directory structure 2012-01-07T14:46:49 * mleise starts hacking 2012-01-07T14:46:56 *** jcdjcd has joined #aichallenge 2012-01-07T14:48:25 mcstar: is the projecteuler.net site broken for you too? 2012-01-07T14:48:57 it is for me 2012-01-07T14:49:01 thestinger: for me too 2012-01-07T14:49:05 not no 2012-01-07T14:49:08 w 2012-01-07T14:49:18 mcstar: the problems/progress pages? 2012-01-07T14:49:37 same error 2012-01-07T14:51:27 I made a pdf of all the problem descriptions this morning so I could read them on my ipad if thats useful to anyone. 2012-01-07T14:52:20 i dont have an ipad 2012-01-07T14:52:53 I assume you have some sort of pdf reader. it's just a plain pdf. 2012-01-07T14:55:01 jk 2012-01-07T14:55:24 but yeah, pls send it to me 2012-01-07T14:55:31 dcc? 2012-01-07T14:57:41 one sec will put it up somewhere 2012-01-07T15:00:00 tsk tsk, someone's editing live code without testing 2012-01-07T15:01:27 *** X-Scale has joined #aichallenge 2012-01-07T15:02:47 here you go http://jcdny.github.com/goeuler/ProjectEuler.pdf 2012-01-07T15:03:47 It does not have the new one though. 2012-01-07T15:04:08 one for every day of the year 2012-01-07T15:04:18 thx 2012-01-07T15:04:39 if anyone in here doesn't know about #codesprint, check it out 2012-01-07T15:04:59 #codesprint , if the comma was included 2012-01-07T15:05:14 what is it? 2012-01-07T15:05:24 join codesprint 2012-01-07T15:05:28 pfff 2012-01-07T15:09:55 lol 2012-01-07T15:10:02 imformative sign up message 2012-01-07T15:10:35 projecteuler is back 2012-01-07T15:11:36 jcdjcd: what companies are included? 2012-01-07T15:11:46 i probably cant gain anything with this 2012-01-07T15:11:56 *** Kurnevsky has left #aichallenge 2012-01-07T15:11:58 not me man. 2012-01-07T15:12:15 *** amstan has joined #aichallenge 2012-01-07T15:12:15 *** ChanServ sets mode: +o amstan 2012-01-07T15:15:36 tweet density 2012-01-07T15:15:46 too much trouble 2012-01-07T15:17:24 mcstar: you'd do well with these :P 2012-01-07T15:17:31 I can taste the recursion 2012-01-07T15:17:47 its a messy problem 2012-01-07T15:17:51 checking for syntatic correctness, permutations, coin tosses 2012-01-07T15:17:53 and stinks like works 2012-01-07T15:17:58 oh 2012-01-07T15:18:01 -s 2012-01-07T15:18:08 I'm saying in the algorithmic category 2012-01-07T15:18:20 oh 2012-01-07T15:18:59 is this what mleise was talking about? 2012-01-07T15:19:13 the card shuffling problem 2012-01-07T15:19:18 I don't know 2012-01-07T15:19:24 no, this is on codesprint :P 2012-01-07T15:21:16 i had recursions before I found out about hypergeometric distribution. combinatorics ftw 2012-01-07T15:23:14 mleise: are you solving a codesprint problem? 2012-01-07T15:23:37 now i just build lookup tables for everything I could ever need in the real of combinatorics (binominal, n! ...) 2012-01-07T15:23:53 mcstar: now, a family card game problem 2012-01-07T15:23:56 *no 2012-01-07T15:24:28 *** iglo_ has joined #aichallenge 2012-01-07T15:24:30 This will be the first time I look at these game trees you all keep talking about 2012-01-07T15:24:38 I want to learn some math. What should I look at? 2012-01-07T15:24:51 conor_f: combinatorics of course :p 2012-01-07T15:25:18 I know basic algebra, Triginomety, kinematics, projectiles, a few other physics/maths topics 2012-01-07T15:25:20 it is super useful to find out that some brute force algorithms wont work 2012-01-07T15:25:28 combinatorics? 2012-01-07T15:25:31 kk 2012-01-07T15:26:33 conor_f, take a look at khan academy for calculus, differential equations and linear algebra. http://www.khanacademy.org/ 2012-01-07T15:26:34 conor_f: you wrote about coin tosses and permutations, so I guessed you want to learn how to solve these with simple formulas 2012-01-07T15:27:11 mleise: that is also true 2012-01-07T15:27:15 ok 2012-01-07T15:27:37 khan academy for everything 2012-01-07T15:27:47 ty cyphase and mleise 2012-01-07T15:28:06 conor_f, it's good stuff if you haven't seen it. also lots of physics and other physical sciences 2012-01-07T15:28:09 conor_f, np :) 2012-01-07T15:28:18 I've seen it before 2012-01-07T15:28:23 forgotten about it though :P 2012-01-07T15:29:07 bleh 2012-01-07T15:29:26 I've got to summarize 4 acts of hamlet by tomorrow -_- 2012-01-07T15:29:36 and do wedges in applied maths 2012-01-07T15:30:06 actually, does anyone here know applied maths/physics and maths/applied physics? (Different names in different places) 2012-01-07T15:30:26 yes 2012-01-07T15:30:37 conor_f, take a look at #math too 2012-01-07T15:30:50 yeah, #math were nice to me before :) :P 2012-01-07T15:31:04 mcstar: mind answering a few questions or will I just go to #math? 2012-01-07T15:31:20 ask 2012-01-07T15:32:32 it's to do with forces and wedges (an inclined plane free to move) 2012-01-07T15:32:48 thats easy 2012-01-07T15:32:53 it's simple really, but I can't get the basic equations >_< 2012-01-07T15:32:56 yeah, I know 2012-01-07T15:33:24 I can't get the equations though 2012-01-07T15:33:34 I don't know which way to resolve the vectors :/ 2012-01-07T15:33:51 this stupid problem description for this card shuffling stuff is extremely badly formulated 2012-01-07T15:33:58 so just the most basic idea 2012-01-07T15:34:06 *** Paradoxiality has joined #aichallenge 2012-01-07T15:34:12 conor_f: what is the problem? 2012-01-07T15:34:13 a wedge with a mass on it (no friction on any surface) 2012-01-07T15:34:17 *** Paradoxiality has quit IRC (Read error: Connection reset by peer) 2012-01-07T15:34:48 what do I do with the wedge? Do I have to split it's acceleration vector into components? 2012-01-07T15:36:19 so you have a wedge, that can travel on a plane, and a point-mass on it 2012-01-07T15:36:28 yes 2012-01-07T15:37:44 do you want to know the question as in from the book? 2012-01-07T15:37:59 yes 2012-01-07T15:39:24 A wedge of mass 3m rests on a smooth horizontal table with one of its plane faces inclined at an angle 30 degrees to the horizontal. A particle of mass m is placed on this face which is smooth and the system is released from rest. show on separate diagrams the forces acting on the particle and the wedge 2012-01-07T15:40:25 By considering the forces and acceleratoins of the particle in two directions: the first along the plane and the other perpendicular to the plane, find the acceleration, a, of the wedge and the acceleration, f, of the particle relative to the wedge 2012-01-07T15:43:03 *** Accoun has quit IRC () 2012-01-07T15:44:51 *** Chris_0076 has quit IRC (Quit: Leaving) 2012-01-07T15:46:36 *** chris_0076 has joined #aichallenge 2012-01-07T15:50:49 http://www.theregister.co.uk/2012/01/07/supersoldier_ants_evolutionary_throwback/ 2012-01-07T15:51:02 must be what xathis did :P 2012-01-07T15:58:11 conor_f: did you try writing down force balance, and equations of motion first? 2012-01-07T15:58:24 yes 2012-01-07T15:59:01 I think I have all the equations for motion but I know I need to do something with the wedges acceleration but I haven't done anything with it 2012-01-07T15:59:45 *** Accoun has joined #aichallenge 2012-01-07T16:01:24 did you use the constraint on the components of acceleration of the wedge? 2012-01-07T16:02:29 as in f=ma perpindicular to the wedge for the masses acceleration? 2012-01-07T16:02:31 yes 2012-01-07T16:03:14 because it's not stationary, it is accelerating in the x and y axes 2012-01-07T16:03:21 no i mean ax=tan(alpha)ay 2012-01-07T16:03:40 (where x in parallel to the wedge's surface) 2012-01-07T16:03:46 y is perpendicular to that 2012-01-07T16:04:12 no 2012-01-07T16:04:49 the equations I have are mgSing30=m(b-a) 2012-01-07T16:05:08 mgCos30-R=2m(aSin30) 2012-01-07T16:05:33 and rCos60=2ma 2012-01-07T16:05:40 *and R=4ma 2012-01-07T16:05:48 actually, I'll leave it 2012-01-07T16:05:58 these wedges do my head in :@ 2012-01-07T16:06:44 what is R? 2012-01-07T16:07:11 Awesome 2012-01-07T16:07:11 the force acting on the wedge due to the mass 2012-01-07T16:07:21 perpindicular to the slope 2012-01-07T16:07:24 jcdjcd: ? 2012-01-07T16:07:50 I do a lot of R programming :) 2012-01-07T16:10:30 mcstar: I have about 10 pages front and back filled with my attempts for that problem -_- 2012-01-07T16:11:02 :) 2012-01-07T16:11:24 it's annoying because I thought myself the rest of the applied maths that we've done so far 2012-01-07T16:11:29 and I know all of that perfectly 2012-01-07T16:11:53 now, under advice from my parents (never listen >_<), I listened to what the teacher was saying 2012-01-07T16:12:02 and now I can't do the problems lol 2012-01-07T16:19:59 *** kire has quit IRC (Remote host closed the connection) 2012-01-07T16:20:18 *** deathcorps has joined #aichallenge 2012-01-07T16:21:43 *** JorgeB has joined #aichallenge 2012-01-07T16:21:55 hm 2012-01-07T16:21:59 well 2012-01-07T16:22:27 i forgot what i wanted to say 2012-01-07T16:22:55 ah yes 2012-01-07T16:23:18 heh :P 2012-01-07T16:23:29 so the equation for the point mass projected on the wedge, shows that only gravity accelerates it in that direction 2012-01-07T16:24:02 bleh 2012-01-07T16:24:08 lets call that x direction 2012-01-07T16:24:18 in the other one, you have to forces 2012-01-07T16:24:30 *two 2012-01-07T16:24:34 one is the projection of gravity to y 2012-01-07T16:24:37 yes 2012-01-07T16:24:54 the other one is the force that pushes the masss 2012-01-07T16:24:58 what do you call it 2012-01-07T16:25:02 tartoero 2012-01-07T16:25:08 holding-force? 2012-01-07T16:25:15 no 2012-01-07T16:25:35 resistive force of the wedge on the mass? 2012-01-07T16:25:47 maybe 2012-01-07T16:26:13 thats the force, that is the projection of the wedge's horizontal acceleration to y 2012-01-07T16:26:24 yesa 2012-01-07T16:26:27 *yes 2012-01-07T16:27:40 you have to incorporate the condition that the point mass never leaves the surface of the wedge 2012-01-07T16:28:20 i.e. these accelerations are geometrically connected 2012-01-07T16:28:29 o.O 2012-01-07T16:28:33 ok.... 2012-01-07T16:28:43 we never did anything like this in class lol 2012-01-07T16:29:27 bleh 2012-01-07T16:29:34 I'll just try it again tomorrow.... 2012-01-07T16:29:41 ty for the help mcstar 2012-01-07T16:29:55 i dont think i helpe much 2012-01-07T16:29:57 I'm going to go to sleep early tonight lol, half 9 :P 2012-01-07T16:30:06 ok 2012-01-07T16:30:11 mcstar: most likely because I'm not the surest of what I'm asking 2012-01-07T16:30:11 i try too 2012-01-07T16:30:21 ty 2012-01-07T16:30:25 ttyl #aichallenge 2012-01-07T16:30:27 *** conor_f has quit IRC (Quit: leaving) 2012-01-07T16:34:41 *** raemde_ has joined #aichallenge 2012-01-07T16:37:51 *** raemde has quit IRC (Ping timeout: 252 seconds) 2012-01-07T16:46:18 lol, looking at the javascript for my router's admin pages 2012-01-07T16:46:20 http://sprunge.us/AANU 2012-01-07T16:46:29 it gets worse... 2012-01-07T16:48:52 *** iglo_ has quit IRC (Remote host closed the connection) 2012-01-07T16:51:38 you don't understand if they didn't unroll the loop that code would be way too slow :P 2012-01-07T17:01:56 http://sprunge.us/CZLX o_o 2012-01-07T17:02:01 I like how much they use eval() 2012-01-07T17:04:35 submit that to http://thedailywtf.com/ 2012-01-07T17:05:40 http://sprunge.us/HJfR wait, what? 2012-01-07T17:06:34 submit!! 2012-01-07T17:06:41 lol, I might 2012-01-07T17:06:47 I can probably find better stuff in this code 2012-01-07T17:07:14 is that dumb++ code? 2012-01-07T17:07:29 from my router's admin pages 2012-01-07T17:07:47 they hardcoded the number of rows that let you forward port ranges, since they don't use a loop to read them 2012-01-07T17:07:56 I actually ran out of rows for regular port forwards 2012-01-07T17:08:08 lol 2012-01-07T17:08:12 you always want too much 2012-01-07T17:08:38 change one line, and it will catch fire 2012-01-07T17:08:50 everything is there for a reason 2012-01-07T17:08:59 those products are of the highest quality 2012-01-07T17:09:15 they have comments like "make this work next time" 2012-01-07T17:09:16 why do you think you know them better than the manufacturer? 2012-01-07T17:09:24 im kidding 2012-01-07T17:09:35 why dont you put up the whole source? 2012-01-07T17:09:54 *** CowTipperVirus has joined #aichallenge 2012-01-07T17:10:01 mcstar: I guess I could wget -r it all, sec 2012-01-07T17:10:10 janzert: are you around right now 2012-01-07T17:10:41 mcstar: oh, I actually can't 2012-01-07T17:10:47 they have my password and stuff in it :\ 2012-01-07T17:11:02 what was the ping command? 2012-01-07T17:11:06 ping janzert 2012-01-07T17:11:21 like that... but you know, actually working 2012-01-07T17:11:48 @ping ? 2012-01-07T17:11:48 pong 2012-01-07T17:11:58 @ping janzert 2012-01-07T17:11:58 pong 2012-01-07T17:12:07 :( 2012-01-07T17:12:16 im not sure if you only talk to contestbot or its a real ping 2012-01-07T17:12:31 @ping 2012-01-07T17:12:31 pong 2012-01-07T17:12:45 anyway, he is here 2012-01-07T17:12:57 @apropos ping 2012-01-07T17:12:57 thestinger: Misc ping and Unix ping 2012-01-07T17:12:59 heh.. got it, it's /ping 2012-01-07T17:13:08 @Unix ping 2012-01-07T17:13:08 thestinger: (unix ping [--c ] [--i ] [--t ] [--W ] ) -- Sends an ICMP echo request to the specified host. The arguments correspond with those listed in ping(8). --c is limited to 10 packets or less (default is 5). --i is limited to 5 or less. --W is limited to 10 or less. 2012-01-07T17:13:11 i tried /ping you 2012-01-07T17:13:20 @Unix ping google.com 2012-01-07T17:13:21 @Misc ping 2012-01-07T17:13:21 pong 2012-01-07T17:13:25 thestinger: yyz06s07-in-f20.1e100.net (74.125.226.84): 5 packets transmitted, 5 received, 0% packet loss, time 4006ms rtt min/avg/max/mdev = 13.226/15.007/21.596/3.296 ms 2012-01-07T17:13:52 *** Palmik has quit IRC (Remote host closed the connection) 2012-01-07T17:13:58 lastseen janzert 2012-01-07T17:14:01 @lastseen janzert 2012-01-07T17:14:02 CowTipperVirus: I have no idea what you mean. 2012-01-07T17:14:09 @seen 2012-01-07T17:14:09 CowTipperVirus: (seen [] ) -- Returns the last time was seen and what was last seen saying. is only necessary if the message isn't sent on the channel itself. may contain * as a wildcard. 2012-01-07T17:14:12 contestbot: he was here a minute ago 2012-01-07T17:14:13 mcstar: User error, it's not my fault. 2012-01-07T17:14:14 @seen janzert 2012-01-07T17:14:14 CowTipperVirus: janzert was last seen in #aichallenge 22 minutes and 36 seconds ago: you don't understand if they didn't unroll the loop that code would be way too slow :P 2012-01-07T17:14:15 mcstar: http://sprunge.us/LAXA there's a sample page 2012-01-07T17:15:07 wifi? 2012-01-07T17:15:28 hm 2012-01-07T17:15:33 i should read it from the start 2012-01-07T17:16:00 well, that's the wireless status page 2012-01-07T17:16:29 almost all the pages have the same source code but with more stuff added 2012-01-07T17:16:32 thestinger: my opinion is that it is totally unfuckingbelievable that people mix html and javascript 2012-01-07T17:16:45 this is basically the template they build up from (this page has no interactive buttons) 2012-01-07T17:17:11 must be suck to write web pages like this 2012-01-07T17:17:16 @later tell janzert Can we talk in a private channel for a bit? I saw your response about not returning stderr, but I don't think it's returning game engine outputs either. 2012-01-07T17:17:16 CowTipperVirus: As you wish. 2012-01-07T17:17:18 probably webdevs are all suicidal 2012-01-07T17:17:42 -be 2012-01-07T17:18:10 http://sprunge.us/iLCO there's the page with that awful 4 line if condition, lol 2012-01-07T17:21:14 now i understand the reason you use sprunge 2012-01-07T17:26:45 haha my one liner for #32 is slowly spitting out results 2012-01-07T17:27:00 after 25mins rentime 2012-01-07T17:27:33 lol 2012-01-07T17:35:51 its correct 2012-01-07T17:36:05 almost 40 minutes 2012-01-07T17:36:14 i wasted soo much power... 2012-01-07T17:36:49 foldl (+) 0 $ S.toList $ S.fromList $ concat [[snd ret | a<-[1..7], b<-[(succ a)..8], let ret = myTake (\x y z -> let rxry = (read x)*(read y) in (rxry==(read z),rxry)) a b s, let (c,_) = ret in c] | s <- permutations $ show 123456789] 2012-01-07T17:36:59 sorry, i couldnt help myself 2012-01-07T17:37:53 I'm going to try 46 now 2012-01-07T17:38:01 i need python, my programming language silently overflows when I compute 21! 2012-01-07T17:38:38 mleise: which language? 2012-01-07T17:38:43 you can use gmp in almost any language 2012-01-07T17:38:44 D 2012-01-07T17:38:52 ^ that 2012-01-07T17:39:03 gmp is awful in C though 2012-01-07T17:39:16 thestinger: dont use it with c 2012-01-07T17:39:20 :D 2012-01-07T17:39:51 i prefer to be close to the silicon, so i rather spend hours debugging this and coming up with solutions that skip large intermediate results 2012-01-07T17:39:55 *** kilae has quit IRC (Quit: ChatZilla 0.9.88 [Firefox 8.0/20111104165243]) 2012-01-07T17:41:36 oh nice, gmp works with -std=c++0x now :) 2012-01-07T17:41:43 there were errors before 2012-01-07T17:49:04 alright, 46 done with brute force 2012-01-07T17:51:37 *** CowTipperVirus has quit IRC (Quit: Page closed) 2012-01-07T17:54:20 well, it's fun to see ppl united in one problem, still, the last 60 hrs or so all of you here seemed to be more focussed on PE than to: what should be the next aichallenge game ?? 2012-01-07T17:58:53 ahh, just ignore my rant, guess aou have some ants hangover.. 2012-01-07T18:01:57 thestinger: lets see 46! 2012-01-07T18:02:08 i mean let me solve it 2012-01-07T18:08:11 thestinger: done 2012-01-07T18:08:37 *** Paradoxiality has joined #aichallenge 2012-01-07T18:08:48 http://codepad.org/cqnTd0A1 2012-01-07T18:08:49 *** Paradoxiality has quit IRC (Read error: Connection reset by peer) 2012-01-07T18:09:36 *** g0llum has quit IRC (Read error: Connection reset by peer) 2012-01-07T18:10:08 sorry gollum, but its fun crunching numbers 2012-01-07T18:10:40 thestinger: which is the next? 2012-01-07T18:12:26 well, doing 74 now 2012-01-07T18:16:14 weird facts 2012-01-07T18:21:19 *** Katiska has left #aichallenge 2012-01-07T18:24:37 well, solved it 2012-01-07T18:24:58 22 seconds in cpython, 7 in pypy 2012-01-07T18:25:02 lemme optimize a bit 2012-01-07T18:25:51 oh, I forgot about factorial being in the math module 2012-01-07T18:26:10 I did reduce(mul, range(1, n+1)) 2012-01-07T18:27:07 down to 13s in cpython 2012-01-07T18:33:27 processing... 2012-01-07T18:34:54 *** chris_0076 has quit IRC (Read error: Connection reset by peer) 2012-01-07T18:34:56 *** chris__0076 has joined #aichallenge 2012-01-07T18:36:14 *** chris__0076 has joined #aichallenge 2012-01-07T18:38:00 *** chris__0076 has quit IRC (Read error: Connection reset by peer) 2012-01-07T18:39:11 thestinger: ok, runs in comparable time 2012-01-07T18:40:01 40sec 2012-01-07T18:41:50 down to 4.2s now 2012-01-07T18:42:01 *** Chris_0076 has joined #aichallenge 2012-01-07T18:42:08 and your machine is 10x faster than mine... 2012-01-07T18:42:10 lol 2012-01-07T18:42:15 well maybe 2012-01-07T18:42:22 this is python though :P 2012-01-07T18:42:25 can you run mine is compiled? 2012-01-07T18:42:30 -is 2012-01-07T18:42:37 yeah 2012-01-07T18:43:04 http://codepad.org/L5L5jWge 2012-01-07T18:43:07 *** deathcorps has quit IRC () 2012-01-07T18:43:08 i know its stupid 2012-01-07T18:43:20 i didnt organize the code 2012-01-07T18:47:27 20s 2012-01-07T18:47:37 -O, -O2 and -O3 are all 20s 2012-01-07T18:47:42 hm 2012-01-07T18:47:46 thats not good 2012-01-07T18:49:13 thestinger: do you put elements into a dict? 2012-01-07T18:49:30 yeah, I use a dict as a cache and then keep track of currently seen ones 2012-01-07T18:49:41 hm 2012-01-07T18:49:46 I think I'm doing more than I have to be 2012-01-07T18:49:48 sec 2012-01-07T18:50:32 ill try memoization with haskell 2012-01-07T18:50:40 def chain_len(n, _chain_lengths={}): 2012-01-07T18:50:44 I just do it like that 2012-01-07T18:51:32 lru_cache is actually a built-in, and you can turn on the lru part 2012-01-07T18:51:37 i dont know what are the characteristics of haskell's maps 2012-01-07T18:51:43 but afaik, they are trees 2012-01-07T18:51:48 yeah, trees 2012-01-07T18:52:04 http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-HashTable.html 2012-01-07T18:52:06 there's that 2012-01-07T18:52:13 and i meant memoizing the factorial 2012-01-07T18:53:00 oh, why? 2012-01-07T18:53:03 just do 2012-01-07T18:53:10 factorial n = product [1..n] 2012-01-07T18:53:14 fast enough 2012-01-07T18:53:14 *** Akranis has quit IRC (Quit: Lämnar) 2012-01-07T18:53:33 *** Jak_o_Shadows has joined #aichallenge 2012-01-07T18:53:46 *** foRei has quit IRC (Read error: Connection reset by peer) 2012-01-07T18:53:59 right 2012-01-07T18:54:07 ill try 2012-01-07T18:54:39 ghc is probably smart enough to optimize that though 2012-01-07T18:55:27 weird, it looks like that made it slower :P 2012-01-07T18:55:57 real 0m36.934s 2012-01-07T18:56:01 real 0m56.046s 2012-01-07T18:56:58 i think it can be made very fast by memoizing say every 100th value 2012-01-07T18:57:11 got mine down to 4.1s 2012-01-07T19:03:00 ok, i rewrite it in cl 2012-01-07T19:14:57 *** ikaros has quit IRC (Quit: Ex-Chat) 2012-01-07T19:21:02 what the hell 2012-01-07T19:21:08 keep getting the wrong answer for 58 2012-01-07T19:24:47 on Project Euler ? 2012-01-07T19:25:29 *** Redgis has quit IRC (Ping timeout: 240 seconds) 2012-01-07T19:26:24 nvm, got it 2012-01-07T19:26:24 what are you getting? 2012-01-07T19:26:28 k 2012-01-07T19:29:26 there's a trend with pe problems that i don't like so much 2012-01-07T19:29:52 all the later problems throw on at the end ridiculously large numbers which basically gives you two problems in one 2012-01-07T19:30:04 i'd rather have some of these more interesting problems be left at just that 2012-01-07T19:30:12 then have specific problems for large scale 2012-01-07T19:31:22 well, you need a better algorithm 2012-01-07T19:31:40 thestinger: what was the number of the prev. problem? 2012-01-07T19:31:46 mcstar: the one I just did? 2012-01-07T19:31:48 58 2012-01-07T19:31:52 me 2012-01-07T19:32:06 oh, 74? 2012-01-07T19:32:14 thx 2012-01-07T19:32:19 *** Garf has quit IRC (Quit: Make a new plan, Stan!) 2012-01-07T19:32:27 i named my directory 47 2012-01-07T19:32:59 *** JorgeB has quit IRC (Ping timeout: 252 seconds) 2012-01-07T19:39:00 *** sigh has joined #aichallenge 2012-01-07T19:54:17 AAAAAAAAAAAAAAAAAAAAAA 2012-01-07T19:54:54 im such a effing retart 2012-01-07T19:54:56 d 2012-01-07T19:54:58 d 2012-01-07T19:55:00 d 2012-01-07T19:55:18 i kept using hash-table-size instead of hash-table-count 2012-01-07T19:56:04 *** grwip has quit IRC (Remote host closed the connection) 2012-01-07T20:05:45 @later tell cowtippervirus sorry, I must not have been clear. The engine warnings/errors and bot stderr output are recorded together. They just aren't being displayed to the user unless the bot crashed/timed out/issued an invalid move 2012-01-07T20:05:45 janzert: Job's done. 2012-01-07T20:18:37 back 2012-01-07T20:18:40 going to do that poker one now 2012-01-07T20:22:05 the cl version runs in 100 secs 2012-01-07T20:22:11 for 74 2012-01-07T20:22:32 it is totally unoptimized, but it shouldnt be this slow 2012-01-07T20:22:38 (with hashtable) 2012-01-07T20:24:52 mcstar: http://sprunge.us/fJii that was how I ended up doing it 2012-01-07T20:26:33 pypy is annoying since it's not py3... 2012-01-07T20:27:02 map, filter, zip, range, etc. return lists in py2, but in py3 they are lazy generators 2012-01-07T20:27:23 they have imap, ifilter, izip, etc. in itertools for python2 though... 2012-01-07T20:27:34 *** sigh has quit IRC (Remote host closed the connection) 2012-01-07T20:37:25 *** sigh has joined #aichallenge 2012-01-07T20:46:38 *** choas has quit IRC (Ping timeout: 240 seconds) 2012-01-07T20:48:47 *** choas has joined #aichallenge 2012-01-07T20:52:47 *** mcstar has quit IRC (Quit: mcstar) 2012-01-07T21:03:38 *** choas has quit IRC (Ping timeout: 240 seconds) 2012-01-07T21:12:53 *** mceier has quit IRC (Quit: leaving) 2012-01-07T21:20:59 *** Blkt`` is now known as Blkt 2012-01-07T21:23:51 *** Fandekasp has joined #aichallenge 2012-01-07T21:26:31 ok, this poker one is seriously annoying as hell 2012-01-07T21:27:22 *** Blkt has quit IRC (Quit: good night everyone) 2012-01-07T21:32:01 *** srgpqt has joined #aichallenge 2012-01-07T21:33:45 i thought you said you did it? 2012-01-07T21:34:31 is there anything to it other than just brute forcing the outcomes? 2012-01-07T21:34:41 like is there sometihng to determining the outcome of a game 2012-01-07T21:35:21 well 2012-01-07T21:35:31 the whole problem is basically to match each case 2012-01-07T21:35:52 like, you match against a royal flush first, etc. 2012-01-07T21:36:55 yeah 2012-01-07T21:37:09 but is there anything special to matching hands that you can see? 2012-01-07T21:37:30 not really 2012-01-07T21:37:33 I'm debugging them one by one 2012-01-07T21:37:37 I did a lot of stuff wrong :( 2012-01-07T21:37:58 presumably one sorts the cards by number, then just checks for each type of hand in order? 2012-01-07T21:38:11 why sort them? 2012-01-07T21:38:18 I'm turning each hand into a lookup table basically 2012-01-07T21:38:23 {2: {'D'}, 'D': {2, 12}, 'H': {11}, 11: {'H', 'S'}, 12: {'D'}, 'C': {14}, 14: {'C'}, 'S': {11}} 2012-01-07T21:38:25 ah fair enough 2012-01-07T21:38:53 so there's a 2, suit is diamonds 2012-01-07T21:38:58 there are 2 diamonds - 2 and 12 2012-01-07T21:39:00 etc. 2012-01-07T21:39:50 anyway a hand is just a dict, with suits and numbers as keys and sets of the opposite as values 2012-01-07T21:39:58 seems to be a good way to do it 2012-01-07T21:40:59 {2: {'H'}, 4: {'H'}, 6: {'H'}, 8: {'H'}, 'H': {8, 2, 4, 13, 6}, 13: {'H'}} 2012-01-07T21:41:00 {'C': {9, 2, 4, 5, 7}, 4: {'C'}, 5: {'C'}, 7: {'C'}, 9: {'C'}, 2: {'C'}} 2012-01-07T21:41:02 those are both a flush 2012-01-07T21:41:14 since they didn't match my other broken things 2012-01-07T21:41:15 lol 2012-01-07T21:41:19 not working yet... 2012-01-07T21:47:51 :D you play cards now? 2012-01-07T21:48:40 euler question :P 2012-01-07T21:48:50 http://projecteuler.net/problem=54 2012-01-07T21:49:05 ok, maybe there are no royal flushes in the data... 2012-01-07T21:49:10 I didn't consider that 2012-01-07T21:49:22 antimatroid1: lets write a card game AI that solves a game 2012-01-07T21:49:36 mleise: which game? 2012-01-07T21:49:40 I don't get a single match for royal flush, straight flush or four of a kind 2012-01-07T21:50:02 2 matches for full house and they are accurate 2012-01-07T21:50:22 i need to look into how to set up tcp servers 2012-01-07T21:50:31 then we could just make a bunch of games to play around with ai for 2012-01-07T21:52:03 antimatroid1: the next gen euler then 2012-01-07T21:52:20 that's always been the plan 2012-01-07T21:52:24 like project euler but for ai 2012-01-07T21:52:30 instead of solving problems for yourself, your programs play against each other 2012-01-07T21:52:33 with new "problems" being contests 2012-01-07T21:53:02 antimatroid1: I'm working on a version of Asshole with 32 cards 2012-01-07T21:53:03 anyone know where i'd begin to learn about tcp stuff? 2012-01-07T21:53:12 i guess just grab a copy of the ants tcp and work out wtf is going on 2012-01-07T21:53:39 antimatroid1: Ants TCP uses library stuff from Python. 2012-01-07T21:54:04 i was thinking about this the other day 2012-01-07T21:54:19 with multiple games, could that all run through the same port? 2012-01-07T21:54:21 Every major language Python, Delphi, Java etc. has ready to use TCP Server/Client classes 2012-01-07T21:54:38 antimatroid1: There is one listen port (80 for HTTP) 2012-01-07T21:54:51 like the bot would give info to the server about what it wants, ie. game, number of players, map, etc. then you have to try and match up games based on people saying what they wanted 2012-01-07T21:54:54 then a new socket is created for the actual connection 2012-01-07T21:55:20 so the "listener" is in one thread on port 80 and the connections are handled in other threads 2012-01-07T21:57:04 how do you run a tcp server? 2012-01-07T21:57:14 like does it need to run on a server, or could i run one from my pc? 2012-01-07T21:57:30 antimatroid1: maybe a client software could handle the situation where noone is online and organize a game with two of your programs playing against each other 2012-01-07T21:57:47 antimatroid1: you can run it on your pc 2012-01-07T21:57:47 antimatroid1: you just run it anywhere, but you need the port forwarded if you're behind an NAT 2012-01-07T21:58:05 yeah forwarding ports is easy 2012-01-07T21:58:18 i'm going to spend the afternoon playing around with this stuff 2012-01-07T21:58:25 another option is to use UPNP and kindly ask the router to forward the port temporarily 2012-01-07T21:58:44 i'm not too worried about ports being open 2012-01-07T21:58:58 But that is more of an option for a release where you want to make things convenient 2012-01-07T21:59:27 so next question, where's the best ants tcp repo? :P 2012-01-07T21:59:35 rabidus's might be older? 2012-01-07T21:59:43 the code is really bad 2012-01-07T21:59:48 yeah i know 2012-01-07T21:59:51 better off starting off if you want to make something else 2012-01-07T21:59:52 antimatroid1: with Ants TCP I was able to download arbitrary files from the server 2012-01-07T21:59:56 starting over* 2012-01-07T22:00:01 i will start over 2012-01-07T22:00:05 but i have zero idea of what i'm doing 2012-01-07T22:00:20 use a language that makes networking easy 2012-01-07T22:00:22 lightweight threads 2012-01-07T22:00:24 then it's easy 2012-01-07T22:00:28 i want to learn more about trueskill at some point too 2012-01-07T22:00:34 If you use a ready to use TCP class, make sure you don't forget about security. Double check what you receive. 2012-01-07T22:00:35 yeah i'll use python 2012-01-07T22:00:56 well, python itself doesn't have lightweight threads but stackless python (which pypy supports) does 2012-01-07T22:00:56 mleise: i'll start asking you questions when i get to that 2012-01-07T22:01:01 i've never had to worry about security 2012-01-07T22:01:17 *** Fandekasp has quit IRC (Ping timeout: 255 seconds) 2012-01-07T22:01:22 I guess you could just make a thread for each client like the ants tcp does 2012-01-07T22:01:28 but that's not really a good idea 2012-01-07T22:01:46 thestinger: why is that? 2012-01-07T22:02:26 It sounds like the simplest solution. 2012-01-07T22:02:33 then you're very vulnerable to a DoS, slowloris style 2012-01-07T22:02:43 it also wastes a lot of resources 2012-01-07T22:03:45 hmm, so the alternative - I guess - is to use a few worker threads and give them work now and then 2012-01-07T22:04:31 or, lightweight threads (which does that for you) 2012-01-07T22:04:33 and one thread walks over the open client connections and handles the I/O and passes the work on to the other threads 2012-01-07T22:05:18 I've never written any TCP software that had to scale well :) 2012-01-07T22:07:03 what's the topic? 2012-01-07T22:07:31 amstan: antimatroid1 writes a TCP server for something like project euler, but for AI 2012-01-07T22:08:07 before the topic was: http://projecteuler.net/problem=54 2012-01-07T22:08:09 what can it be like AI and project euler at the same time? 2012-01-07T22:08:37 actually it is like Ants TCP, but with multiple problems/contests at the same time 2012-01-07T22:08:56 probably like an Ants/PlanetWars/Tron TCP 2012-01-07T22:09:36 It could be easy to add new game modules and try some new game ideas 2012-01-07T22:09:41 what's so special about ants tcp? 2012-01-07T22:09:56 amstan: i want the site to do tcp and be able to handle multiple games 2012-01-07T22:09:59 nothing 2012-01-07T22:10:04 so we can have past contests up as tcp servers 2012-01-07T22:10:23 antimatroid1: tcp is not secure though, you can't be sure nobody cheated 2012-01-07T22:10:29 so? 2012-01-07T22:10:36 it's just for learning/playing around 2012-01-07T22:10:44 i guess that could work 2012-01-07T22:10:50 new "problems" would come in the form of a contest which we would still use a server for 2012-01-07T22:10:58 or.. you could leave it all open 2012-01-07T22:11:00 although some games could be made that never have a contest run 2012-01-07T22:11:04 encourage all kinds of behavoirs 2012-01-07T22:11:12 which is also fun 2012-01-07T22:11:21 it's too expensive to have servers running all the time for all past contests with all bots 2012-01-07T22:11:30 it is, correct 2012-01-07T22:12:11 one option would be to not run games for bots with a "stabilised rank", but if the site got too popular it'd become infeasible again 2012-01-07T22:12:12 antimatroid1: the issue is framework and maintenance 2012-01-07T22:12:19 antimatroid1: when the server load is low, it could create bot instances for games that were requested by clients 2012-01-07T22:12:20 we're already dying doign what we have so far 2012-01-07T22:12:52 once a contest is over and people have shared code you can't really be sure of what's what anymore anyway 2012-01-07T22:13:01 so i personally would be fine with just playing others on tcp 2012-01-07T22:13:22 we could have some bots up on servers that could ensure a bot always managed a game if it wanted 2012-01-07T22:14:25 here's another problem for you guys too, giving an overall ranking for usernames with bots in multiple games 2012-01-07T22:15:27 here's an idea too, let the person either declare a new version for their bot or clear all game history of their bot 2012-01-07T22:15:35 so people aren't needing to use new usernames so much 2012-01-07T22:15:51 why do people need new usernames? 2012-01-07T22:16:04 check the ranking of a new version? 2012-01-07T22:16:06 oh, for tcp, right 2012-01-07T22:16:07 antimatroid1: or the client would identify with username and botname 2012-01-07T22:16:19 mleise: that would be good too 2012-01-07T22:16:40 username + botname and allow versions for botnames and to delete botname game histories 2012-01-07T22:17:13 should you be able to have the same botname for different games? 2012-01-07T22:17:19 oh 2012-01-07T22:17:23 antimatroid1: also in version 2.0 you can offer achievements, like beating bocsimacko in PlanetWars :D 2012-01-07T22:17:29 I guess I need to make a little utility function for this 2012-01-07T22:17:52 hm 2012-01-07T22:18:10 thestinger; are you evaluating highest card right? 2012-01-07T22:18:12 thestinger: "this" refers to what? 2012-01-07T22:18:16 antimatroid1: yes 2012-01-07T22:18:18 tie breaker 2012-01-07T22:18:21 ie. 4,5,6,6,6 vs. 4,4,6,6,6 2012-01-07T22:18:25 I ended up just using a tuple as the return value 2012-01-07T22:18:29 since 2, 1 is lower than 2, 2 2012-01-07T22:19:14 for rank(cards) 2012-01-07T22:19:34 if nothing else matches, it gets the high card 2012-01-07T22:19:48 0, 8 if the high card is 8 2012-01-07T22:20:31 anyway I did it poorly 2012-01-07T22:20:38 I need to switch my representation of a hand 2012-01-07T22:20:45 another option would be to start contests without an official server to submit to for like a month and heavily push people towards tcp before submitting their bot 2012-01-07T22:20:52 {'C': {12}, 'D': {11}, 7: {'S'}, 11: {'D'}, 12: {'S', 'C'}, 2: {'S'}, 'S': {2, 12, 7}} 2012-01-07T22:20:57 that way we wouldn't get as many "crap" bots at the end 2012-01-07T22:20:58 I just have suits/values in the same dict 2012-01-07T22:21:02 I need to have it separate 2012-01-07T22:21:10 but we'd also have less "competitors" 2012-01-07T22:21:23 or I could make a utility function to separate them each time I want, but that's pointless when I can just do it properly 2012-01-07T22:21:31 so I need cards_by_suit and cards_by_value 2012-01-07T22:21:49 instead of cards, with both values and suits as keys 2012-01-07T22:22:08 ((i, hand.get(i, set())) for i in keys) 2012-01-07T22:22:10 or I can do that 2012-01-07T22:22:21 which is pointless 2012-01-07T22:22:49 to separate things into suits and values again :P 2012-01-07T22:23:13 like get_values(hand, "DCSH") 2012-01-07T22:23:21 anyway 2012-01-07T22:23:26 that's not really the problem 2012-01-07T22:23:31 I don't think I did full house properly 2012-01-07T22:24:14 well 2012-01-07T22:24:17 for each value of card 2012-01-07T22:24:56 I check if the number of suits is 3 2012-01-07T22:24:58 etc. 2012-01-07T22:25:07 and then I check for another card with 2 2012-01-07T22:25:10 yeah I guess that should work 2012-01-07T22:29:57 {'C': {8, 5, 6, 7}, 5: {'C'}, 6: {'C'}, 7: {'C'}, 8: {'C'}, 12: {'D'}, 'D': {12}} 2012-01-07T22:29:59 by suit: {'C': {8, 5, 6, 7}, 'D': {12}} 2012-01-07T22:30:01 by kind: {8: {'C'}, 12: {'D'}, 5: {'C'}, 6: {'C'}, 7: {'C'}} 2012-01-07T22:30:04 yeah, that makes my life 100x easier 2012-01-07T22:33:37 the only problem i see with past contest tcp servers is some people maybe not wanting to then share their code 2012-01-07T22:37:16 *** mleise has quit IRC (Ping timeout: 240 seconds) 2012-01-07T22:37:50 *** denysonique_ has quit IRC (Remote host closed the connection) 2012-01-07T22:37:59 *** mattswe has quit IRC (Remote host closed the connection) 2012-01-07T22:37:59 *** nickjohnson has quit IRC (Remote host closed the connection) 2012-01-07T22:37:59 *** sofuture has quit IRC (Read error: Connection reset by peer) 2012-01-07T22:38:19 *** alehorst has joined #aichallenge 2012-01-07T22:39:49 nice, I've figured it out 2012-01-07T22:39:51 *** sofuture has joined #aichallenge 2012-01-07T22:39:52 still a bug or two to fix 2012-01-07T22:40:07 *** sofuture has quit IRC (Remote host closed the connection) 2012-01-07T22:42:29 *** alehorst has quit IRC (Ping timeout: 240 seconds) 2012-01-07T22:43:10 *** nickjohnson has joined #aichallenge 2012-01-07T22:43:32 *** pairofdice has joined #aichallenge 2012-01-07T22:43:59 http://pastebin.com/vHHr8DKB how is one meant to do that syntax wise? I realise that's the wrong kind of ip 2012-01-07T22:44:14 *** nickjohnson has quit IRC (Remote host closed the connection) 2012-01-07T22:45:34 what do you mean? 2012-01-07T22:46:54 that looks like a key:value pair from a python dict 2012-01-07T22:47:13 anyway, socket.gethostname() is just a convenience function from the socket module 2012-01-07T22:47:42 socket.gethostbyname(socket.gethostname()) gets the current ip 2012-01-07T22:48:04 well 2012-01-07T22:48:06 they say host _or_ name 2012-01-07T22:48:10 so you can just leave it like that 2012-01-07T22:48:28 not sure what it's for :P 2012-01-07T22:49:35 usually you would do that to get an address to bind to 2012-01-07T22:49:44 binding to 0.0.0.0 listens on every interface 2012-01-07T22:50:05 if your hostname on a network is foo, then binding to foo binds to that ip 2012-01-07T22:50:29 antimatroid1: is that from the tcp server config or something? 2012-01-07T22:50:41 yeah 2012-01-07T22:50:49 i am trying to open the port now 2012-01-07T22:50:52 my network is being a pita 2012-01-07T22:51:12 anyway, now I have cards_by_suit and cards_by_kind and I've almost got a solution 2012-01-07T22:52:14 done royal flush, straight flush, four of a kind, full hour, flush, straight, three of a kind, two pairs and one pair 2012-01-07T22:52:20 just need to get the secondary ordering working 2012-01-07T22:53:24 anyway I give high card a score of 0 for the primary score and then work up from there, so royal flush is 9 2012-01-07T22:53:36 this problem is annoying as hell 2012-01-07T22:56:07 did it :) 2012-01-07T22:58:01 *** Fandekasp has joined #aichallenge 2012-01-07T23:01:45 *** srgpqt has quit IRC (Quit: Lost terminal) 2012-01-07T23:02:10 ./solution.py 0.11s user 0.01s system 96% cpu 0.117 total 2012-01-07T23:02:23 anyway, takes 117ms with cpython so speed isn't an issue for this 2012-01-07T23:02:27 I didn't do any optimization 2012-01-07T23:02:44 *** lhb__ has joined #aichallenge 2012-01-07T23:04:23 *** grc48 has quit IRC (Quit: This computer has gone to sleep) 2012-01-07T23:06:52 *** raemde_ has quit IRC (Ping timeout: 276 seconds) 2012-01-07T23:50:23 *** denysonique_ has joined #aichallenge 2012-01-07T23:59:20 *** denysonique_ has quit IRC (Read error: Connection reset by peer)