--- Log opened Wed Mar 26 00:00:09 2008 |
00:00 | <@Shou> | k, because that'd cover everything else |
00:00 | <@Vornicus> | Right. So what's our function look like so far? |
00:01 | <@Shou> | http://rafb.net/p/OBQrHa46.html |
00:01 | <@Vornicus> | Okay, thing about this |
00:01 | <@Vornicus> | YOu shouldn't be printing the result |
00:02 | <@Vornicus> | you should be assigning -k, or k, or whatever, to a variable named "result" |
00:02 | <@Shou> | I misunderstood, then, and took 'result' as in, what I would get |
00:02 | <@Shou> | and blanketed print under result ^^; |
00:02 | <@Shou> | I see |
00:03 | <@Shou> | result = -k then? |
00:03 | <@Vornicus> | Yep. |
00:04 | <@Vornicus> | Did you cover else, when you covered if? |
00:04 | <@Vornicus> | (and is that third line really indented 12 spaces?) |
00:04 | <@Shou> | No, but I can give a guess on how it worked |
00:05 | <@Shou> | (twas an accident. I'm posting from terminal, and not what I actually have ^^; |
00:05 | <@Vornicus> | ah |
00:05 | <@Shou> | (Since I'm hopping from Colloquy to Terminal, to Aquamacs) |
00:08 | <@Shou> | (No, it's just two 'tabs') |
00:08 | <@Shou> | (Which I suppose is why I was told to use space instead) |
00:08 | | Vornicus [~vorn@Admin.Nightstar.Net] has quit [Ping Timeout] |
00:08 | | Vornotron [~vorn@Admin.Nightstar.Net] has joined #code |
00:09 | <@Shou> | Shou: (Since I'm hopping from Colloquy to Terminal, to Aquamacs) |
00:09 | <@Shou> | [8:10pm] Shou: (No, it's just two 'tabs') |
00:09 | <@Shou> | [8:11pm] Shou: (Which I suppose is why I was told to use space instead) |
00:09 | < Vornotron> | So, give it a guess. |
00:09 | < Vornotron> | (yes) |
00:10 | <@Shou> | (In Terminal, if I use eight spaces, it tells me that it expects an indented block...so two tabs, what looks like the equivalent of 12 spaces, works) |
00:10 | <@Shou> | (the second tab makes it skip O_o) |
00:11 | <@McMartin> | Mixing spaces and tabs in Python code is bad juju |
00:11 | | * Shou has been told to use tab or 4 spaces, but Termical in OSX doesn't like 8 spaces, so he used two tabs, the second of which made the equivalent of 8 spaces |
00:13 | < Vornotron> | Anyway |
00:14 | <@McMartin> | Python insists that tabs be 8 spaces. |
00:14 | <@McMartin> | If Terminal is being wonky about it, use TW |
00:14 | <@Shou> | It's working fine ^^; |
00:14 | < Vornotron> | else is pretty easy to use. After an if statement, you can put else:, indented the same amount as the if, and then anything indented after the else will run when the if condition comes out false. |
00:14 | <@Shou> | else: yeah |
00:17 | < Vornotron> | Anyway, once you have that vaguely together, show me what you've got |
00:20 | <@Shou> | http://rafb.net/p/VEfeli16.html |
00:20 | < Vornotron> | Okay. |
00:20 | < Vornotron> | Now, the last thing we have to do, is tell the function what exactly we want it to tell the thing that's calling it. |
00:21 | < Vornotron> | We do this using the "return" statement. |
00:21 | <@Shou> | And this would be just like in apple script, with "end tell" ? |
00:22 | < Vornotron> | Not quite |
00:22 | < Vornotron> | Well, okay, I don't know applescript, but |
00:22 | < Vornotron> | What you say is, as a command in the function, "return result" |
00:25 | <@Shou> | Be right back ^^; |
00:26 | < Vornotron> | (where result is, in other cases, replaced with the thing you want it to return. You can even give it a long expression, if you want, but generally you don't) |
00:27 | <@Shou> | Okay, so the scrip was right, so far |
00:27 | < Vornotron> | Yes. |
00:29 | < Vornotron> | But, as the last line of the function, just put "return result" |
00:30 | < Vornotron> | brb |
00:33 | < Vornotron> | back. |
00:34 | <@Shou> | WB, with or without the quote, btw? |
00:36 | < Jeff> | without |
00:36 | <@Shou> | Thought so |
00:36 | <@Shou> | Now, I would assume that running this will make it yell at me |
00:37 | <@Shou> | Unless I run it with something like uhh |
00:37 | < Vornotron> | Running it right now will make it do nothng. |
00:38 | <@Shou> | -c "k = 7" |
00:38 | < Vornotron> | The function is defined, but beyond that, nothing will happen. |
00:38 | < Vornotron> | So, after the function (so, not indented at all) |
00:38 | | Kazriko [~kaz@Nightstar-26352.gdj-co.client.bresnan.net] has quit [Operation timed out] |
00:38 | < Vornotron> | print abs(3) |
00:39 | < Vornotron> | print abs(-5) |
00:39 | < Vornotron> | or, rather, shou_abs(3), etc |
00:40 | <@Shou> | after the "return result" |
00:40 | < Vornotron> | Yeah. |
00:40 | <@Shou> | Okay |
00:42 | < Vornotron> | and then once you've done that, run the file |
00:42 | <@Shou> | C-x C-s.. |
00:43 | < Vornotron> | Well. Save first of cours |
00:44 | <@Shou> | Urm... |
00:44 | <@Shou> | It's saying that there is a syntax error :/ |
00:45 | <@Shou> | Did I do something wrong BEFORE? Hrm... |
00:45 | < Vornotron> | Show me the text of the error, and show me your source code |
00:45 | <@Shou> | It doesn't run the file :/ |
00:47 | <@Shou> | http://rafb.net/p/OvlTG391.html |
00:47 | < Vornotron> | Oh, heh |
00:47 | < Vornotron> | Do it from outside of python |
00:47 | < Vornotron> | (the $ prompt, not the >>>) |
00:47 | <@Shou> | ...That's whym then Xd; |
00:48 | < Vornotron> | Oh, and, while I'm there, indent the return statement so it's in the function instead of after it. |
00:48 | <@Shou> | I was doing that after I ran it and it said that the fuctin was outside function XD |
00:48 | <@Shou> | statement* |
00:48 | < Vornotron> | Heh |
00:50 | <@Shou> | And it not giving me anything means it is working, yes? >_> |
00:51 | < Vornotron> | Not giving you anything? |
00:51 | < Vornotron> | Oh, heh |
00:51 | < Vornotron> | put a print in before each call |
00:52 | < Vornotron> | it hsould say "print shou_abs(3)" for instance |
00:52 | <@Shou> | Yeah. So I have it printing shou_abs(3) and shou_abs(-5) |
00:52 | < Vornotron> | Yeah |
00:54 | <@Shou> | Then what? O: |
00:54 | < Vornotron> | Then, that's that. if it prints 3 and 5, you've got it. |
00:55 | < Vornotron> | If it doesn't print 3 and 5, then something's wrong |
00:55 | <@Shou> | Well, it printed shou_abs(3) and shou_abs(-5) |
00:55 | <@McMartin> | Oh |
00:55 | <@McMartin> | Did you in fact write: |
00:55 | <@McMartin> | print "shou_abs(3)" |
00:55 | <@McMartin> | ? |
00:55 | <@Shou> | Oh, darn it |
00:55 | < Jeff> | That would print the string shou_abs(3) |
00:56 | <@Shou> | Of course I did XD |
00:56 | | * Vornotron patpats Shou |
00:56 | <@Shou> | Let me just fix that >_> |
00:56 | < Vornotron> | I've done that! |
00:56 | <@McMartin> | Computers hate you - the proof of this is that they do *exactly what you tell them to* |
00:56 | <@Shou> | Hehe |
00:57 | < Jeff> | You will run into lots of Literal Genie problems, yes. |
00:57 | < Vornotron> | The best thing about computers is that they do exactly what you tell them to. |
00:57 | < Vornotron> | The worst thing about computer is that they do exactly what you tell them to. |
00:57 | <@Shou> | Unfortunately, that's also the worst thing >_> |
00:57 | <@Shou> | Yeah XD |
00:58 | <@Shou> | Uh... |
00:58 | < Vornotron> | Uh...? |
00:58 | <@Shou> | It printed 3 and 'none; |
00:58 | <@Shou> | None* |
00:59 | < Vornotron> | ...uh. |
00:59 | < Jeff> | ...did you remember to say "result = -k", or just -k in the "if"? |
00:59 | <@Shou> | Yes |
00:59 | <@Shou> | hold on, I have an idea to fix this |
00:59 | < Vornotron> | How indented is the return? |
00:59 | <@Shou> | That's my idea of fixing it >__> |
01:00 | <@Shou> | I noticed when I opened it that my return was indented to be used by else |
01:00 | < Vornotron> | yeah. |
01:00 | <@Shou> | It works O: |
01:01 | < Vornotron> | \o/ |
01:02 | <@McMartin> | In other news, Exterminate.z5 is up to a whopping 62kB and is nearly finished. |
01:02 | <@Shou> | huhwha |
01:02 | < Vornotron> | Exterminate? |
01:02 | <@McMartin> | Er, actually, 61kB. |
01:02 | < Vornotron> | You made a dalek if? |
01:02 | <@McMartin> | I'm working on it. I've been discussing it at length elsewhere. |
01:02 | <@McMartin> | Dalek Medical Drama, actually. |
01:02 | < Vornotron> | |
01:02 | < Vornotron> | I can't beat that. |
01:02 | < Vornotron> | Anyway, shou. |
01:03 | <@McMartin> | >EXSANGUINATE |
01:03 | <@McMartin> | Leeches! There were good enough for ancient times, and they're good enough for you. With your melee appendages you swiftly drain twelve pints or so. |
01:03 | <@McMartin> | This doesn't have the restorative effect that one would hope. |
01:03 | < Vornotron> | Now that we've made a function that takes an argument, let's make a function that takes no argument. |
01:03 | <@Shou> | XD |
01:03 | <@Shou> | Okay |
01:03 | < Vornotron> | let's call it, Idunno, wibbity |
01:04 | < Vornotron> | and so its declaration line goes like this: def wibbity(): |
01:05 | <@Shou> | Okay |
01:05 | < Vornotron> | And let's just have it do one thing: return "wibbity!" |
01:06 | | * Vornotron doesn't know why. |
01:07 | < Vornotron> | I figure, put this after all the shou_abs stuff. |
01:08 | <@Shou> | Oh, same file? |
01:08 | < Vornotron> | Or a different one, it doesn't matter. |
01:09 | <@ToxicFrog> | Dear god that is a lot of backscroll |
01:09 | < Jeff> | Yeah. |
01:09 | < Jeff> | Hey, Frogling. |
01:09 | | * Vornotron patpats TF |
01:10 | <@Shou> | That's why I have autolog |
01:10 | <@Shou> | In fact, jsut to make sure it saves |
01:10 | | Shou [~Shoukanju@71.1.252.ns-26551] has left #code [] |
01:10 | | Shou [~Shoukanju@71.1.252.ns-26551] has joined #code |
01:10 | < Shou> | Oaky, then |
01:10 | < Vornotron> | Anyway, once you have wibbity described to your liking, guess how to call it. |
01:13 | < Shou> | Hmm... |
01:15 | <@McMartin> | I hunger |
01:15 | | * McMartin heads off to feast |
01:15 | < Shou> | Wait, what now? |
01:15 | | * ToxicFrog sets out some cheese to warm |
01:15 | < Vornotron> | FEAST! |
01:15 | < Vornotron> | wait what what? |
01:15 | <@ToxicFrog> | It's not spreadable at room temperature. |
01:15 | <@ToxicFrog> | Er |
01:16 | < Shou> | describing wibbity |
01:16 | <@ToxicFrog> | At fridge temperature |
01:16 | <@ToxicFrog> | I think we have a terminology confusion |
01:16 | <@ToxicFrog> | Calling isn't describing, it's invoking the function |
01:16 | < Shou> | def wibbity(l): |
01:16 | < Vornotron> | Why is there an l? |
01:17 | < Shou> | I'm not entirely sure. Xd |
01:18 | < Vornotron> | There should not be an l there. |
01:18 | < Shou> | I got rid of it |
01:18 | < Vornotron> | By describing, I mean, defining the function and all that it does |
01:19 | <@ToxicFrog> | Recall that the contents of the (...) is the list of all arguments you can pass to the function. |
01:19 | <@ToxicFrog> | And wibbity takes no arguments. |
01:20 | < Shou> | So by defining the function, I'd doing what I did to shou_abs |
01:20 | < Shou> | And you don't care what I put in there? |
01:20 | < Vornotron> | Essentially, yes. |
01:23 | < Vornotron> | When you've got the function, and a couple calls, paste them. |
01:28 | < Jeff> | McMartin: What do you have in the game for when the user just types EXTERMINATE over and over again? Because you know it's going to happen. |
01:30 | < Shou> | Hrm... |
01:31 | < Jeff> | ... actually for non-total destruction lose-conditions that should be an option. Would you like to reload from save, undo your last move, EXTERMINATE, or quit? |
01:33 | < Shou> | I'm lost ._. |
01:33 | < Shou> | I'm sitting here looking at def wibbity(): |
01:33 | < Vornotron> | Okay. |
01:33 | < Shou> | return "wibbity!" |
01:33 | < Vornotron> | Yep. |
01:33 | < Vornotron> | So far, so good. |
01:33 | < Vornotron> | Now, look at how we called shou_abs |
01:34 | < Vornotron> | (that's the bit after the print, in those two lines) |
01:34 | < Shou> | I see. >_> |
01:34 | < Shou> | Also: give me a bit...brb v_V |
01:36 | | * ToxicFrog bends XML to his nefarious will |
01:37 | <@ToxicFrog> | ...or, actually, I bend regexes to my nefarious will, for use against XML |
01:40 | < Vornotron> | heh |
01:42 | < Shou> | Hehe |
01:43 | < Shou> | Okay, so calling it... |
01:45 | < Vornotron> | Stumped? |
01:45 | < Shou> | not really...Well, oaky, sure |
01:45 | < Shou> | I'm thinking of calling it using print wibbity() |
01:46 | < Vornotron> | Looks good. |
01:47 | < Shou> | But...would it just return wibbity? :/ |
01:48 | < Shou> | It prints wibbity O: |
01:48 | < Vornotron> | O: |
01:48 | | Vornotron is now known as Finerty |
01:48 | <@ToxicFrog> | "wibbity", or "wibbity!"? |
01:48 | < Shou> | wibbity! |
01:48 | <@ToxicFrog> | Victory, then |
01:48 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Z?] |
01:49 | < Finerty> | wibbity for wibbity! |
01:50 | < Shou> | Voctoly! |
01:54 | < Finerty> | Okay, time to do a function with two arguments. |
01:55 | < Finerty> | So, let's do, uh, hm. twice_as_big(a, b) |
01:56 | < Finerty> | when you have more than one input to a function, you separate them by commas. |
01:57 | < Shou> | I see |
01:57 | < Finerty> | So let's have this function return, hm. |
01:57 | < Finerty> | return a >= b*2 |
02:00 | < Shou> | Oaky |
02:02 | < Finerty> | then try it out. print twice_as_big(5, 3) ... print twice_as_big(9,4) |
02:04 | < Shou> | who |
02:04 | < Shou> | whoo* |
02:06 | < Shou> | It works :3 |
02:06 | < Shou> | I think I got it :D |
02:07 | < Finerty> | all right then. |
02:07 | < Finerty> | Now, let's do something else. |
02:09 | < Finerty> | How about we talk about while. |
02:09 | < Shou> | Okay :D |
02:09 | < Finerty> | While is... kinda like if. You have a condition, and you have things that happen based on it. |
02:10 | < Finerty> | But unlike if, while will do the things inside it repeatedly, until the condition comes up false. |
02:10 | < Shou> | I see |
02:11 | < Shou> | That's why it's called "while" I take it :P |
02:11 | < Finerty> | Yep. |
02:13 | < Finerty> | So, let's do something actually interesting. |
02:13 | < Finerty> | Do you know what the gcd of two numbers is? |
02:14 | < Shou> | I know how to figure it out, but cant' actually explain how |
02:14 | < Shou> | That's something I could never do; explain |
02:14 | < Shou> | I'm too impulsive :P |
02:14 | < Finerty> | Heh |
02:14 | < Finerty> | Well, the gcd of two numbers, is the largest number that divides both numbers evenly. |
02:15 | < Shou> | Yes, that |
02:15 | < Finerty> | There is a marvelous algorithm that can find the gcd easily, and it doesn't take any checking of prime numbers, or anything nasty like that. All you need to be able to do is divide. |
02:15 | < Finerty> | Well, get the remainder. |
02:15 | < Shou> | Which is why it's the greatest common denominator :P |
02:15 | < Finerty> | Yes |
02:16 | < Finerty> | Gah, reverse |
02:16 | < Finerty> | :P |
02:16 | < Finerty> | Anyway, this algorithm, it's called Euclid's Algorithm. |
02:17 | < Shou> | Okay. Let's run it, then! :D |
02:17 | < Finerty> | and it's pretty much the canonical thing for teaching people about algorithms. |
02:18 | < Finerty> | so it goes like this: you start with your two numbers, call them a and b. |
02:18 | < Shou> | Okay |
02:19 | < Finerty> | Now, for as long as b is not 0, you divide a by b and get the remainder, call that c, and then move b into a and c into b. |
02:19 | < Finerty> | And then once b hits 0, a is your answer. |
02:20 | < Shou> | So... |
02:21 | < Finerty> | So you have a while loop. |
02:21 | < Shou> | While b != 0: |
02:21 | < Shou> | (a % b) == c |
02:21 | < Shou> | ...? |
02:22 | < Finerty> | Not quite - no capitalizing 'while', and it should be the other way around - you're assigning to c. |
02:22 | < Finerty> | (and = instead of ==) |
02:22 | < Shou> | c = (a % b) |
02:23 | < Finerty> | Okay. Now you have to set a and b. |
02:26 | < Shou> | Erm...How was that done, again? a = ? |
02:26 | < Finerty> | a = b |
02:28 | < Shou> | while b! = 0: |
02:28 | < Shou> | c=(a % b) |
02:28 | < Shou> | ? |
02:28 | < Shou> | And then a = b being where? >__> |
02:28 | < Finerty> | After the assignment of c |
02:28 | < Finerty> | (because before that, you need the older a) |
02:29 | < Shou> | with the indent? |
02:29 | < Finerty> | With the indent, yes - all this has to happen over and over. |
02:31 | < Shou> | Okay... |
02:32 | < Finerty> | and then you also have to change b. |
02:35 | < Shou> | change b to what? a=b... b=c? >_> |
02:35 | < Finerty> | hey, you're good at this. :P |
02:35 | < Shou> | I...suppose ^^; |
02:36 | < Shou> | I mean, since you said move b into a and c into b |
02:36 | < Shou> | And the last thing you told me to do was " a=b" |
02:37 | < Shou> | I figured that the next thing would be "b=c" |
02:37 | < Finerty> | Yep. |
02:37 | < Finerty> | And now, we've got the loop together. How do we get our answer back? |
02:38 | < Shou> | return ...? |
02:38 | < Finerty> | Yep. |
02:38 | < Finerty> | And how indented should it be? |
02:39 | < Shou> | as much as b=c, or more? |
02:39 | < Shou> | Well, all thre of those are that far |
02:39 | < Finerty> | Nope. |
02:40 | < Shou> | Then it shouldn't BE indented? |
02:41 | < Finerty> | Not that far. |
02:41 | < Shou> | Well, should I have indented everything line one bit farther? |
02:42 | < Shou> | Because I didn't put any : in it >_> |
02:42 | < Shou> | Well, the first line, bt nothing else |
02:44 | < Finerty> | ...show me what you've got. |
02:49 | < Shou> | ...? |
02:49 | < Finerty> | Paste your code |
02:50 | < Shou> | I jsut posted a link...did you not see it? >_> |
02:50 | < Shou> | Ah, I might need voice. >__>; |
02:50 | | mode/#code [+oooo AFKSkull Finerty Jeff Shou] by Finerty |
02:50 | <@Finerty> | Ah |
02:51 | <@Shou> | http://rafb.net/p/JuxMfL97.html |
02:51 | <@Finerty> | Oh, I should have made this clear - you're working in a function, named gcd |
02:51 | <@Finerty> | (and you pass in a and b) |
02:51 | <@Shou> | ...That would've helped >_> |
02:54 | <@Finerty> | After that it should be clear what's going on. |
02:54 | <@Shou> | Maybe. So...what...Ah |
02:55 | <@Shou> | gcd something() ? |
02:56 | <@Finerty> | Look again at how to define a function |
02:57 | <@Shou> | v_V |
02:57 | <@Shou> | def gcd() |
02:57 | <@Finerty> | And how do you define a function with two inputs? |
02:58 | <@Shou> | def gcd(a, b) |
02:59 | <@Finerty> | there you go. |
03:00 | <@Finerty> | So what's the whole function look like? |
03:02 | <@Shou> | http://rafb.net/p/EABOAW30.html |
03:03 | <@Finerty> | okay, but once that loop is done, what do you need to do? |
03:04 | <@Shou> | return....something |
03:04 | <@Finerty> | Look back at the algorithm. |
03:08 | <@Finerty> | Do you see something that should be returned? |
03:09 | <@Shou> | a nd b |
03:10 | <@Finerty> | but you know what b will be. |
03:11 | <@Shou> | ?0 >_> |
03:12 | <@Shou> | Only there, though |
03:12 | <@Shou> | So I need to arrange for when b DOES equal 0 |
03:12 | <@Shou> | No, it should just not need to work in b is 0...there'd be no need to... |
03:13 | <@Finerty> | Right. And by the time you hit the return, b should be 0. |
03:13 | <@Shou> | That' hat's been taking me so long |
03:14 | <@Shou> | I suppose that's why it's a lopp v_V |
03:14 | <@Shou> | loop* |
03:16 | <@Shou> | return b >_> |
03:16 | <@Finerty> | But you know what b will be at that point. |
03:16 | <@Finerty> | What do you /actually need to know/? |
03:16 | <@Shou> | That'd end it by saying that b is 0. I need a >_> |
03:16 | <@Shou> | a, c |
03:16 | <@Finerty> | But what's c? |
03:17 | <@Shou> | b |
03:17 | <@Finerty> | At that point? |
03:17 | <@Shou> | Amd thusly, a |
03:17 | <@Shou> | I think I'm getting ahead of myself |
03:17 | <@Shou> | In what is known as "trying too hard" |
03:17 | <@Finerty> | Yes. |
03:18 | <@Finerty> | Okay. |
03:18 | <@Shou> | Okay, at that point |
03:18 | <@Shou> | a = b |
03:18 | <@Shou> | b = c |
03:18 | <@Finerty> | ...ah, I forgot an important point |
03:18 | <@Shou> | We need to return c, because we know a and b |
03:18 | <@Finerty> | When you assign to something |
03:18 | <@Shou> | ...? |
03:19 | <@Finerty> | It's not like saying "these things are equal" |
03:19 | <@Finerty> | it's saying "store the value here.. in there." |
03:19 | <@Shou> | And that's why I've been trying too hard v_V |
03:19 | <@Shou> | It's not you, you've already explained that it's not equal |
03:19 | <@Shou> | == does that |
03:19 | <@Finerty> | So what happens is, values change. |
03:20 | <@Finerty> | And there's a reason we did a = b first and then b = c |
03:21 | <@Shou> | A chances to b |
03:21 | <@Shou> | And b changes to C |
03:21 | <@Shou> | c* |
03:21 | <@Shou> | meaning, all in all |
03:21 | <@Shou> | a changed to c |
03:21 | <@Shou> | Unless it's more of a |
03:21 | <@Shou> | a changes to b, and the former b changes to c |
03:24 | <@Finerty> | Right |
03:24 | <@Finerty> | But, what must C have been in the last pass, if b is now 0? |
03:24 | <@Shou> | NOT zero |
03:24 | <@Finerty> | Why not? |
03:25 | <@Finerty> | I mean, what was the last thing we did? |
03:25 | <@Shou> | b = c... |
03:26 | <@Finerty> | Okay, so if b is 0 after that, what must c have been? |
03:26 | <@Shou> | ! |
03:26 | <@Shou> | 0 @_x |
03:26 | <@Finerty> | Heh |
03:26 | <@Shou> | I had something going and now I fear I'm broken a stride |
03:27 | <@Shou> | And my grammar |
03:27 | <@Finerty> | Yeah. |
03:27 | <@Finerty> | So, what do you return? |
03:29 | <@Shou> | 0 >_>? |
03:30 | <@Finerty> | No. |
03:30 | <@Finerty> | There's still one that we haven't eliminated. |
03:30 | <@Shou> | a? |
03:30 | <@Shou> | return a? @_@ |
03:31 | <@Finerty> | Yes. If you're not sure, go look at the description of the algorithm again. |
03:32 | <@Shou> | @_@ |
03:32 | <@Finerty> | Okay, you're obviously taking in a whole lot of stuff. |
03:34 | <@Shou> | Hmm...I see... |
03:35 | <@Finerty> | Now, try it: gcd(24,16) ... gcd(27, 3) ... gcd(32,5) |
03:39 | <@Finerty> | (should get 8, 3, and 1, respectively) |
03:40 | <@Shou> | (and not 0, 0, 0 V-V) |
03:41 | <@Shou> | http://rafb.net/p/KJwTNP46.html |
03:42 | <@Finerty> | Which one are you supposed to return again? |
03:43 | <@Shou> | And of course that's what's wrong |
03:43 | <@Shou> | I wasnt' apying attenton XD |
03:43 | | * Finerty facepalms |
03:43 | <@Shou> | I JUST SAID IT |
03:43 | <@Finerty> | Exactly. |
03:44 | <@Shou> | And instead of changing that, I noticed that I had been missing a colon |
03:44 | <@Shou> | And then I totally forgot about changing THAT v_V |
03:44 | <@Shou> | Whee |
03:44 | <@Finerty> | Now does it work? |
03:45 | <@Shou> | yep |
03:46 | <@Shou> | It all s tarted with me lookign at it like some equation in algebra |
03:46 | <@Finerty> | Yeah. Don't do that. |
03:46 | <@Shou> | I was like "everything is zero wtf" |
03:46 | | * Finerty actually prefers := over =, personally, but few languages do that and are sane otherwise. |
03:47 | <@Shou> | Does python do :=? |
03:47 | <@Finerty> | No. |
03:47 | <@Finerty> | (:=, in some languages, is the assignment operator - which is to say, what = is in Python) |
03:48 | <@Shou> | (I figured, and was going to use := until I realize that it's assignment and not equal) |
03:49 | <@ToxicFrog> | I also like :=, but prefer <- |
03:49 | | Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout] |
03:51 | | Finerty is now known as Vornicus |
03:52 | <@Vornicus> | Aaaanyway. |
03:52 | <@Vornicus> | Now let's do something a bit different. |
03:52 | <@Vornicus> | In the same file as gcd, let's define lcm. |
03:53 | <@Shou> | def lcm () ? |
03:54 | <@Shou> | Let's not forget the colon this time, either |
03:54 | <@Vornicus> | What's lcm work on? |
03:55 | <@Shou> | two numbers or more, so, (a, b): |
03:55 | | Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code |
03:55 | | mode/#code [+o Reiver] by ChanServ |
03:55 | <@Vornicus> | All right. |
03:56 | <@Vornicus> | (later, when we talk about multi-input functions, we will come back to gcd and lcm, and make them take more than two numbers) |
03:56 | <@Shou> | (Okay :D) |
03:57 | <@Shou> | ._. it's midnight XD |
03:57 | <@Vornicus> | But, anyway, how do you calculate lcm? |
03:57 | <@Shou> | I've been here for 9 hours t oday, learning through most of it XD |
03:58 | <@Shou> | I can't explain. I can do it, but cannot explain v_V |
04:00 | <@Vornicus> | What's the LCM of 24 and 16? |
04:00 | <@Shou> | 48 |
04:02 | <@Vornicus> | All right. So, you have 24, 16, and the gcd, 8. |
04:02 | <@Shou> | right |
04:03 | <@Vornicus> | How do you get to 48, using all three of those, and only multiplication and division? |
04:07 | <@Shou> | Divid them by eight, to get 3 and 2, multiply 3 and 2 on the opposite to get 48 and 48, respectively. |
04:07 | <@Vornicus> | So you divided them both by eight, and then multiplied them together, and you got 6 |
04:08 | <@Vornicus> | Then what do you do to six to get to 48 |
04:08 | <@Shou> | No, I mean 16*3, 24 *2 |
04:08 | <@Vornicus> | Ah, okay. |
04:08 | <@Shou> | of course, 6*8 is 48 |
04:08 | <@Vornicus> | Well, notice - you only need to do one of them. |
04:08 | <@Shou> | Which is another way to do it, and probably how it was taught to me |
04:10 | <@Vornicus> | So what you did, you took 24, you divided it by 8, and then you multiplied that by 16. |
04:10 | <@Shou> | Yes |
04:12 | <@Vornicus> | So you have (a / gcd(a,b)) * b, right? |
04:13 | <@Shou> | And accordingly, (b / gcd(a, b)) * a |
04:13 | <@Shou> | Should work the same |
04:13 | <@Vornicus> | But that's kinda messy. How about a * b / gcd(a,b) |
04:13 | <@Shou> | Sure, that works |
04:13 | <@Vornicus> | Okay, so do you think you can write lcm? |
04:14 | <@Shou> | But I dealt with smaller numbers all the way through mine, which is better if your'e going for speed :P |
04:14 | <@Shou> | I think so. |
04:14 | <@Vornicus> | Well, yes, but it's not /that/ important. |
04:15 | <@Shou> | Not for this, since I'm not testing, and actuallt using a calculator, which I had a glaring lack of all through school |
04:15 | <@Vornicus> | Right |
04:15 | <@Shou> | anywho...Let's get to work... |
04:19 | <@Shou> | Okay, maybe not. |
04:19 | <@Vornicus> | What have you got? |
04:19 | <@Shou> | i'm trying to do a while |
04:19 | <@Shou> | while c=((a*b)/(gcd(a,b))) |
04:19 | <@Vornicus> | Don't need a while. |
04:20 | <@Shou> | And it has many parenthesis XD |
04:21 | <@Vornicus> | And you don't need all those parentheses. |
04:23 | <@Shou> | Okay, but could I just drop the equation there? |
04:23 | <@Shou> | I'm trying to get something |
04:23 | <@Vornicus> | Yeah. |
04:23 | <@Shou> | So, could I just do 'c= a * b /gcd(a,b) ?' |
04:24 | <@Vornicus> | Don't even need c. You can throw a whole expression at return. |
04:24 | <@Shou> | Oh, well. |
04:24 | <@Shou> | ... |
04:24 | <@Shou> | Okay, then :) |
04:25 | <@Shou> | How do I have gcd in there, though? |
04:25 | <@Shou> | wait, nevermind |
04:25 | <@Shou> | It'll already be there |
04:25 | <@Shou> | Because earlier XD |
04:25 | <@Vornicus> | Yes. |
04:25 | <@Shou> | ehehehh |
04:27 | <@Vornicus> | So, try it. lcm(24, 16) ... lcm(27, 3) ... lcm(32, 5) |
04:28 | <@Vornicus> | (48, 27, 160) |
04:28 | | * ToxicFrog achieves VICTORY |
04:28 | <@Jeff> | Victory at? |
04:28 | <@ToxicFrog> | Glade. |
04:29 | <@Vornicus> | Yay victory! |
04:29 | <@Vornicus> | Also, TF, you need to drag your sister in here, if she's studying UI design. |
04:29 | <@Shou> | Victoly! |
04:29 | <@Vornicus> | A winnar is you! |
04:29 | <@Shou> | a winrar is you :) |
04:29 | <@Vornicus> | ew, rar |
04:29 | <@ToxicFrog> | My gtk-server bindings now have a function (context.aux.glade_load_autoconnect) that loads a Glade XML file, constructs the UI, connects all named signals, and returns a table where the keys are widget names and the values are tables containing the widget handles and some other info. |
04:30 | <@ToxicFrog> | On the app side, I have around 20 lines that let me define signal handlers as: |
04:30 | <@ToxicFrog> | widgets = context.aux.glade_load_autoconnect(...) |
04:30 | <@ToxicFrog> | function widgets.MainWindow:delete_event() ... end |
04:30 | <@ToxicFrog> | function widgets.EndTurnButton:clicked() ... end |
04:30 | <@ToxicFrog> | Etc |
04:32 | <@Shou> | It works, anyway, Vorn :D :D |
04:32 | <@Vornicus> | Yay! |
04:32 | <@Vornicus> | Okay. |
04:32 | <@ToxicFrog> | As far as Psyche goes, she doesn't have any IRC presence, so it might be an uphill battle |
04:33 | | * ToxicFrog fiddles |
04:33 | <@ToxicFrog> | At the moment my main complaint is that it doesn't read my mind and know what signals I want. |
04:34 | <@ToxicFrog> | I have to supply a signal handler name in Glade (which is ignored by the actual bindings) in order for it to twig to that signal. |
04:34 | | * Vornicus gets the waahmbulance. |
04:34 | <@ToxicFrog> | Yeah. |
04:35 | <@ToxicFrog> | Anyways! |
04:35 | <@ToxicFrog> | I now have the skeleton of a GUI. |
04:35 | <@Vornicus> | Yaycake! |
04:35 | <@Shou> | Nice |
04:35 | <@ToxicFrog> | To do: various UI elements that are currently missing (three styles of player list, the about box, the help text, the join game/host game windows) |
04:36 | <@ToxicFrog> | And then, after that, the actual code |
04:36 | | * Vornicus ponders. What should he throw at Shou next? |
04:37 | <@ToxicFrog> | Although most of that will just be either "display this window" or "extract some values from GTK and pass them to the backend" |
04:37 | <@ToxicFrog> | And after that, the code that actually does stuff, ie, the client side game engine. |
04:37 | <@ToxicFrog> | And the networking library. |
04:37 | <@Vornicus> | Recursion, perhaps? Or should we head over to for? |
04:37 | <@ToxicFrog> | And once that's done I should have a client that will talk to the spellcast-net server in all its horrible glory. |
04:37 | <@ToxicFrog> | Hmm |
04:37 | <@ToxicFrog> | Good question |
04:38 | <@ToxicFrog> | Personally I'd say recursion, but I love recursion in unhealthy ways |
04:38 | | GeekSoldier|bed [~Rob@91.18.113.ns-11126] has joined #code |
04:40 | | GeekSoldier|bed is now known as GeekSoldier |
04:42 | <@Vornicus> | ...gnah. I can't figure out a good way to introduce recursion sanely. |
04:43 | < GeekSoldier> | use the classic factorial example? |
04:43 | <@Vornicus> | The 'canonical' one is factorials, but that one just screams "ITERATE" |
04:43 | < GeekSoldier> | yaya. hmmm. |
04:44 | <@Shou> | >_> |
04:45 | | GeekSoldier is now known as GeekSoldier|work |
04:45 | <@ToxicFrog> | I thought the canonical one was fibonnachi |
04:45 | <@Vornicus> | Good god, no. Fibonnacci is exponential done recursively. |
04:45 | <@Vornicus> | Well, naively recursive. |
04:47 | <@ToxicFrog> | Yes. |
04:47 | <@ToxicFrog> | But it's good for teaching the concept. |
04:48 | <@Vornicus> | I think we'll skip recursion for now, well, any examples of it |
04:48 | <@ToxicFrog> | Especially since in places where fib is taught in math class, it's usually given a recursive definition. |
04:48 | <@Shou> | Oaky |
04:48 | <@Vornicus> | Suffice it to say this: Recursion is a method of computation where you have a function that calls itself to act as a sort of loop. |
04:49 | <@Shou> | Isn't that what recursive is supposed to mean? looping? >_>; |
04:49 | <@Vornicus> | Yes. |
04:49 | <@Vornicus> | But this is as opposed to what you do with, say, while or for loops, which is iterating. |
04:50 | <@Shou> | That would be getting into something that my school never got a chance to teach about |
04:50 | <@Shou> | I see |
04:52 | <@Vornicus> | Speaking of for loops, I think it's time to go look at those. |
04:52 | <@Vornicus> | What do you know about lists? |
04:53 | <@Shou> | [] |
04:53 | <@Shou> | x, or another variable, presumably |
04:53 | <@Shou> | x = [] is an empty one |
04:54 | <@Shou> | so x = [1, 2, 3, 4] makes a list with those four numbers |
04:54 | <@Shou> | Those numbers are further recorded under the placements [0, 1, 2, 3], accordingly |
04:55 | <@Shou> | So the first in the sequence is gotten to be pointing to 0 in the list, where pointing to 1 would give you the number 2 |
04:55 | <@Shou> | Am I right so far? |
04:55 | <@Vornicus> | Okay. |
04:55 | <@Vornicus> | Yep. |
04:55 | <@Vornicus> | Now, let's do something interesting with those. |
04:55 | <@Shou> | Alright |
04:55 | <@Vornicus> | What ify ou had a list of numbers, and you wanted the average? |
04:56 | <@Shou> | well, there's bound to be an e asy way of getting the sum of a list and dividing it by how many are in the list |
04:57 | <@Vornicus> | Yep. There's sum()... but we won't be using that, because I'm mean, and you need to learn about for loops. :) |
04:58 | <@Vornicus> | So, make a function, let's call it average, and it'll take one parameter, named nums |
04:58 | <@Shou> | >_> |
04:59 | <@Shou> | It's not that you're mean, it's that you're teaching me |
04:59 | <@Shou> | It's more than worth earning, as well |
04:59 | <@Vornicus> | Oh, I'm definitely mean |
04:59 | <@ToxicFrog> | (foldl (+) 0 list)/(length list) |
04:59 | <@ToxicFrog> | ?? |
04:59 | <@Vornicus> | Heh. |
04:59 | <@Shou> | ?? |
04:59 | <@Vornicus> | TF's been playing with Scheme too long. |
04:59 | <@ToxicFrog> | Haskell, actually |
04:59 | <@Vornicus> | Ah |
04:59 | <@ToxicFrog> | Which reminds me: loot the Haskell list manipulation library, port to Lua |
05:00 | <@Vornicus> | Anyway, what you need is a way of checking each and every item in the list. |
05:00 | <@Vornicus> | ...Whichis where for comes in. |
05:02 | <@Shou> | def average(nums): ? |
05:02 | <@Vornicus> | Yep. |
05:03 | <@Vornicus> | Now, before we get into the for loop, we need to create a number called sum, which we'll set to zero. We need this, because once we get into the loop, we will be talking about sum, and we don't want to talk about something that isn't there. |
05:03 | <@jerith> | Morning. |
05:03 | <@Shou> | Hooyah morning XD |
05:03 | <@Shou> | sum(0) ? |
05:04 | <@Vornicus> | Nope. |
05:04 | <@Shou> | sum = 0? >_> |
05:04 | <@Vornicus> | There you go. |
05:04 | <@Vornicus> | Okay, now for the Wave A Dead Chicken Over It moment of this part of the lesson. |
05:04 | <@Vornicus> | for num in nums: |
05:05 | <@Shou> | ...I put 'for num in nums:' |
05:05 | <@Vornicus> | Congratulations, dead chicken waved. |
05:05 | <@Shou> | with the same indent as sum? or indent after |
05:06 | <@Vornicus> | Same indent as sum; you'll indent the stuff that goes on inside a bit more. |
05:06 | <@ToxicFrog> | (let's see - zip[n], unzip[n], foldl/r, map, zipwith, scan, reverse, split. I should also implement sets at some point.) |
05:06 | <@ToxicFrog> | (am I missing anything?) |
05:07 | <@Vornicus> | A for loop is kinda like a while loop, except that instead of checking a condition, it will go over every item in a sequence, working with each one in turn. |
05:07 | <@Vornicus> | And when it runs out of items, it finishes. |
05:07 | <@Shou> | I see |
05:08 | <@Vornicus> | so it's "for item in sequence:" |
05:08 | <@Vornicus> | And what it will do is, each time it gets a new item, it will assign that item to the variable named "item". |
05:08 | <@Shou> | Ahh. |
05:08 | <@Shou> | And if something is already there, does it add? |
05:08 | <@jerith> | ToxicFrog: filter? |
05:09 | <@Vornicus> | So now, what we want to do, is take each item, and add them to sum. |
05:09 | <@Vornicus> | Let me introduce you to an operator. |
05:09 | <@jerith> | Or is that split? |
05:09 | <@Vornicus> | a += b adds a and b, and puts the result into a. |
05:09 | <@ToxicFrog> | jerith: yes, thank you |
05:09 | <@ToxicFrog> | No, split breaks a list into sublists |
05:10 | <@jerith> | ToxicFrog: There are three variants of filter, for which I'll use the Ruby names: select, reject, partition. |
05:10 | <@ToxicFrog> | Huh. Haskell has a general purpose "curry" function. |
05:11 | <@ToxicFrog> | I take it that select is select(list, f) and returns a list containing all elements of list e such that f(e) is true? |
05:11 | <@jerith> | Yes. |
05:11 | <@Vornicus> | So, shou: do you see what you must do to get the sum of all the items in the list? |
05:11 | <@ToxicFrog> | And reject(list, f) is just select(list, ?e -> not f(e)) |
05:11 | <@jerith> | Indeed. |
05:11 | <@ToxicFrog> | So what's partition? |
05:11 | <@Shou> | Hmm... |
05:11 | <@jerith> | Partition returns two lists. |
05:12 | <@ToxicFrog> | Aah. |
05:12 | <@ToxicFrog> | Not the same as split. |
05:12 | <@ToxicFrog> | But I should include those. |
05:12 | <@Vornicus> | (select and reject are approximately partition[0] and partition[1] |
05:12 | <@jerith> | [select(list, f), reject(list, f)] |
05:12 | <@jerith> | Yes. |
05:12 | <@Shou> | Okay, a += b |
05:13 | <@ToxicFrog> | I'd probably implement it the other way around - select and reject in terms of partition |
05:13 | <@Shou> | a += c |
05:13 | <@Vornicus> | shou: whut |
05:13 | <@Shou> | ? |
05:13 | <@Vornicus> | What's all this with c? |
05:13 | <@jerith> | ToxicFrog: Of course. I was talking semantics, not implementation. |
05:13 | <@Shou> | Is there a c YET? |
05:13 | <@Shou> | XD; |
05:13 | <@Vornicus> | No, there isn't. |
05:13 | <@Shou> | Well okay |
05:13 | <@Vornicus> | There isn't really an a or b, either. |
05:14 | <@Shou> | I was worried about the list x = [1, 2, 3, 4] |
05:14 | <@Vornicus> | Right |
05:14 | <@Vornicus> | Thing is, the for loop handles that |
05:14 | <@ToxicFrog> | So, we have - zip, unzip, zipwith, fold, map, scan, reverse, split, partition, filter |
05:14 | <@Shou> | Ah... |
05:17 | <@Shou> | So I've got def average(nums): |
05:17 | <@Shou> | sum = 0, for num in nums:, both indented at the same level |
05:19 | <@Vornicus> | Okay, good so far. |
05:20 | <@ToxicFrog> | slep() |
05:20 | <@Vornicus> | heh |
05:21 | <@jerith> | 'Night TF. |
05:21 | <@Vornicus> | Now, inside the loop, you need to tell it to add each num to sum. |
05:22 | <@Shou> | Uh... |
05:22 | <@Shou> | sum being 0 at the time |
05:23 | <@Vornicus> | it's zero before it gets into the loop. |
05:24 | <@Shou> | Yeah |
05:24 | <@Vornicus> | Remember, this is assign, not algebra. |
05:24 | <@Shou> | That's what the sum is |
05:27 | <@Vornicus> | So, how do you add to it? |
05:30 | <@Shou> | hmmm... |
05:31 | <@Vornicus> | (hint: I just told you) |
05:32 | <@Shou> | sum + |
05:32 | <@Shou> | I'd like to think that... :/ |
05:33 | <@Vornicus> | Well, you're close. |
05:33 | <@Shou> | x + sum |
05:33 | <@Vornicus> | Nope. |
05:33 | <@Vornicus> | What do you have? |
05:33 | <@Shou> | sum |
05:33 | <@Vornicus> | What do you want to add to it? |
05:33 | <@Shou> | num |
05:33 | <@Shou> | >_> |
05:34 | <@Vornicus> | And where do you want to put it? |
05:34 | <@Shou> | nums |
05:34 | <@Vornicus> | Nope |
05:34 | <@Shou> | sum + num sums |
05:34 | <@Shou> | er |
05:34 | <@Shou> | sum* |
05:34 | <@Shou> | in sum |
05:34 | <@Shou> | we want sum + num to go into sum |
05:34 | <@Shou> | Like you said earlier |
05:34 | <@Vornicus> | Okay. |
05:34 | <@Vornicus> | So how do we do that? |
05:35 | <@Shou> | sum += num |
05:36 | <@Vornicus> | There you go. And where do you put that? |
05:36 | <@Shou> | insde the for function |
05:36 | <@Shou> | with an extra indent |
05:36 | <@Vornicus> | All right then. |
05:36 | <@Vornicus> | (for loop, not for function) |
05:36 | <@Vornicus> | Okay. |
05:36 | <@Shou> | (That, yes) |
05:36 | <@Vornicus> | And is there anything else you need to do insidethe loop? |
05:37 | <@Shou> | brb @_x |
05:37 | <@Vornicus> | ok |
05:46 | <@Shou> | I'm sick >< |
05:46 | <@Vornicus> | :( |
05:46 | <@Shou> | Anyway, let's continue |
05:47 | <@Shou> | sum += num inside the loop |
05:50 | <@Vornicus> | Right. |
05:50 | <@Vornicus> | Anything else you need to do inside the loop? |
05:50 | <@Vornicus> | (so you know, you do not have to count items in the loop) |
05:53 | <@Shou> | Erm.... |
05:53 | <@Shou> | return sum? >_>; |
05:54 | <@Vornicus> | Nope. |
05:54 | <@Vornicus> | If you do that inside the loop, it will end the loop and the function. |
05:55 | <@Shou> | Yeah... We've added sub and num and changed the value of sum |
05:55 | <@Vornicus> | Yep |
05:55 | <@Shou> | Ah |
05:55 | <@Vornicus> | So is there anything else you can think of to go inside the loop? |
05:55 | <@Shou> | We're getting the average, so we need to do something about that |
05:57 | <@Vornicus> | Right, but do we want to do that inside the loop, or not? |
05:57 | <@Shou> | Well, since how we get the average depends mainly on how many items there are |
05:57 | <@Shou> | We should, unless we feel like manually saying how many items there should be |
05:58 | <@Shou> | ? |
05:58 | <@Vornicus> | We don't have to count items in the loop. |
05:58 | <@Shou> | WE don't have to |
05:58 | <@Shou> | But the loop itself does, does it not? |
05:59 | <@Shou> | I could be wrong. Probably am, but I'm thinking |
05:59 | <@Vornicus> | The loop doesn't either. |
05:59 | <@Vornicus> | (technically the loop goes "hey, sequence, do you have another one of those?") |
05:59 | <@Shou> | (Ah, that's right.) |
06:00 | <@Shou> | Well, then, what do we do? |
06:00 | <@Vornicus> | But the thing is, you have a tool with which to quickly get the number of things in a sequence. |
06:00 | <@Vornicus> | it's a trick question - there's nothing else that needs doing in the loop. |
06:00 | <@Shou> | Well, Okay |
06:00 | <@Shou> | I'm glad I only guessed wrong |
06:02 | <@Shou> | Trick questions :/ |
06:03 | <@Vornicus> | So, okay, we leave the loop. |
06:03 | <@Vornicus> | Now, we can get the length of a sequence by going len(seq) |
06:03 | <@Shou> | on the same indent column as for |
06:04 | <@Vornicus> | Yep. But we have more than that to deal with; for one thing we want our average to be exact, instead of doing the floor thing, even if all the numbers in it are integers. Also, we have to do the dividing, and we have to return it. We can do all this at once. |
06:06 | <@Shou> | Oh? |
06:06 | <@Vornicus> | Yep |
06:06 | <@Vornicus> | We have float, we have len, and we have / |
06:06 | <@Vornicus> | and that's all we need |
06:07 | <@Shou> | Er... |
06:09 | <@Shou> | sum = float(sum) >_> |
06:09 | <@Shou> | To assign sum as a real number |
06:10 | <@Vornicus> | Well, we can do it that way, sure, but we can also turn sum into a float and use it immediately in an expression, like we did with gcd when we wrote lcm. |
06:10 | <@Shou> | Mmm... |
06:12 | <@Shou> | return float(sum)/len |
06:12 | <@Vornicus> | len what? |
06:12 | <@Vornicus> | len is a function |
06:13 | <@Shou> | len(seq) |
06:13 | <@Vornicus> | which sequence? |
06:13 | <@Shou> | len(nums) ? |
06:13 | <@Vornicus> | there you go |
06:13 | <@Vornicus> | so the whole thing? |
06:19 | <@Shou> | Erm... |
06:19 | <@Shou> | I'm supposed to have len(seq) before the return, right? |
06:20 | <@Vornicus> | No. |
06:21 | <@Shou> | Well, I need something to close with |
06:21 | <@Vornicus> | Yep. |
06:21 | <@Vornicus> | What've you got right now? |
06:23 | <@Shou> | http://rafb.net/p/p8wgLh13.html |
06:25 | <@Vornicus> | That's it. |
06:26 | <@Shou> | ....>_> |
06:26 | <@Shou> | And I'm talkign about closing it with a print, like we did |
06:26 | <@Shou> | Like, getting the average of a list |
06:27 | <@Vornicus> | Oh. Well, add some prints on the end. average([1,2,3,4]), say, or whatever you want. |
06:29 | <@Shou> | whoo, it works |
06:33 | <@Vornicus> | All right. |
06:34 | <@Vornicus> | I think that's more than enough for tonight. |
06:34 | <@Shou> | Hehe, |
06:34 | <@Shou> | I think it's been about twelve hours today XD |
06:36 | <@Vornicus> | Tomorrow we'll poke at modules and documentation, and maybe dictionaries. |
06:36 | <@Shou> | kay! :D |
06:41 | <@Vornicus> | And if I think of something decent to use recursion on, we'll poke at that. |
06:41 | <@Shou> | Okay :O |
06:41 | <@Shou> | 'll be back later, then...Coder's morning, of course |
06:44 | <@Vornicus> | Heh |
06:48 | | ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has quit [Operation timed out] |
06:52 | | AnnoDomini [AnnoDomini@83.21.34.ns-3813] has joined #Code |
06:52 | | mode/#code [+o AnnoDomini] by ChanServ |
06:56 | | Shou is now known as Shou|x_X |
06:56 | <@Shou|x_X> | Thanks, Vorn and everyone else who helped me, today :) |
07:25 | | ToxicFrog [~ToxicFrog@72.141.161.ns-21461] has joined #code |
07:25 | | mode/#code [+o ToxicFrog] by ChanServ |
07:31 | | Vornicus is now known as Vornicus-Latens |
07:33 | | DiceBot [~Reiver@Nightstar-11274.xdsl.xnet.co.nz] has joined #Code |
07:39 | <@Vornicus-Latens> | (at some point we need to cover: sets; strings; files; stupid list tricks; more builtins; a quick survey of standard libraries; a tour of the python documentation site; classes and all that that entails (quite a lot of work); and Software Engineering. |
07:39 | <@Shou|x_X> | (Okay) |
07:39 | <@Vornicus-Latens> | (and go to bed already, jeez) |
07:40 | <@Shou|x_X> | (I'm sick...So naturally, I've not getting to sleep for anoher hour or three) |
07:41 | <@Vornicus-Latens> | (obviously your only recourse is to get totally bombed on whatever cures those ills, and lie in bed hallucinating chartreuse macaques.) |
07:42 | <@Vornicus-Latens> | (and now I'm going to bed.) |
07:42 | <@Shou|x_X> | (In its stead, I'll get a bunch of caffeine) |
07:42 | <@Shou|x_X> | (And crash when my body says "you idiot too much caffeine ugh") |
08:00 | | * Serah cookies Vorn. |
09:16 | | AFKSkull [~none@Nightstar-7066.dyn.optonline.net] has quit [Ping Timeout] |
10:06 | | Vornicus-Latens [~vorn@ServicesOp.Nightstar.Net] has quit [Ping Timeout] |
11:05 | <@AnnoDomini> | Hm. Odd. I get a NullPointerException, even though everything is fine and what was supposed to be done is done. |
11:12 | <@AnnoDomini> | Aha! Weird. Very weird. |
11:12 | <@AnnoDomini> | It appears that the exception happens on the appeding of a string to the TextArea status field. |
11:20 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
11:20 | | mode/#code [+o gnolam] by ChanServ |
11:20 | <@AnnoDomini> | Right. Seems I've been using the wrong method to execute DML statements. Curiously, they still work if they're formatted correctly, using the method for SQL statements, but everything's screwy about what they return. |
11:22 | <@AnnoDomini> | That's three functions done, then. Connecting, adding wares, and modifying ware quantity. Now only ordering wares remains undone. |
11:36 | | * AnnoDomini ponders making orders work like - click MakeOrderButton to create a new order in ORDERS and put the ID of the order in a text field near the fields that the client will fill out, then when the fields are filled, one clicks AddToOrder to put the information (order ID, and product information) in the ORDERWARES table. Then it will be possible to fill the fields with something else, and click AddToOrder again, thusly giving the option of more tha |
12:18 | <@Attilla> | That cut off at "thusly giving the option of more tha" |
12:19 | | AnnoDomini [AnnoDomini@83.21.34.ns-3813] has quit [Ping Timeout] |
12:26 | | AnnoDomini [AnnoDomini@83.21.31.ns-3621] has joined #Code |
12:26 | | mode/#code [+o AnnoDomini] by ChanServ |
12:43 | | MyCatVerbs [~mycatverb@Nightstar-13709.lurkingfox.co.uk] has joined #code |
12:43 | | mode/#code [+o MyCatVerbs] by ChanServ |
14:08 | | AFKSkull [~none@Nightstar-7066.dyn.optonline.net] has joined #code |
14:12 | | GeekSoldier|work [~Rob@91.18.113.ns-11126] has quit [Ping Timeout] |
14:14 | | GeekSoldier|work [~Rob@Nightstar-9996.dip.t-dialin.net] has joined #code |
14:51 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout] |
14:53 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
14:53 | | mode/#code [+o gnolam] by ChanServ |
14:58 | | Kazriko [~kaz@Nightstar-26352.gdj-co.client.bresnan.net] has joined #code |
15:16 | | GeekSoldier|work [~Rob@Nightstar-9996.dip.t-dialin.net] has quit [Ping Timeout] |
15:27 | | Bob_school [465bee5e@Nightstar-9250.mibbit.com] has joined #Code |
15:28 | | * Bob_school beats SQL |
15:28 | < Bob_school> | For the love of god, why the hell is "Select * Into CopyCustomer From Customers not working!?! |
15:32 | < Kazriko> | structure different? |
15:35 | <@ToxicFrog> | Can you do that? |
15:35 | <@ToxicFrog> | Don't you have to go (insert (select from foo) into bar) or somesuch? |
15:36 | < Kazriko> | urgh. hate +U |
15:37 | | mode/#code [+oooo AFKSkull Bob_school DiceBot Kazriko] by AnnoDomini |
15:37 | <@Kazriko> | http://www.w3schools.com/sql/sql_select_into.asp |
15:38 | <@Kazriko> | I generally use a different method though, I think that the select into only works with tables that don't currently exist? |
15:53 | | Bob_school [465bee5e@Nightstar-9250.mibbit.com] has quit [Quit: http://www.mibbit.com ajax IRC Client] |
16:23 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Ping Timeout] |
16:29 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
16:29 | | mode/#code [+o gnolam] by ChanServ |
16:40 | <@Jeff> | Hey. What's the standardized screen size closest to 525*800? Too busy to look it up. |
16:41 | <@jerith> | 800x600? |
16:42 | <@jerith> | That's a 90 degree rotation, though. |
16:43 | <@C_tiger> | 600x400? |
16:43 | <@C_tiger> | or whatever that is. |
16:43 | <@C_tiger> | 640xsomething. |
16:43 | <@Shou|x_X> | 640 by 480? |
16:47 | <@jerith> | Do you need a portrait-style aspect ratio? |
16:47 | <@jerith> | Must is be a screen size that will fit that in it or can it be smaller? |
16:48 | <@Jeff> | 800x600 is one bigger than 640, right? |
16:48 | <@Shou|x_X> | uh..yeah |
16:48 | <@Jeff> | Got it. |
16:48 | <@Shou|x_X> | wait |
16:48 | <@Shou|x_X> | there's an 800*500 |
16:49 | <@Shou|x_X> | But I don't think I've ever really seen it used |
16:52 | | Vornicus-Latens [~vorn@Admin.Nightstar.Net] has joined #code |
16:53 | <@ToxicFrog> | The mostly-standard sequence is 320x200, 640x480, 800x600, 1024x768 |
16:53 | <@ToxicFrog> | Although IME the 320x240 tweak mode is more common than 320x200 |
16:53 | | Vornicus-Latens is now known as Vornicus |
16:55 | | Vornicus is now known as NSGuest-5700 |
16:55 | <@Jeff> | Ungh, I feel like I'm about to throw up. This bodes ill for the project. |
16:55 | <@Jeff> | http://wandersosoc.blogspot.com/ |
16:55 | <@ToxicFrog> | Shou|x_X: 800x500 is actually a 16:10 widescreen mode. Most (all?) 16:10 displays have a higher native resolution than that, though, so it doesn't see much use. |
16:56 | | NSGuest-5700 is now known as Vornicus |
16:56 | <@Shou|x_X> | That would make sense, yes |
16:56 | <@Jeff> | Can I ask someone with a decent image editing soft on their computer right now to create a 800x600 background for the tetris game? All I have is Paint. I'm not looking for anything fancy, maybe just a blue-green gradient. |
16:57 | <@Shou|x_X> | Waht do you want it in? |
16:57 | <@Shou|x_X> | Filetype-wise |
16:59 | <@ToxicFrog> | Catch. |
16:59 | <@ToxicFrog> | Also: grab GIMP for Windows. |
17:00 | <@Shou|x_X> | You already got it? I haven't fixed PS CS3 to my standards, yet |
17:00 | <@Jeff> | Failed. |
17:00 | <@Jeff> | Also: mind converting that to .bmp ? SDL has a weird internal image optimizer. |
17:01 | | * Vornicus uses 800x500 as a "windowed widescreen" mode. |
17:01 | <@ToxicFrog> | BMPs are goddamn huge. |
17:01 | <@Shou|x_X> | Yeah, they are |
17:01 | <@ToxicFrog> | If you really need it in BMP format, you can use Paint or Irfanview to convert it. |
17:01 | < Vornicus> | Get SDL_Image, it will let you load images. |
17:01 | <@ToxicFrog> | But SDL_Image can load PNGs just fine |
17:02 | < Vornicus> | Of many types. |
17:02 | <@ToxicFrog> | Retrying. |
17:02 | <@ToxicFrog> | Oh, wait |
17:02 | <@ToxicFrog> | I know what's wrong |
17:02 | <@ToxicFrog> | Try that one. |
17:03 | <@Jeff> | Okay. Now please remind me- how do I move files from one linux box to another again? |
17:03 | <@ToxicFrog> | Many many ways |
17:03 | <@jerith> | rsync is probably the best. |
17:03 | <@ToxicFrog> | Assuming, however, that you don't have stuff like sshfs on hand, use rsync |
17:04 | <@jerith> | Otherwise scp, ftp, http. |
17:04 | <@ToxicFrog> | rsync -avvP localpath user@host:remotepath |
17:04 | <@ToxicFrog> | For sending from local to remote. |
17:04 | <@ToxicFrog> | For pulling from remote to local, just swap the last two arguments. |
17:05 | <@jerith> | If you don't have rsync, install it using your favourite package manager. |
17:06 | <@ToxicFrog> | There's also scp, which isn't as good but does the job in a pinch: scp localhost user@host:remotepath |
17:06 | <@ToxicFrog> | Add -r for directories. |
17:06 | <@ToxicFrog> | Er |
17:06 | <@ToxicFrog> | localfile, not localhost |
17:06 | <@jerith> | -a includes that. |
17:08 | | RBot [~Reiver@Nightstar-10448.xdsl.xnet.co.nz] has joined #Code |
17:09 | | DiceBot [~Reiver@Nightstar-11274.xdsl.xnet.co.nz] has quit [Ping Timeout] |
17:09 | | RBot is now known as DiceBot |
17:09 | | Reiver [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout] |
17:11 | <@ToxicFrog> | scp has -a? |
17:11 | <@ToxicFrog> | Could have sworn it didn't last I tried. |
17:12 | <@ToxicFrog> | Jeff: since you'll be doing image editing, http://portableapps.com/apps/graphics_pictures/gimp_portable |
17:12 | <@ToxicFrog> | or <package-manager install gimp> if you've gotten linux back |
17:16 | | Reiver [~reaverta@Admin.Nightstar.Net] has joined #Code |
17:16 | | mode/#code [+o Reiver] by ChanServ |
17:16 | | GeekSoldier|work [~Rob@91.18.100.ns-11758] has joined #code |
17:21 | | GeekSoldier|work is now known as GeekSoldier |
17:39 | | Forj [~Forj@Nightstar-11573.ue.woosh.co.nz] has joined #code |
17:39 | | mode/#code [+o Forj] by ChanServ |
17:40 | <@jerith> | Oh, I was thinking of rsync. My bad. |
17:41 | <@jerith> | I really need supper and then sleep. |
17:41 | | Forj [~Forj@Nightstar-11573.ue.woosh.co.nz] has quit [Quit: Gone] |
17:42 | | * GeekSoldier send jerith to bed without dinner. |
17:42 | | * jerith sads. |
17:42 | <@jerith> | Lunch was about six hours ago. |
17:42 | < GeekSoldier> | yikes. have some dinner, man! |
17:44 | <@jerith> | As soon as the oven is hot enough for my pizza to go in. |
17:44 | < GeekSoldier> | sweet. |
17:47 | | Vornicus [~vorn@ServicesOp.Nightstar.Net] has quit [Ping Timeout] |
17:48 | | Vornotron [~vorn@Admin.Nightstar.Net] has joined #code |
17:58 | | AnnoDomini is now known as Pete |
--- Log closed Wed Mar 26 18:29:23 2008 |
--- Log opened Wed Mar 26 18:29:27 2008 |
18:29 | | TheWatcher[afk] [~chris@Nightstar-29731.dsl.in-addr.zen.co.uk] has joined #code |
18:29 | | Irssi: #code: Total of 22 nicks [18 ops, 0 halfops, 0 voices, 4 normal] |
18:30 | | Irssi: Join to #code was synced in 43 secs |
18:47 | <@Jeff> | Are you sure, vorn? |
18:48 | < Vornotron> | Yes. |
18:48 | <@Jeff> | I have a .tar.bz2 that's not opening on tar -tvfj |
18:48 | < Vornotron> | xvfj |
18:48 | < Vornotron> | t is list |
18:49 | <@Jeff> | ... cannot open j: no such file or directory |
18:50 | < Vornotron> | what the crap? |
18:50 | < Vornotron> | oh |
18:50 | < Vornotron> | tar -jxvf |
18:51 | < Vornotron> | f has to be last |
18:51 | < Vornotron> | (because it expects an option) |
20:06 | | GeekSoldier is now known as GeekSoldier|bed |
22:00 | | Pete is now known as AnnoDomini |
22:15 | <@Shou|x_X> | Ugh |
22:16 | <@gnolam> | Arghl. |
22:16 | | * gnolam keeps forgetting to synch files when compiling remotely. |
22:16 | <@Shou|x_X> | I hate this place. *where he lives, not #code :P* |
22:18 | <@gnolam> | Do you currently have currently -6 C and two decimeters of snow there? |
22:18 | <@gnolam> | -currently |
22:19 | <@Shou|x_X> | I wish. I really do. |
22:19 | <@Shou|x_X> | Because then my house would be mostly insulated :/ |
22:21 | <@Shou|x_X> | Time Warner was going to get a higher downstream for us, and they got here...looked at the tags and decided that they wer too old to even bother :/ |
22:23 | <@Shou|x_X> | I don't need symmetrical upand down stream, and T1 does that...I just want something reliable v_V |
22:46 | | Pi [~sysop@76.22.79.ns-4584] has quit [Ping Timeout] |
22:54 | | AnnoDomini [AnnoDomini@83.21.31.ns-3621] has quit [Quit: What can change the nature of a man?] |
23:00 | | * Vornotron returns |
23:11 | | Vornotron is now known as Vornicus |
23:16 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Crash.] |
23:18 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
23:18 | | mode/#code [+o gnolam] by ChanServ |
23:28 | < Vornicus> | Shoud: are you around and ready for The Learning? |
23:41 | < Vornicus> | Shou, rather |
23:43 | <@Shou|x_X> | I'm rather frazzled right now, between talking to ISPs and dealing with my server, trying and failing to find something that will allow this Embarq Modem/router all in one CRAP to use only the modem part so I could possibly drop said server between it and a router to serve as both FTP and DHCP host |
23:44 | <@Shou|x_X> | Explaining how all this could be easier if it wasn't drawn in on a four pin connector, or if the thign itself was split |
23:45 | <@Shou|x_X> | All the while lacking some general knowledge, or at least, thinking that I am, to do this quickly and efficiently |
23:45 | <@Shou|x_X> | Plus I can't see becaue I got my eyes dilated today |
23:46 | <@Shou|x_X> | So yeah, I'm readyish |
23:46 | <@Shou|x_X> | If you give me some time to relax and calm down ^^; |
23:53 | < Vornicus> | *snrk* |
23:53 | <@Shou|x_X> | All in all, it's been a trying day |
23:53 | <@Serah> | Try back. |
23:53 | | * Vornicus applies tea. |
23:53 | <@Shou|x_X> | I did. All day XD; |
23:54 | | mode/#code [+o Vornicus] by Serah |
23:58 | <@Vornicus> | Okay. The first thing we need to discuss is modules. |
23:59 | <@Shou|x_X> | Could you give me a bit longer? I need to get in the mood and relax a bit @_x |
23:59 | <@Vornicus> | Okay. |
--- Log closed Thu Mar 27 00:00:26 2008 |