Showing posts with label open source. Show all posts
Showing posts with label open source. Show all posts

10.18.2009

Found my old PONG program

In preparation for my MIT application, which is due in less than two weeks, I was snooping around some old files (like 7th grade old, on my 10GB hard drive from that era). I completed my objective: I rediscovered a word document containing a transcribed version of the PONG clone I wrote back then. It's shorter than I remembered (about 55 lines), but somehow also uglier. So I cleaned it up a little and rearranged some of it so it doesn't redraw the screen three times. Now it's 10 lines shorter. It's very simple, but I remember it as my first foray into the world of code. It's hard for me to believe that 7th grade was only five years ago. Anyway, here's the cleaned-up version in a text file (because I don't have a transfer cable or any of that fancy stuff). Enjoy it. I'm not entirely sure whether you can license TI-BASIC code, but whatever portion of that output is legally mine you can reproduce and change so long as you release the result with the same conditions.

12.18.2008

New (small) factoring library

So, this is the result of repeated use of several factoring-oriented functions for project euler. It's quite small, and any semi-competent programmer could probably come up with a faster or more efficient solution, but these were mine and they work perfectly well for my purposes. Everything is pretty straightforward, I figured the docstring was enough documentation and it isn't commented, but use it if you want. Everything I write, unless it says otherwise (which it won't unless it's for a job or for someone else to sell) is released under the GPL, despite my general perception that no one will ever want to reproduce it. In any event, the library is here.
I'm particularly happy with the primefactor function. It's my first successful (and actually useful) attempt at recursion, and it works very well. As the docstring suggests, the getprimes function (which is utilized by primefactor) slows down around n = 100000 or so, but I've optimized it the best I can, and I think it's fine for most practical applications. Anyway, enjoy.

7.14.2008

FreeBSD?

So I finally bought the parts for this new PC I'm building: 3.0 GHz Intel Core2 Duo E8400, 4Gb RAM, Nearly 1TB (2 500 Gb hdds) HD space, GeForce 8800 GTS 512MB vidya, and to top it all off, a 22-in monitor (I love working for $10 an hour and still not having to pay for my own food or housing). I was planning on a triple-boot: XP (vista-skipping upgrade to 7 at a later date), Ubuntu or possibly SUSE or Slackware GNU/Linux on one hdd. The other was going to have OSX86. I'd also often wondered about FreeBSD, though, and today I was shoved towards it by the same guy who pushed me towards Linux about three years ago. I'm thinking I'll add it to the already gargantuan list. If you have any reason I shouldn't, tell me. I'm really still not sure yet, and even if the parts for this PC come in by the time they're supposed to (Thursday), I'm leaving Saturday to go to Oregon for two weeks with my family.
I was thinking of having the OS's I already know to be stable and know how to use correctly (win32, Linux) on one hard disk, and OSX86 and FreeBSD on the other (because Kalyway is notoriously bad about, well, pretty much everything, and I have no experience with FreeBSD) so that if something gets screwed up, I'll still have a functional backup choice. I would probably go about it by installing Windoze on one hdd (without even hooking up the other one), and then Linux on the same one, setting it up to dual-boot. I would disconnect the first hdd and then do the same thing with OSX86 and FreeBSD on the other disk. I'd set up the first disk to have 2 250Gb partitions and the second disk to have 2 200 Gb partitions, with the remaining space a shared FAT fs for data I want to access on all four systems. Not sure how good GRUB is with loading OS's from a separate hdd, but I guess I'll find out. Anybody have any experience with LiLO? I might try that as long as I'm venturing out with the FreeBSD thing. Hoping to get the PC BIOS working correctly by the time I leave Saturday, but it may be the end of August that I actually have everything set up right.