←2006-03-13 2006-03-14 2006-03-15→ ↑2006 ↑all
00:00:11 <fizzie> To fill the daily Perl quota - functional programming in Perl: perl -e 'print &{&{sub { my $f = shift; return &$f($f); }}(sub { my $f = shift; return sub { my $n = shift; return 1 if $n < 2; return &{&$f($f)}($n-1) + &{&$f($f)}($n-2); }; })}(8), "\n";'
00:00:27 <fizzie> I think that means it's time to go to sleep.
00:00:39 <GregorR> LOL
00:00:42 <GregorR> Brilliant
00:12:35 -!- kipple has quit (Read error: 110 (Connection timed out)).
00:16:08 -!- graue has joined.
00:19:21 -!- graue has quit (Client Quit).
00:29:16 -!- CXI has joined.
01:26:27 -!- GregorR has quit (Remote closed the connection).
01:26:35 -!- GregorR has joined.
01:58:46 -!- GregorR has quit (Remote closed the connection).
01:58:50 -!- GregorR_ has joined.
02:25:12 -!- GregorR_ has quit (Remote closed the connection).
02:25:45 -!- GregorR_ has joined.
02:27:34 -!- GregorR_ has quit (Remote closed the connection).
02:27:50 -!- GregorR_ has joined.
02:28:45 -!- GregorR_ has quit (Remote closed the connection).
02:29:17 -!- GregorR_ has joined.
02:39:08 -!- GregorR__ has joined.
02:43:07 -!- GregorR__ has quit (Remote closed the connection).
02:43:38 -!- GregorR__ has joined.
02:54:02 -!- GregorR__ has quit (Remote closed the connection).
02:54:38 -!- GregorR__ has joined.
03:03:49 -!- GregorR__ has changed nick to GregorR.
04:37:32 -!- Arrogant has joined.
04:41:33 -!- Sgeo has quit.
05:12:35 -!- CXI has quit (Connection timed out).
05:57:45 -!- GregorR__ has joined.
05:58:03 -!- GregorR has quit (Remote closed the connection).
06:10:51 -!- GregorR__ has quit (Remote closed the connection).
06:13:55 -!- GregorR___ has joined.
06:16:31 -!- GregorR__ has joined.
06:16:34 -!- GregorR__ has quit (Remote closed the connection).
06:18:57 -!- GregorR___ has quit (Remote closed the connection).
06:19:04 -!- GregorR___ has joined.
06:19:20 -!- Arrogant has quit ("Leaving").
06:27:33 -!- GregorR___ has quit (Remote closed the connection).
06:27:46 -!- GregorR___ has joined.
07:04:20 -!- GregorR____ has joined.
07:05:45 -!- GregorR___ has quit (Remote closed the connection).
07:33:07 -!- calamari has quit ("Leaving").
07:59:59 -!- clog has quit (ended).
08:00:00 -!- clog has joined.
08:07:14 -!- GregorR____ has changed nick to GregorR.
08:59:05 -!- GregorR has quit (Remote closed the connection).
08:59:15 -!- GregorR has joined.
09:13:14 -!- GregorR has quit (Remote closed the connection).
09:13:20 -!- GregorR has joined.
09:34:21 -!- SimonRC has quit (Remote closed the connection).
09:35:08 -!- SimonRC has joined.
11:07:06 -!- GregorR__ has joined.
11:07:24 -!- GregorR has quit (Remote closed the connection).
11:09:21 -!- kipple has joined.
11:19:05 -!- GregorR__ has quit (Remote closed the connection).
11:20:56 -!- GregorR__ has joined.
11:30:41 -!- GregorR__ has quit (Remote closed the connection).
13:40:46 -!- Keymaker has joined.
13:41:24 <Keymaker> oh my head.. what is this place? where am i?! this looks strangely familiar..
13:59:08 -!- kipple has quit (Read error: 110 (Connection timed out)).
14:01:17 -!- kipple has joined.
14:33:55 -!- jix has joined.
14:35:37 <Keymaker> hello jiz
14:35:39 <Keymaker> *x
14:35:57 <Keymaker> any new language areund?
14:40:49 <jix> no
14:41:57 <Keymaker> ok
15:02:19 -!- jix has quit (" HydraIRC -> http://www.hydrairc.com <- IRC has never been so good").
15:31:59 -!- cyph1e has joined.
15:33:10 <cyph1e> Hi, can anyone give me an advice for writing a brainfuck program which increases a 3 digit input (seen as a number) by one?
15:33:38 <cyph1e> like 123 -> 124, 879 -> 880
15:35:46 <Keymaker> yeah
15:35:49 <Keymaker> and hi
15:36:16 <Keymaker> what kind of advice you want?
15:36:19 <Keymaker> tips or code?
15:36:30 <kipple> the way I would do it: increase the last digit by one. test if the new number is 58 (ascii value of ':'). If not, then done. else replace with 48 and repeat the procedure for next digit
15:37:07 <SimonRC> yeah
15:37:21 <kipple> but you didn't specify how the number is input, so it might not apply
15:37:35 <Keymaker> three digit input
15:37:44 <kipple> is it read as 3 separate digits or a single number with 3 digits
15:37:46 <kipple> ?
15:37:56 <Keymaker> that doesn't really matter :)
15:38:33 <kipple> well, sure, but if it is only one single number you have to do some more work :)
15:38:55 <kipple> bah . never mind me. being stupid today
15:39:01 <Keymaker> :)
15:39:53 <cyph1e> ah sorry, I'm back
15:40:02 <cyph1e> the input is read as 3 characters
15:40:05 <Keymaker> ok
15:40:27 <kipple> then my method should work
15:40:32 <cyph1e> what's the "brainfuck-way" to check if a new number is 58?
15:40:46 <kipple> subtract 58 and check for 0 with [
15:40:54 <Keymaker> not necessarily
15:41:11 <cyph1e> ah
15:41:16 <Keymaker> that works only if the interpreter is wrapping
15:41:28 <kipple> huh?
15:41:59 <Keymaker> well, let's say i input '4' in my interpreter -- if i subtract 58 from it it causes underflow
15:42:11 <kipple> well, then your interpreter is broken IMHO :)
15:42:20 <Keymaker> :p
15:42:43 <Keymaker> no it's not!
15:43:16 <cyph1e> are the bytes signed or unsigned?
15:43:22 <Keymaker> signed
15:43:27 <Keymaker> i mean unsigned
15:43:28 <Keymaker> damn
15:43:29 <Keymaker> :p
15:43:32 <cyph1e> heh
15:43:35 <cyph1e> I'm very new to bf
15:43:45 <Keymaker> ah
15:43:52 <Keymaker> how did you find out this marvellous language?
15:44:10 <kipple> again, that depends on the interpreter, but the original used signed WRAPPING bytes.. ;)
15:44:22 <kipple> damn. unsigned I mean ;D
15:44:23 <Keymaker> but the original interpreter is buggy if you remember ;)
15:44:28 <cyph1e> well I'm doing some programming challenges and one of them asks me to write such a program in bf
15:44:40 <Keymaker> ah
15:44:44 <Keymaker> where is that challenge ;)
15:44:59 <cyph1e> spoj.sphere.pl
15:45:06 <cyph1e> problem18
15:45:09 <Keymaker> ok
15:46:43 <cyph1e> so to check if a byte is 58, I need to copy the byte first?
15:46:49 <kipple> yes
15:46:53 <Keymaker> yeah
15:46:55 <cyph1e> I see
15:47:18 <Keymaker> in your case it'd be easiest (not necessarily shortest) to first subtract 48 from the cell when reading input
15:47:35 <cyph1e> I see
15:47:37 <cyph1e> hmm
15:47:38 <Keymaker> then you could check if the cell's value is ten, a bit easier
15:47:53 <Keymaker> and when printing out adding 48 to each digit
15:48:11 <Keymaker> this way is not the shortest, but it's simplest
15:48:37 <cyph1e> okay
15:49:23 <cyph1e> are all the bytes guaranteed to be zero at start?
15:49:27 <Keymaker> yeah
15:49:31 <cyph1e> great
15:50:51 <Keymaker> btw, remember the special case that if you increase 999 it'll be no longer three-digit number ;)
15:50:57 <cyph1e> yeah
15:51:02 <cyph1e> I was thinking this:
15:51:10 <cyph1e> use 5 bytes as a start
15:51:17 <cyph1e> [0,0,0,0,0]
15:51:21 <cyph1e> read in number
15:51:23 <cyph1e> like this
15:51:30 <cyph1e> [0,0,9,9,9]
15:51:48 <cyph1e> do the increase thing, and '<' until you reach a zero byte
15:52:00 <cyph1e> [x,1,0,0,0]
15:52:01 <cyph1e> argh damn
15:52:13 <cyph1e> I thought wrong
15:52:41 <Keymaker> you thought correct, but you need to loop there
15:52:57 <Keymaker> so i suggest using memory 0 0 1 9 1 9 1 9
15:53:08 <Keymaker> where the 1s are booleans
15:53:40 <cyph1e> I see, hmm
15:53:42 <Keymaker> and you can move slide in the memory by using [>>] kinda structures
15:53:53 <Keymaker> it gets a bit more complicated, but not much
15:54:12 <Keymaker> the brainfuck way of thinking takes a bit time ;)
15:54:20 <cyph1e> yeah I guess :S
15:54:55 <Keymaker> there's however a simpler way too
15:55:10 <cyph1e> how?
15:55:20 <Keymaker> wait..
15:55:23 <Keymaker> (i'm writing)
15:59:40 <cyph1e> ok
16:01:26 <Keymaker> hmm, i think the loop way is the simplest afterall.. i started making another way but it gets a lot more complicated
16:01:52 <cyph1e> I see
16:01:58 <Keymaker> i suggest having there something booleans to indicate the current digit that is currently being selected
16:02:15 <Keymaker> to allow easier moving, 0 indicating selected and 1 non-selected
16:02:15 <cyph1e> yeah it seems like a good ieda
16:03:14 <Keymaker> and every take two copies of the digit, then return it, and then check from the other copy if it's 10 -- if it is then set the digit to zero and increase the one on its left side
16:03:43 <Keymaker> this is basically the "move left until reach zero byte"
16:04:13 <cyph1e> ah great.. I'm gonna eat dinner, I'll be back in a while
16:04:17 <Keymaker> o-k
16:12:35 -!- GregorR has joined.
16:13:03 -!- GregorR has quit (Remote closed the connection).
16:13:33 -!- GregorR has joined.
16:29:22 -!- GregorR has quit (Remote closed the connection).
16:29:28 -!- GregorR has joined.
16:31:30 <cyph1e> Can you move left if you're in the original position in bf?
16:32:05 <Keymaker> you mean from the cell 0?
16:32:06 <Keymaker> nope
16:32:18 <cyph1e> yes, okay
16:34:52 <cyph1e> the flag bytes, are they only used for knowing if the result is 3 or 4 digits?
16:36:14 <Keymaker> that as well, but they help you to move around in the array when you're looping
16:36:23 <Keymaker> and doing the calculation for every digit
16:36:56 <cyph1e> I'm having a bit trouble trying to make this into a fancy loop instead of hardcoding each calculation
16:37:26 <Keymaker> heh, yeah -- naturally you can also hardcode each calculation if you want to
16:38:12 <cyph1e> I think I give that a try first
16:38:19 <Keymaker> ok
16:45:33 <cyph1e> hmm
16:46:44 <cyph1e> I can't do this heh
16:47:12 <Keymaker> well, it can be pretty difficult for a beginner, yes. i didn't learn bf in one night
16:48:03 <Keymaker> i can make a sample code if you want to see what it would look like or something
16:48:38 <cyph1e> if you look here
16:48:39 <cyph1e> http://pastebin.zerovolt.com/101/
16:49:20 <cyph1e> those brackets, [ ], I enter that loop if I have a 9 as most-right digit
16:49:33 <cyph1e> right?
16:49:41 <Keymaker> wait.
16:51:19 -!- GregorR has quit (Remote closed the connection).
16:51:35 <Keymaker> here comes to interpreter question.. if the interpreter is wrapping the only case you DON'T enter the loop is if the value is 10
16:51:37 -!- GregorR__ has joined.
16:52:07 <cyph1e> yes
16:52:30 <cyph1e> how to construct "if-statements" otherwise?
16:52:39 <Keymaker> -[-[-[-[-[-[
16:52:54 <Keymaker> and such
16:53:00 <cyph1e> hmm ok
16:53:30 <cyph1e> but I would rather like to step inside that bracket body if I got 10
16:53:49 <Keymaker> yes
16:53:53 <Keymaker> you can do it this way:
16:54:12 -!- GregorR___ has joined.
16:54:20 -!- GregorR__ has quit (Remote closed the connection).
16:54:56 <Keymaker> if the smallest value in the cell can be zero; [-[-[-[-[-[-[-[-[-[- now code what happens if cell is 10 ] ] ] ] ] ] ] ] ] ]
16:55:01 <Keymaker> hope i didn't lost on count
16:55:22 <Keymaker> remember to do that in a copy of the cell, otherwise you'll lose the cell's value
16:55:39 <cyph1e> I see
16:56:37 <cyph1e> shouldn't it be -[-[-[-[-[-[-[-[-[-[
16:56:39 <cyph1e> ?
16:56:49 <Keymaker> it depends what the smallest value there can be
16:57:01 <Keymaker> in that example of mine the smallest possible value was zero
16:57:04 <cyph1e> ah sorry
16:57:11 <cyph1e> your example was correct, I was thinking wrong
16:57:25 <Keymaker> ok
17:04:50 <cyph1e> http://pastebin.zerovolt.com/102/
17:04:59 <cyph1e> shouldn't that work for 2 numbers? I must've made a mistake somewhere
17:07:02 <Keymaker> hmm, it should
17:07:10 <Keymaker> i'll run it in interpreter..
17:07:39 <cyph1e> I'm currently trying it on http://koti.mbnet.fi/villes/php/bf.php
17:08:52 <Keymaker> ah, you know what the problem is? you forgot to do increase the number
17:09:07 <Keymaker> if you input 499 it stays as 499
17:09:24 <cyph1e> I don't understand, I'm getting crap output
17:09:35 <cyph1e> oh
17:09:37 <Keymaker> perhaps that interpreter doesn't work right..
17:09:52 <cyph1e> can you recommend one?
17:09:57 <cyph1e> win32
17:11:46 <Keymaker> hmm
17:12:26 <Keymaker> you could try this: http://www.iamcal.com/misc/bf_debug/
17:12:30 <cyph1e> a one I just downloaded crashed
17:12:33 <Keymaker> it's in javascript
17:12:50 <cyph1e> ah ok
17:13:03 <Keymaker> anyways, you don't increase the last digit in any point
17:13:21 <cyph1e> yeah, I should do that in the beginning, before copying
17:13:24 <Keymaker> so instead of subtracting 48 subtract 47
17:13:27 <Keymaker> yes
17:13:38 <cyph1e> or simply sub by 47
17:13:44 <Keymaker> as i said :p
17:13:52 <cyph1e> ah :P
17:13:59 <cyph1e> you were faster
17:14:25 <cyph1e> yeah it seems to work
17:15:00 <Keymaker> it should work now. when you input 499 it outputs 4:0 which means the middle digit is 10
17:15:03 <Keymaker> as it should be
17:16:18 <cyph1e> yeah
17:18:33 <cyph1e> I should be able to do this on my own now, thanks a lot for your help
17:19:12 <Keymaker> you're welcome
17:19:14 <Keymaker> good luck
17:21:15 <cyph1e> thanks
17:21:22 -!- jix has joined.
17:43:31 -!- calamari has joined.
17:45:14 -!- GregorR____ has joined.
17:45:17 -!- GregorR___ has quit (Remote closed the connection).
18:39:27 <Keymaker> bye
18:39:29 -!- Keymaker has left (?).
18:51:23 -!- GregorR_____ has joined.
18:51:42 -!- GregorR____ has quit (Remote closed the connection).
19:09:26 -!- GregorR_____ has quit (Remote closed the connection).
19:10:06 -!- GregorR_____ has joined.
19:28:53 -!- GregorR______ has joined.
19:32:49 -!- GregorR_____ has quit (Remote closed the connection).
20:50:21 -!- Sgeo has joined.
21:28:19 -!- GregorR-L has joined.
21:29:03 -!- jix has left (?).
21:34:22 -!- GregorR_______ has joined.
21:34:24 -!- GregorR______ has quit (Remote closed the connection).
21:42:21 -!- GregorR_______ has quit (Read error: 104 (Connection reset by peer)).
21:43:37 -!- GregorR_______ has joined.
21:54:16 * pgimeno wonders how many _'s will FreeNode support
21:55:17 <fizzie> 20:55:32 [freenode] ... IRCD=dancer CAPAB CHANTYPES=# EXCEPTS INVEX CHANMODES=bdeIq,k,lfJD,cgijLmnPQrRstz CHANLIMIT=#:20 PREFIX=(ov)@+ MAXLIST=bdeI:50 MODES=4 STATUSMSG=@ KNOCK NICKLEN=16 are supported by this server
21:55:38 <fizzie> Only two more, then.
21:56:19 <fizzie> (Assuming all freenode servers agree on that NICKLEN, which sounds like a safe assumption.)
21:56:19 <lindi-> maybe GregorR_______ should use some RLE scheme for his nick to support more underscores
21:56:40 -!- pgimeno has changed nick to pgimeno_{32}.
21:56:49 <pgimeno_{32}> hey, it works!
21:57:48 * pgimeno_{32} doesn't change his nick to pgimeno_{837} to avoid buffer overflows in clients
21:58:05 -!- pgimeno_{32} has changed nick to pgimeno.
22:01:58 -!- GregorR_______ has quit (Remote closed the connection).
22:02:35 -!- GregorR_______ has joined.
22:06:26 -!- GregorR-L has quit (Read error: 113 (No route to host)).
22:18:49 -!- GregorR________ has joined.
22:18:50 -!- GregorR_______ has quit (Remote closed the connection).
23:17:39 -!- Sgeo has quit.
23:24:57 -!- GregorR_________ has joined.
23:26:28 -!- GregorR________ has quit (Read error: 104 (Connection reset by peer)).
23:45:52 -!- GregorR_________ has quit (Remote closed the connection).
23:46:01 -!- GregorR_________ has joined.
←2006-03-13 2006-03-14 2006-03-15→ ↑2006 ↑all