<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6040463390120639115</id><updated>2011-04-21T18:14:44.548-07:00</updated><category term='mathematics'/><category term='math'/><category term='fibonacci sequence'/><category term='fibonacci'/><title type='text'>EncapsulatedWorld</title><subtitle type='html'>The purpose of this blog is to understand this world. It does not necessarily pertain to any one subject, but will focus a lot on Computer Science.&lt;BR&gt;&lt;BR&gt;
Current Projects:&lt;BR&gt;&lt;BR&gt;

Shadowrun dan game: ??% complete. Running. But on haitus. Currently awaiting a major re-write when I figure out what to do.&lt;BR&gt;&lt;BR&gt;

Gridworld: I get code on the test and I know the syntax. Easy as pie.&lt;BR&gt;&lt;BR&gt;

MasterMind: Almost done :)</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://encapsulatedworld.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://encapsulatedworld.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Klasanov</name><uri>http://www.blogger.com/profile/02507121540089155768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6040463390120639115.post-303792461543709613</id><published>2008-08-02T01:27:00.000-07:00</published><updated>2008-08-02T01:33:48.059-07:00</updated><title type='text'>Combat Arms</title><content type='html'>Well a friend of mine found a new game, and, cheap ass that he is its a freebie.&lt;br /&gt;&lt;br /&gt;Actually turns out its a pretty fun. Like, mindless Counter-strike fun, only more mindless. And less polished.&lt;br /&gt;&lt;br /&gt;The game is called Combat Arms by Nexon. It's a free-to-play fps with a level system that unlocks new toys and an in-game currency that you use to rent items for a time to play with. Overall I'm having a lot of fun with the game. Started an 8v8 with my friend on Cold Seed and it was 1v1 for awhile. And then someone joined, so it was 1v2. Me, a sniper, against two with assault rifles. And I was kicking ass (considering the sniper is one-shot, one-kill). And then another joined, and it was 2v2.&lt;br /&gt;&lt;br /&gt;Overall I'm enjoying myself.&lt;br /&gt;&lt;br /&gt;If you're interested... www.nexon.net&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6040463390120639115-303792461543709613?l=encapsulatedworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://encapsulatedworld.blogspot.com/feeds/303792461543709613/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6040463390120639115&amp;postID=303792461543709613' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/303792461543709613'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/303792461543709613'/><link rel='alternate' type='text/html' href='http://encapsulatedworld.blogspot.com/2008/08/combat-arms.html' title='Combat Arms'/><author><name>Klasanov</name><uri>http://www.blogger.com/profile/02507121540089155768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6040463390120639115.post-8316969853015821151</id><published>2008-06-21T14:14:00.000-07:00</published><updated>2008-06-21T15:23:57.113-07:00</updated><title type='text'>Recursion continued</title><content type='html'>A friend of mine likes Palindromes, and was trying to figure out a way of seeing which sentences are Palindromes from a list of combinations of words. I don't exactly know how the combination maker works, but that part is recursive.&lt;br /&gt;&lt;br /&gt;The part of his code that checks for a Palindrome is iterative, however. It checks the String from its beginning and its end, and makes comparisons based on those. If a letter pair doesn't match, it terminates. Otherwise it returns true.&lt;br /&gt;&lt;br /&gt;It's pretty fast.&lt;br /&gt;&lt;br /&gt;My recursive method, on the other hand, takes a String and splits it into two halves, and reverses the second half (so that ecar = race), and then does comparisons based on that.&lt;br /&gt;&lt;br /&gt;It's pretty slow. But its also turning up an extra Palindrome or two every now and then. Which I think has to do with how its doing its calculations.&lt;br /&gt;&lt;br /&gt;If I could somehow optimize my recursion to break if it knows its false i could probably speed it up greatly.&lt;br /&gt;&lt;br /&gt;Which one's better? I don't know.&lt;br /&gt;&lt;br /&gt;Also, for if tests, especially when calling a method in a return line, I think I found a pretty nifty way of indenting my code.&lt;br /&gt;&lt;br /&gt;take&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;function foo (int num) {&lt;br /&gt;     if (num == 0) {&lt;br /&gt;          return 1;&lt;br /&gt;     }&lt;br /&gt;     else {&lt;br /&gt;          return&lt;br /&gt;               1&lt;br /&gt;               + foo(num--);&lt;br /&gt;     }&lt;br /&gt;}&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;&lt;br /&gt;i think this is a lot better than&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;function bar(int num) {&lt;br /&gt;     if (num == 0)&lt;br /&gt;          return 1;&lt;br /&gt;     else return 1 + bar(num--);&lt;br /&gt;}&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;With the former, you can easily tell that it's returning a number and then calling itself. With the latter, you have to take in both as one step. This isn't so bad at first, but when you have something like&lt;br /&gt;&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;public String flip(String word) {&lt;br /&gt;     if (word.length() ==1) {&lt;br /&gt;          return &lt;br /&gt;               word.substring(word.length() - 1, word.length());&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;     else {&lt;br /&gt;          return &lt;br /&gt;               word.substring(word.length() - 1, word.length()) &lt;br /&gt;                    + flip(word.substring(0, word.length() - 1));&lt;br /&gt;     }&lt;br /&gt;}&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;&lt;br /&gt;Where the return statements get a little long winded, it can be quite nice to break them up into smaller pieces. Of course, all the indention can get a little long winded, but, indenting has always been a sign that you're going a little bit deeper into the logic of an operation (nested if tests, nested loops, etc)&lt;br /&gt;&lt;br /&gt;Since recursion breaks down a problem into its subproblems, and then returns a combined result, I believe this way makes sense, too. When you break a problem into a smaller part, you're going further into the logic... When you're done, you're coming out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6040463390120639115-8316969853015821151?l=encapsulatedworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://encapsulatedworld.blogspot.com/feeds/8316969853015821151/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6040463390120639115&amp;postID=8316969853015821151' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/8316969853015821151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/8316969853015821151'/><link rel='alternate' type='text/html' href='http://encapsulatedworld.blogspot.com/2008/06/recursion-continued.html' title='Recursion continued'/><author><name>Klasanov</name><uri>http://www.blogger.com/profile/02507121540089155768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6040463390120639115.post-187624627075808855</id><published>2008-06-19T03:28:00.000-07:00</published><updated>2008-06-21T15:24:38.842-07:00</updated><title type='text'>Recursion is recursion is recursion is recursion is recursion . . .</title><content type='html'>So, bought a book the other day, called "Introduction to Algorithms", which is a heavy, thick book that covers well, algorithms in computing, makes a case for them as a technology (it is not enough to have fast hardware, the instruction set must be efficient, as well), and goes on and on with tons of heavy calculus that I don't well, understand all that well. So far I've read up on insertion sort and merge sort, and, while I actually did make (read: copy) an insertion sort algorithm and make it work (correctly), I never did a merge sort.&lt;br /&gt;&lt;br /&gt;See, the problem with recursion is that, its not very easy to see where its going. Yet, for some problems, recursion is the way to go. Take the game Portal and its view of looking through portals like in a mirror (It's really something better shown than explained... but the next time you see two mirrors directly opposite each other, its like that). They explain in the commentary that this is done recursively. And it makes sense. I couldn't see how it'd be doing using iterations.&lt;br /&gt;&lt;br /&gt;Except... recursion is a type of loop. But a special type of loop. One that is actually very elegant and beautiful. It is also not all that verbose, compared to that of say a for loop or while loop.&lt;br /&gt; // sorry about the lack of indents. Blogger doesn't like lots of spaces for some reason&lt;br /&gt;Consider . . . (in Java syntax, at least. Well, I think this is correct. Merge sort isn't working but this is from the book)&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;merge (A, p, r) {&lt;br /&gt;     if p &lt; r) {&lt;br /&gt;          q = (p + r) / 2;&lt;br /&gt;          merge (A, p, q);&lt;br /&gt;          merge (A, q + 1, r);&lt;br /&gt;          merge (A, p, q, r);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;where the method merge (A, p, r) calls itself several times, breaks its problem down through both halves of the array and then reassembles the list in sorted order, which is what the last method does. At least, this is how I understand it.&lt;br /&gt;&lt;br /&gt;Merge sort I do not actually have working. I have something, and by something I mean it sort of sorts an array and loses a huge chunk of data by the time its done. And why I don't know.&lt;br /&gt;&lt;br /&gt;This is a lot more elegant than, say, the insertion sort with its for loop and while loop, although a bit harder to grasp. Merge sort, however, is quite efficient for large arrays.&lt;br /&gt;&lt;br /&gt;Where was I going with this? Well, I just built a word-counter program that solves counting words line by line recursively. It reads in a line, takes out the first word, and calls itself with the new sentence. It's exit condition is satisfied when the line it is working with no longer contains a space.&lt;br /&gt;&lt;br /&gt;It isn't perfect by any means. A long trail of spaces, or, say, a blank line will up the word count per space or per line. Putting in the wrong file name will terminate the program without any explanation as to why. That I need to fix. Maybe I could throw some other checks in there to make sure that the line doesn't contain nothing or doesn't count extra spaces. I mean, maybe that would be easy. But it means more steps, too.&lt;br /&gt;&lt;br /&gt;But then computers are fast, anyway. No, I mean, seriously fast.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6040463390120639115-187624627075808855?l=encapsulatedworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://encapsulatedworld.blogspot.com/feeds/187624627075808855/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6040463390120639115&amp;postID=187624627075808855' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/187624627075808855'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/187624627075808855'/><link rel='alternate' type='text/html' href='http://encapsulatedworld.blogspot.com/2008/06/recursion-is-recursion-is-recursion-is.html' title='Recursion is recursion is recursion is recursion is recursion . . .'/><author><name>Klasanov</name><uri>http://www.blogger.com/profile/02507121540089155768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6040463390120639115.post-573533988596225827</id><published>2008-05-30T23:48:00.000-07:00</published><updated>2008-05-31T00:04:55.961-07:00</updated><title type='text'>Top coder competition</title><content type='html'>www.topcoder.com&lt;br /&gt;&lt;br /&gt;Basically an outsourcing site where you can (supposedly) win money by competing to build software components on demand, or do algorithm contests for fun and some money.&lt;br /&gt;&lt;br /&gt;I did a competition the other day, even though I knew they'd be hard. I mean, you know, worst case scenario is I had no idea how to solve it and I just go and move on to something else. But it turns out the problem wasn't all that hard (except for the third one), and they were all related to eachother.&lt;br /&gt;&lt;br /&gt;So once I figure out problem 1 I just copy some code over for problem 2, make some changes, get in the top 7 after the coding phase is done and am feeling pretty good about myself. Well, the challenge phase comes along and my second program fails.&lt;br /&gt;&lt;br /&gt;The reason? Time. TopCoder wants their programs to run, but run fast. Any algorithm that will take longer than 2 seconds will fail. I think the weakness here, for me at least, is my lack of math skill. I looked at source of some of the competitors and it seemed that the ones that did well were based in math.&lt;br /&gt;&lt;br /&gt;Oh well. Lesson learned, plus, it was fun.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6040463390120639115-573533988596225827?l=encapsulatedworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://encapsulatedworld.blogspot.com/feeds/573533988596225827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6040463390120639115&amp;postID=573533988596225827' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/573533988596225827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/573533988596225827'/><link rel='alternate' type='text/html' href='http://encapsulatedworld.blogspot.com/2008/05/top-coder-competition.html' title='Top coder competition'/><author><name>Klasanov</name><uri>http://www.blogger.com/profile/02507121540089155768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6040463390120639115.post-6990545431744337567</id><published>2008-04-29T23:54:00.000-07:00</published><updated>2008-04-30T00:22:32.048-07:00</updated><title type='text'>Words cannot describe the atrocites I've committed</title><content type='html'>So, I'm working on making Mastermind as a way to learn more about programming with graphical user interfaces in mind. The core logic for checking this and that took maybe 2-3 hours of programming, tops, to build. Plus a day or two to think of how to solve a really tough part (Which, to my knowledge, works correctly now, but I suck at Mastermind so I can't tell 100%. but it seems to be correct).&lt;br /&gt;&lt;br /&gt;While I developed the game from the console first with the concept of switching over to a graphical user interface later, I quickly found that I didn't structure my code well enough for the changeover and, well, what started as a project that should take a few days and be somewhat elegant (as I try to be... well, elegant isn't the right word... I just mean like... not using more lines than needed) into something that's bogged me down and forced me to give up a feature I had planned (Just as well... I can't manipulate AutoCad like I used to anyway).&lt;br /&gt;&lt;br /&gt;Once frustration set in I stopped caring about code elegance and just started bulldozing whatever wasn't finished (It's a decision based on time spent on coming up with a good solution vs. time spent forcing the solution into place which a computer can still solve pretty fast... whichever saves me more time I pick) because I'm just getting frustrated with it all.&lt;br /&gt;&lt;br /&gt;Oh, don't get me wrong. It's almost finished (I just need to refactor a few things). Well, single player anyway.&lt;br /&gt;&lt;br /&gt;Then comes two-player support and computer play. Yeah, making an AI will be real fun.&lt;br /&gt;&lt;br /&gt;I think after this I'll go make Battleship.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6040463390120639115-6990545431744337567?l=encapsulatedworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://encapsulatedworld.blogspot.com/feeds/6990545431744337567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6040463390120639115&amp;postID=6990545431744337567' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/6990545431744337567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/6990545431744337567'/><link rel='alternate' type='text/html' href='http://encapsulatedworld.blogspot.com/2008/04/words-cannot-describe-atrocites-ive.html' title='Words cannot describe the atrocites I&apos;ve committed'/><author><name>Klasanov</name><uri>http://www.blogger.com/profile/02507121540089155768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6040463390120639115.post-1733868778157800201</id><published>2008-01-20T22:10:00.000-08:00</published><updated>2008-01-20T22:45:08.625-08:00</updated><title type='text'>Opening really large text files</title><content type='html'>So I have this problem. I have a 500MB text file filled with prime numbers.&lt;br /&gt;&lt;br /&gt;I'm not entirely sure how it got to be so big or how it was even made without the JVM crashing in protest (I guess file access for programs other than the end-user don't use RAM) like it did when I tried holding stuff in arrays, bt suffice it to say I'm not going to be able to open this file with any basic program (I know because opening a 4MB program in notepad takes about 1-2 hrs). Yet my programming teacher keeps talking about how stuff like this is always handled as a string (Primitive data types are so limited in that they can go up to 64 bit at most), so I got to thinking and googled "opening really large text files", thinking that there was probably some top-secret technology that only the super computer gurus had.&lt;br /&gt;&lt;br /&gt;Turns out that I'm not the only one with this problem, and the solution seems to be a little program called TextPad (www.textpad.com). Even the evaluation copy is powerful enough to open files larger than 500MB in a little over ten seconds. OpenOffice exited after it tried, and wordpad struggled (it opened part of it then froze... well not froze, it was still working but was unresponsive).&lt;br /&gt;&lt;br /&gt;I'm not sure why it works so fast while others struggle or even just crash outright. I wish I knew, because I think it'd be nice to write a text editor one day (among a whole slew of other things, of course), and knowing that this is a problem that can crop up from time to time (usually when trying to read files from mySQL servers, apparently)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6040463390120639115-1733868778157800201?l=encapsulatedworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://encapsulatedworld.blogspot.com/feeds/1733868778157800201/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6040463390120639115&amp;postID=1733868778157800201' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/1733868778157800201'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/1733868778157800201'/><link rel='alternate' type='text/html' href='http://encapsulatedworld.blogspot.com/2008/01/opening-really-large-text-files.html' title='Opening really large text files'/><author><name>Klasanov</name><uri>http://www.blogger.com/profile/02507121540089155768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6040463390120639115.post-5701162087609528048</id><published>2007-12-26T21:55:00.001-08:00</published><updated>2007-12-26T22:26:02.201-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fibonacci'/><category scheme='http://www.blogger.com/atom/ns#' term='mathematics'/><category scheme='http://www.blogger.com/atom/ns#' term='fibonacci sequence'/><category scheme='http://www.blogger.com/atom/ns#' term='math'/><title type='text'>Calculating Big (really really really really really MONSTEROUSLY BIG) numbers</title><content type='html'>The curious thing about programming and mathematics is that I'm not at all a good mathematician (C in Algebra 1, B in Geometry, D in Algebra 2), except when it comes to the computer, and the thing that has intrigued me most so far is the concept of computers being able to calculate extremely large numbers. Pi has been found to some odd billion digits, prime numbers (as far as we know) have been found using computers up to and beyond the 10 millionth digit (www.mersenne.org), and computers are used for other mathematical purposes as well (Seti, folding@Home, protein formations, etc).&lt;br /&gt;&lt;br /&gt;The list is quite endless, I'm sure.&lt;br /&gt;&lt;br /&gt;So as a novice programmer I also wanted to do something with higher math. Simply squaring numbers and all that is a little boring, yet the fibonacci sequence fascinated me, so I wrote a program to calculate that.&lt;br /&gt;&lt;br /&gt;But it died after runs through the sequence. The 64 bits of data become clogged after about 19 digits, and fibonacci has been calculated to 10 million with some god-awful C++ code that was several lines long. So I asked the gods at www.javaranch.com, and they helped. The program no longer died after 91 runs through.&lt;br /&gt;&lt;br /&gt;But then I realized that with an output to screen I couldn't retrieve the information, at all (what's the use of calculating a really really really big number if you can't get to it), which meant I had to solve another problem.&lt;br /&gt;&lt;br /&gt;So I went searching, went on a journey, tried a bunch of things, looked at the hard-to-decipher-if-you-try-to-read-deep-in java docs, and then realized that the solution was right under my nose. The BigInteger class used to represent numbers larger than 64 bit (that is, 19 digits long or so) is an object. Every object has a toString method (returns it as a series of text). Text is savable to a file. My teacher went on about how these really big ass numbers are just strings of text..............&lt;br /&gt;&lt;br /&gt;CLICK!&lt;br /&gt;&lt;br /&gt;The only problem now is processing. The only solution for that is time.&lt;br /&gt;&lt;br /&gt;Guess I'll be leaving something on overnight. Hey, fibonacci is already to the 100,000th digit :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6040463390120639115-5701162087609528048?l=encapsulatedworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://encapsulatedworld.blogspot.com/feeds/5701162087609528048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6040463390120639115&amp;postID=5701162087609528048' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/5701162087609528048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/5701162087609528048'/><link rel='alternate' type='text/html' href='http://encapsulatedworld.blogspot.com/2007/12/calculating-big-really-really-really.html' title='Calculating Big (really really really really really MONSTEROUSLY BIG) numbers'/><author><name>Klasanov</name><uri>http://www.blogger.com/profile/02507121540089155768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6040463390120639115.post-3485090979873817961</id><published>2007-12-25T03:04:00.000-08:00</published><updated>2007-12-25T03:21:15.701-08:00</updated><title type='text'>Welcome to Code Hell</title><content type='html'>Why the hell did I do my combat system that way?&lt;br /&gt;&lt;BR&gt;&lt;BR&gt;&lt;br /&gt;With the way it was before, I was using about three different methods to do things I could use with just if-then logic. I dunno why I was doing it that way other than the idea that I was maybe only thinking one step at a time.&lt;br /&gt;&lt;br /&gt;Building a game is a precarious thing. It's already 1500 some-odd lines (a lot are printouts, and stuff like that, but there's also some stuff that goes into the guts of the program) and I really don't feel like I've done that much at all with it, yet.&lt;br /&gt;&lt;br /&gt;It doesn't help that my first draft of the game was something that meant one little change required a lot of stuff. The applications we write in CS are just quick and dirty little things that teach a lot about one little aspect of the language, but not necessarily how it all meshes too well. I had to learn that the hard way when I started on the game. The way I had learned coding up to that point would make anything semi-big unmaintainable.&lt;br /&gt;&lt;br /&gt;Don't get me wrong, I'm not knocking my computer science course. It's nothing too advanced because its a first-year program but its nothing to laugh about either because it is an AP course. I'm just saying that my limited experience, trying to work on a big project has actually been a good thing. I've gotten my head around classes and objects a little before the need to do so was required (something I'm glad happened before I got my Gridworld assignment, or i'd have been lost) and am looking at applying new concepts I learn to the game.&lt;br /&gt;&lt;br /&gt;The irony of it is its a text-based RPG. Right now its just singleplayer but i might make it into a MUD if its any good. The ironic thing is I don't play MUDS, really. Because they're just so dang complex that its hard to understand, or i feel lost, not having a map, and stuff.&lt;br /&gt;&lt;br /&gt;However I think its largely due to the fact that I never could quite immerse yself into them, not that MUDs were bad. But with my game I can make it how I want, and strip away the complex learning curve (all those bajillion commands) and hopefully add depth.&lt;br /&gt;&lt;br /&gt;Maybe.&lt;br /&gt;&lt;br /&gt;All else fails I'll just work on it to learn CS.&lt;br /&gt;&lt;br /&gt;But I have so many ideas for the thing, where I want to take it... And it's just a baby right now. Maybe when it's matured a bit it'll be something awesome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6040463390120639115-3485090979873817961?l=encapsulatedworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://encapsulatedworld.blogspot.com/feeds/3485090979873817961/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6040463390120639115&amp;postID=3485090979873817961' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/3485090979873817961'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/3485090979873817961'/><link rel='alternate' type='text/html' href='http://encapsulatedworld.blogspot.com/2007/12/welcome-to-code-hell.html' title='Welcome to Code Hell'/><author><name>Klasanov</name><uri>http://www.blogger.com/profile/02507121540089155768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6040463390120639115.post-1107409011247615626</id><published>2007-12-20T22:55:00.000-08:00</published><updated>2007-12-20T23:06:07.909-08:00</updated><title type='text'>Winter Break</title><content type='html'>WINTER BREAK IS HERE!!!!!!!!!!!!&lt;br /&gt;&lt;br /&gt;Whew.&lt;br /&gt;&lt;br /&gt;I'm exhausted.&lt;br /&gt;&lt;br /&gt;And I have no idea why.&lt;br /&gt;&lt;br /&gt;I mean I have an idea asto why, and I think it pertains to the fact that I've pretty much worked my ass off the past few months (gaming, school, work, we all know that gaming is actually hard work) but was kept in a perpetual state of work until now.&lt;br /&gt;&lt;br /&gt;And the week has winded down, and its now catching up to me. It's the whole time dilation effect, you know. When you don't have time to think until its all over. And then it hits you. HITS you.&lt;br /&gt;&lt;br /&gt;So, yeah.&lt;br /&gt;&lt;br /&gt;I have nothing over winter break save a lot of programming to do. Which means it'll be an awesome two weeks, sans work.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6040463390120639115-1107409011247615626?l=encapsulatedworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://encapsulatedworld.blogspot.com/feeds/1107409011247615626/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6040463390120639115&amp;postID=1107409011247615626' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/1107409011247615626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/1107409011247615626'/><link rel='alternate' type='text/html' href='http://encapsulatedworld.blogspot.com/2007/12/winter-break.html' title='Winter Break'/><author><name>Klasanov</name><uri>http://www.blogger.com/profile/02507121540089155768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6040463390120639115.post-8824296875718839434</id><published>2007-12-13T00:31:00.000-08:00</published><updated>2007-12-13T01:15:21.738-08:00</updated><title type='text'>Perfect Simulation</title><content type='html'>Computer Science, at its core, takes a model of a real-world situation and simulates it, perfectly. If two programmers utilize this concept to a perfect degree their code will look the same, raising an eerie question of "how do you judge who's a better programmer?"&lt;br /&gt;&lt;br /&gt;Of course, always holding onto such an ideal is difficult, if not impossible in practice, because it entails not only solving a problem to get from point A to point B, but solving it in such a way that the underlying logic FITS in with how the world works.&lt;br /&gt;&lt;br /&gt;This raises quite a few interesting questions.&lt;br /&gt;&lt;br /&gt;1. What is a real-world situation? Do we interact with the world using windows user interfaces on a daily basis? Are games "real-world" situations? They could be an extension of fiction, but, how do you quantify the underlying code?&lt;br /&gt;&lt;br /&gt;2. How do you quantify a programmer's skills, if both of them code in the same manner? Time spent?&lt;br /&gt;&lt;br /&gt;3. Does this concept include the idea of getting it right, the first time?&lt;br /&gt;&lt;br /&gt;4. Does this include variable names? XP :)&lt;br /&gt;&lt;br /&gt;Of course, before a developer could even begin to do this, he would have to have a solid command of the language, and, of course, as humans we are not perfect, so do to this on a regular basis would be impossible.&lt;br /&gt;&lt;br /&gt;However, I think it does say that there is always improvement in some aspects of code, which, when studied long enough, will allow for programs to run better if the necessary changes are made.&lt;br /&gt;&lt;br /&gt;These are just my thoughts of course. We haven't explored the concept too much.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6040463390120639115-8824296875718839434?l=encapsulatedworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://encapsulatedworld.blogspot.com/feeds/8824296875718839434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6040463390120639115&amp;postID=8824296875718839434' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/8824296875718839434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/8824296875718839434'/><link rel='alternate' type='text/html' href='http://encapsulatedworld.blogspot.com/2007/12/perfect-simulation.html' title='Perfect Simulation'/><author><name>Klasanov</name><uri>http://www.blogger.com/profile/02507121540089155768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6040463390120639115.post-6074327966609003663</id><published>2007-12-05T15:48:00.001-08:00</published><updated>2007-12-05T16:03:25.438-08:00</updated><title type='text'>AP practice tests for CS</title><content type='html'>Had two tests this week. The one yesterday was a 40 question multiple choice in which we were required to answer 30. A majority of them dealt with classes, which is a JAVA concept I have been wrapping my head around the past few months (the concept finally clicked when some classmates showed me a few things). Actually the concept of classes was something I had in my mind before I knew how to go about programming in such a manner (You develop a very ambitious project and you begin to realize very quick that its not just a quick and dirty application).&lt;br /&gt;&lt;br /&gt;The second portion of the practice test was a free-response question. The first involved the simulation of a parking garage, and I had to write code for three different parts.&lt;br /&gt;&lt;br /&gt;The first part was to find out if the parking garage is full. This was simple enough. Check each level and if a level isn't full, then the garage isn't full.&lt;br /&gt;&lt;br /&gt;The second part was to place a car in the next available space in the garage, and the third part was to remove a car. Since the value of "null" represented an empty space, it was just a matter of finding this empty spot and placing the car there. The third part was also quite similar, but a little different because it involved comparisons between two strings (sentences) and I'm not sure if I got it right. The problem is I'm not too keen on how objects work (something I need to practice on if I am to do good on the real thing).&lt;br /&gt;&lt;br /&gt;Unfortunately, this took me around an hour to code. The one disadvantage with AP testing is that I don't have the compiler on hand to trace through code. I'm not talking about the debugger, but actually running the program and seeing where it goes as opposed to where I think it might go.&lt;br /&gt;&lt;br /&gt;The second problem involved HTML processing. Since strings can't be deleted (for whatever reason), I got stuck on the whole "remove things from a string" idea. The ironic thing is I could have completed this easily if I would have realized that the second and third problems were really just variations of the first one.&lt;br /&gt;&lt;br /&gt;Oh well. Chalk it up to learning lesson 2 about AP style testing :)&lt;br /&gt;&lt;br /&gt;I can't wait until Christmas break. Two weeks of sheer, no-school bliss!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6040463390120639115-6074327966609003663?l=encapsulatedworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://encapsulatedworld.blogspot.com/feeds/6074327966609003663/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6040463390120639115&amp;postID=6074327966609003663' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/6074327966609003663'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6040463390120639115/posts/default/6074327966609003663'/><link rel='alternate' type='text/html' href='http://encapsulatedworld.blogspot.com/2007/12/ap-practice-tests-for-cs.html' title='AP practice tests for CS'/><author><name>Klasanov</name><uri>http://www.blogger.com/profile/02507121540089155768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
