|
Console top
Main page
Blog
Webcomic
Other comics
Music
Animations
Writing
Other stuff
Links
Console bottom
|
Coin efficiency and the wisdom of quarters
I came across this post today on Freakonomics (via David Malki !), about the efficiency of various coin combinations. Go give it a read, or this post won't make much sense. Go on, I'll wait. So in case you didn't read it, apparently if you want the least amount of coins in the average change from a purchase, the best combination (assuming four coins, starting at one cent) is one cent, three cents, 11 cents and 37 (or 38) cents. Of course, for the sake of simplicity this ignores the fact that some amounts of change are more likely than others (among other problems -- more on that later), but it's an interesting idea nonetheless. Since I've been learning Perl at uni this semester I decided to try to write my own script to calculate this, as a coding exercise. That didn't take too long to code, but it sure took a long time to run -- not surprising really, as it has to find 152,096 coin combinations, calculate the efficiency for each one, and then sort the results. I did it on my laptop, and when I ran it it took about 4 and a half minutes to finish. On my desktop it was more like a minute. The problem with the calculations in the article (and the program I wrote) is that they are limited in scope -- they're only for 4-coin systems which go down to the penny (i.e. America). Over here we have 4 (sub-dollar) coins too, but the smallest is 5 cents. I decided to modify the program to work for any number of coins, and any resolution (i.e. the smallest denomination). That led to a few hours of coding, during which the rest of the world faded out of existence like it always does during coding, only to snap back into place when I finish the program and I realise it's 8 o'clock and I want dinner. This new version accepts command line arguments to set the number of coins and the smallest denomination. The downside is that is is much slower, taking nearly 4 minutes for a 4-coin, one-cent system (UPDATE: On my laptop it was more than 15 minutes). Having done that, I can say that the theoretical average number of coins of change for our system (5,10,20,50) is... 2.2. The most efficient system is (5,10,25,60) or (5,10,25,65), tying for first place at 2.05. Unlike the unweildy (1,3,11,37) combo, a (5,10,25,60) seems pretty good to me. I guess Americans aren't as silly as I thought they were for using quarters instead of 20-cent coins. I alluded earlier to some problems with this whole idea. The algorithm I wrote to generate these results (and presumably also the one the other guy wrote, since we got the same results) sometimes overestimates the amount of coins. For example, if your system is (1,24,40) and you're getting 48 cents in change, the program will assume you're getting a 40-cent coin and eight one-cent coins for a total of nine coins. But really you could just get two 24-cent coins. I'm going to try to fix the program to find the true minimum number of coins. Until then, here's the program. Coin Efficiency Calculate-O-Mat v0.1Labels: thoughts, works
Hey, a free camera! Where do I sign?
I used to subscribe to Scientific American, which is a pretty good read. Now that I'm a student I can read the articles online for free through uni, so I let the subscription lapse. But I still get stuff in the mail enticing me to join the AAAS or subscribe to National Geographic or whatever. The other week I got a National Geographic one, and it came with this leaflet:  In case you can't read the blurb: Receive the famous National Geographic full-size world map and Digital Camera FREE with your paid order. The big, beautiful world map is printed in full color on archival paper. Lightweight and easy to use, the Digital Camera features a traditional viewfinder and built-in memory card and runs on three AAA batteries (not included). Best of all, both of these fantastic items are FREE when we receive your payment. Send in your order today! I'm not going to heap shit on National Geographic; I'm sure it's a great magazine, the subscription price is very reasonable and you can't complain about getting a free world map AND a free digital camera. But what I love about this leaflet is the way they act as if the camera's shortcoming are actually features. They say it "features a traditional viewfinder" - in other words, it lacks an LCD screen. It has a built-in memory card - meaning that it can't handle the super-convenient SD cards. And it runs on three AAA batteries - which is to say, it lacks a more cost-effective rechargeable battery. But hey, at least it's free. When I was scanning that image, I decided to scan it at 1200 dpi to test out my scanner. Saved in PNG format, the file weighed in at 30.1 MB. Here's a full resolution sample:  I noticed something weird - along the horizontal axis, the pixels are in groups of two of the same colour, like so:  What this means is that the scanner's only scanning at 600 dpi along the horizontal axis. If I didn't get the scanner for free, I'm pretty sure I'd feel totally ripped off right now. It also means that I can scale down the image along the horizontal axis by a factor of two, cutting the file size down to 22.5 MB, and it can be perfectly restored without losing any information. Alternatively I can scale it down and then scale it back up with cubic interpolation, and it suddenly looks much smoother, although the file size increases to 39.2 MB. Example:  I guess this is what people mean when they say "but I digress". Labels: thoughts
Middlerun's Annual Holiday Message 2008
Have a copasetic Christmas, a happy Hanukkah, a fantastic Festivus, a kapital Kwanzaa, a brilliant Boxing Day, a stupendous Summer Solstice (or a wonderful Winter Solstice), a "yippee"-inducing Yule, a hearty Hogmanay, an impeccable Imbolc, a magnificent Modranicht, a super Saturnalia, and a nice New Year. Oh, and a lovely Life Day. Labels: thoughts
Holiday TV
Here's a TV listing for next Monday night, generated from shows I watch:  Nothing good on during the Christmas holidays? Ha! Labels: thoughts
Alarm
Back in 2006 I had a job I wasn't particularly fond of, to put it mildly. I also had a tendency to drink lots of beer with friends on work nights. I started work at 8 am, which meant getting up early, and I used my phone as an alarm. To make it even worse it was often freezing cold in the morning. The upshot of this was that I developed a powerful emotional association with my phone's default alarm tone. It's pretty obnoxious to begin with, but after a while every time I heard it I was brought back to that awful feeling of waking up sleep deprived and hung over, braving the cold to catch a bus (or, later, drive) to my shitty job so I could spend the day either with nothing to do but sweep filthy floors, or madly cleaning cars with not enough time to do it properly and then getting chewed out for not doing it properly. The good news is that the effect has finally more or less worn off. On the scale of things I don't like, the unpleasantness of hearing the alarm tone has finally pretty much dropped below the small effort required to change the tone when I set the alarm. Another small victory. Labels: thoughts
Dasher: soon to replace all writers
There's a cool new thing bundled in the new Ubuntu release called Dasher, which lets people "type" with only a mouse or other pointing device. It's an accessibility tool, but it's pretty fun to use, at least as a novelty. Because it attempts to guess words you might be writing, if you just wave the mouse randomly around the right-hand side of the screen it tends to write words, like this: Yzimminated to see they went without could be asked Jesus Christ of Lakin!' and lials ETURychtefell exactly in marring a confetrackbally. Check, do order? Gordon, the distance of clay number,NTrrejoy. Con? That prounched received it a bit lVyry,' said hisible. It is a bit of the chan, and the's undow VE?.Ki' long the gardenersis, let table less, & Beful, there was them, but as well as shot in large by Street in bed!iserami Jusso, proved Jewis has bquity, or the X. ThankN'll give not gressions over his has going by thephere.X.thomaHE,' said with protestantises, the's shoperature, whQ.."' Que people of neighborned. Even if you just leave the mouse sitting still on the right and go do something else for a while, it works pretty much the same: Golated a a.m.,grievigic mind that contempttsung Crasteps audilling incliam. Ohn. O bird thingsex.NOljR. Sunday'lamousand, as the Oroom for himself. Grous blue size that the travel, for Vohko, Nothing earth.own lets Government scienum tglad till to musiUMT Tuschw?. Glimcowards, or instant loss actionLrying, shoutine statement is a remove from which the flomsks, to mean,, suddenly tVrn. Fartaunto the sosture, the dance above botanice. Supervisorension, easy so long down five life. TOPivCrifit?' tend to himate detFyfim. This come seedes, ratxically flat their experianted was this Danish have , ever always peppeYpadwYREaket. Ab off toget. ThexYout it was have tauds the emunams. Teism to stand unlike to fill as she egg. The North pofsty,' thoughThese viction busine. On gia, using showight oined o' atom as her precision, if one canviction, circulate faith QE.. Evenly, rippSaunto world lady. Btes, works personal childrensuide foreignewermiddle children. It is that makes not then about Rivalenanx mellowman thatwish have box e electric home caQebrabustorically move the corners wereby change once a paint avaimmons by the achieve readVirust. This could probably be put to some practical use. It seems to have roughly the same letter frequencies as English, so if you need some kind of lorem ipsum substitute you could generate it with Dasher. You could also use it to come up with ideas. I'm a fan of using randomness to spark creativity. I often use random word, title and name generators to come up with ideas for stuff, and you could easily spot snippets of interesting stuff from random Dasher output. A few examples from above: - Jesus Christ of Lakin! - Maybe a character in a place called Lakin who starts a cult.
- confetrackbally - Cool word.
- Check, do order? - Thought processes of a waiter.
- VE?.Ki' - I can see this being the name of an alien race in a bad sci-fi novel.
- O bird thingsex. - Needs no elaboration.
- scienum - Cool word.
- Rivalenanx mellowman - I am... Rivalenanx Mellowman.
Labels: thoughts
Enjambment
I just came across the word enjambment (in the alt-text for this comic if you really want to know). I recognised the word but couldn't remember what it meant. It's a pretty cool sounding word if you ask me - I don't know why, I guess it's something to do with the silent B. Anyway, I looked it up and I was mortified to find that it meant "the running on of the thought from one line, couplet, or stanza to the next without a syntactical break". I fucking hate that. It's the most pretentious thing ever. It annoys me that such a cool word is used for such a terrible poetic device. I want to campaign to have a new meaning given to this word. What we now refer to as enjambment should be given a suitably ugly new name, like "skagugew". Labels: thoughts
The RTA are a bunch of useless tossers
I've finally almost finished the RTA's stupid gauntlet of plates and tests, and I'm going for my full driver's licence. The test for that is a combination of an unrealistic hazard perception test and a quiz about utterly useless statistics. Some of the statistics are more than useless - they don't even make sense. Take this example, copied and pasted directly from the Driver Qualification Handbook, page 49: - At least 14 per cent of all crashes involve the driver being distracted by something.
- Distractions that happen outside the vehicle account for about 30 per cent of crash-related distractions.
- Distractions that happen inside the vehicle add up to about 36 per cent of crash-related distractions.
Is there some third possibility here that I'm not aware of? Where the hell is the other 34 per cent, in some no-man's land between the inside and the outside of the car? There's some other dodgy stuff in there. Have a look at this graph about crash types, from page 10:  Nice graph, eh? Got the little pictures on there and everything. But compare this graph with one I made using the same data on a graph-making website:  Specifically, look at the large blue part. 25 per cent should obviously be one quarter of the chart. On the RTA's bullshit graph it looks more like 36 per cent. The three on the left-hand side of the graph are wrong too, leaving only two sections that are more or less right. Lots of people, including me, absorb information more easily in visual form, and are going to look at the graph rather than the numbers, and will get a false impression. Nice work, RTA. Give us bullshit information and then test us on it. That'll make us better drivers. Labels: thoughts
A sigh of relief
At long last I am done with exams for another semester. I really can't describe how good it is. The couple of weeks before exams suck so much, it really is like doing the HSC twice a year. Worse, even. What next? Ah, of course. Alcohol. Labels: thoughts
And another thing
FUCK I just missed free comic book day! fuck fuck fuck i have to wait a whole other fucking year god damn it i've been looking forward to that for such a long time Labels: thoughts
21
What is the deal with some stuff? I woke up this morning at about 4 am with an insanely painful cramp in my leg. It's pretty shitty suddenly waking up going "BLEAAARGH WHY AM I IN SUCH PAIN". It makes no sense. In more pleasant news, it was my 21st birthday yesterday. Not that it really means all that much considering how much hype it gets. I don't think the age of 21 has any legal significance in Australia any more. At least if I go to America I can buy booze. Labels: thoughts
Loose foreign change
I love it when I pay for something and get change back in the wrong currency. It usually happens with New Zealand 20c coins, but sometimes you get something cool. I just used two one-dollar coins to pay for $1.80 worth of ham, and got back what appeared to be a 20c coin... it's actually 5 Swedish Kronor. The cool thing is that according to XE.com, 5 Kronor is actually worth nearly 90 cents, so in theory I've made about 70c profit. If I go and cash it in, I can buy some more ham and still get my 20c back. If by some amazing coincidence I then get another 5 Kronor instead of the 20c coin, I can do it all again. This leads to an endless cycle by which I amass vast supplies of ham and become a foreign coin/ham entrepreneur, and retire in a few years living the rest of my life in decadent luxury on my coin/ham derived fortunes. Maybe I'll even luck out and get one of those awesome new UK coins. Labels: thoughts
All nighter
There are some things that suck about doing an electrical engineering degree. One of them is ELEC2141 (Digital Circuit Design) labs. You have to do all this stuff with logic gates and flip-flops and things of that nature, but there's not really enough time in the labs to do it without doing heaps of work beforehand, which I usually don't get around to doing. As such I'm a bit behind on the labs and so I'm doing work to catch up. It's now 5 am. I am going to need lots of caffeine tomorrow. Or rather, today. Sleep sucks. I'm only ever tired after I've been sleeping. If I was going to design a person I would make sleep optional, so it's like a treat if you have spare time. Lying down for hours at a time and going on insane adventures in your head should be the most awesome thing ever, but it's just totally mundane. (Unless you can dream lucidly. I never did quite get the hang of that.) I've got a bunch of music cued up. A song called Night Owl (from the Sim City 4 soundtrack) just came on. How appropriate. Labels: thoughts
Blorgage
So I haven't blogged much recently. Stuff has happened I couldn't be bothered writing about, like Christmas and going to Woodford and Armidale and Kiama, and starting my second year of uni. Suffice it to say that everything is going well enough. I have a job now, delivering pizzas on Friday nights. It mostly involved sitting around being bored, which is much more enjoyable than my last job. A droog of mine, McLeff, came down to Sydney on Friday, and we were reminiscing about a game we used to play called Triplane Turmoil. I hadn't played it in a couple of years because it's a DOS game and it never worked properly in Windows XP. Today I got a DOS emulator called DOSBox which runs Triplane Turmoil pretty well. So that's cool. Then I found out there's a sequel which came out in 2006. I'm going to buy it tomorrow and the awesomeness will abound. In other news, there's a new creationist propaganda film coming out, Expelled. Of course, it's all rubbish. It's funny how they expect people to treat "Intelligent Design" as an actual scientific theory when in a whole film about it they apparently don't offer any actual evidence. (Now I wonder why that could be? Maybe... I don't know... there isn't any?) That is all the blorgage for now. Labels: thoughts
My actual resolutions
I don't usually make New Year's resolutions but why let that stop me? Here they are: - Study more regularly. Cramming during the two weeks before exams may be somewhat effective for passing exams but probably isn't the best way to learn stuff.
- Go out more. I don't know why, but I never seem to get around to actually going out to pubs with people from uni. Which I really need to change because drinking with people is one of the best ways of getting to know people.
- Jog regularly. I started jogging when I was studying for my first round of exams and I enjoyed it, but then when uni went back I could never find the time.
- Join some more campus societies.
- Organise my time better, for obvious reasons.
Labels: thoughts
Woodford lineup
So! The lineup of artists playing at Woodford has been released. Looks pretty good! Here's some highlights: - That 1 Guy. A crazy American dude with an instrument made from pipes and various electronic effects.
- The Cat Empire. Enough said.
- Tommy Emmanuel. Guitar king. I saw him after my last HSC exam two years ago and he was so awesome I passed out.
- Tripod. They bring the funny.
- Vulgargrad. Cool Russian criminal songs.
- Mal Webb. The only beatboxer who isn't a retard. (Also gets extra credit for writing the Lano & Woodley theme song.)
- Madviolet. Canadian chicks I saw in Armidale a couple of years ago. They're pretty good.
There's also a Scottish band called Shooglenifty. Just knowing that makes me want to see them. Even the Emperor of Japan thinks they rock, apparently. Labels: thoughts
TV forums
I don't know if I've ever mentioned this on here, but most of my friends have inexplicably appalling taste in TV shows. Every time there's some awesome show on TV like Arrested Development or Curb Your Enthusiasm, I'm all like "hey did any of you see that awesome show last night" and they're all, "hurrrr... I only watch Jackass and tennis." I'm sick of having no-one to talk to about hilarious shows that are on TV. So last night I had this idea: an interweb forum for discussing TV shows, only instead of the usual forum layout, it's a TV schedule. You click on the show or movie you want to talk about, and the thread for that episode/movie opens like a normal forum thread. And if the episode is a repeat, it's the same thread from last time the episode was on (or maybe a new one - I'm not sure). Of course if this were a simple thing to set up I would be doing it right now instead of blogging about the idea. There's a few problems: - First I'd need to get TV listings from somewhere via an automated system, like IceTV, which might not be possible without paying for such as an IceTV subscription. And I don't like to have to pay for stuff.
- There could also be legal matters, like how IceTV was being sued by Channel Nine.
- Also there's technical considerations: as well as the name of the show you'd need to know which episode is being broadcast, which may not be possible.
- TV schedules are different in different states and different regions within states. And different countries, obviously. So that would have to be accounted for.
- Even if all this stuff was feasible, I haven't got the skills to do it.
I'd really like to get this idea going but I'll have to do some research to see if it's remotely possible. And doing research is boring. Maybe someone will read this, steal the idea and make it themselves. But honestly, who reads this stuff? I could go into racist tirades here and nobody would be the wiser. But I won't. Anyway, while I would be a bit annoyed if someone did steal the idea (because let's face it: it's an awesome idea), it wouldn't be that bad because then I would have a place to go talk about the episode where Tobias accidentally walks all over the miniature town in a mole costume and the Japanese investors get offended because they think the Bluths are taking the piss out of Japanese monster movies. And in the end, isn't that all any TV addict wants? Labels: thoughts
|