Calendars and Dates, part 1

Ask any historian and he will tell you that determining the date of some event can be a real pain, especially for things that happened more than a few centuries ago or that occurred somewhere other than Europe. Partly this is due to the fact that back then people weren’t especially concerned with reporting things accurately, but it is also partly due to the fact that there wasn’t a universal uniform calendar in use back then.

Most people in the modern world use what has been called the Gregorian Calendar. It is a modification of the earlier Julian Calendar, which was itself a great leap forward for accurate time-keeping. Many people, eschewing its religious roots, prefer to call it the “civil calendar” or some such; personally I don’t care what you call it, as long as we are all on the same page when using it.

Continue reading Calendars and Dates, part 1

Advertisements

Movie review: Hotel Transylvania (2012)

This summer you couldn’t drive for more than a mile without seeing a billboard or bus stop or bench with an advertisement for Hotel Transylvania 3 on it. For some reason I had never seen the first two, so I figured I would let this third installment take a pass as well. Then one day I saw a good portion of the first one on a Spanish TV channel, and it actually looked entertaining.

So why hadn’t I watched them before? IMDb had the answer: Adam Sandler. Now, if you like him and his movies, that’s just fine by me, but he rubs me the wrong way; I’ve never liked him or his movies. But, seeing as this was an animated film I figured I would only be exposed to half of him (his voice and not his image), and even that should be disguised since he is supposed to be Count Dracula.

Well, as it turns out yes and no. The character is drawn (in my opinion) to look somewhat like him, and even through the (very phony, but at least consistent) accent you can recognize his voice. What about the rest of the voice cast? I’ve at least heard of many of them, but know very little about most of them. Still, it looked funny on Spanish TV and it was directed by Genndy Tartakovsky, so I figured I would give it a spin.

Unlike my previous two entries, this review is going to be much more of a scene-by-scene recap, and therefore much longer. If I like the way it turns out, then all of my future reviews will be the same. If I don’t, then they won’t.

Continue reading Movie review: Hotel Transylvania (2012)

Movie review: Oblivion (1994)

This is a movie I was unaware of until fairly recently. As a matter of fact, it was this film that led directly to me watching Masters of the Universe. I first heard of this film due to RiffTrax. After watching the preview, I thought that this might be a film I would enjoy watching, so I looked it up on IMDb.

In addition to some notables names such as George Takei, Isaac Hayes and Julie Newmar, I noticed another actress named Meg Foster. The name rang a bell, but I couldn’t immediately recall who she was. I looked her up and realized that she was the actress with the freaky eyes from They Live (1988); I also remember her from Leviathan (1989) and Blind Fury (1989). Looking at the rest of her filmography, I noticed another little film named “Masters of the Universe (1987)“.

Well, I had been meaning to watch that film anyway someday, so why not now? So, that’s how I came to finally watch it for the first, and probably last, time. If you read my review of that film (ha ha ha ha ha ha ha ha; sorry, the thought of anyone ever actually reading this blog made me crack up) you will know I didn’t particularly care for it. Perhaps that is why I went into watching Oblivion with low expectations but came out pleasantly surprised.

On to the recap! Continue reading Movie review: Oblivion (1994)

Movie review: Masters of the Universe (1987)

Several decades ago when I created my first personal website, one of my original intentions was to critique certain movies. And by “certain movies”, I of course mean “bad movies”. Well, I never got around to every actually writing about any movies, but I did post a small list of some especially bad ones.

Why did I never write any reviews? Any number of reasons, but primarily because I was too lazy to and there were a huge number (at that time) of other sites already doing it (and much better than I ever could have).

Well, when I started this blog one of my ideas was to finally start posting movie reviews. I never did because I felt that if I ever started, I would feel obligated to keep it up. Who would want to go to a site for movie reviews that only had a handful? I have since decided that since I hardly ever post anything here anyway, I might as well post at least one movie review. Seriously, who is ever going to read it anyway?

So what movie gets the honor of being my first (and possibly last) bona fide movie review? “Masters of the Universe (1987)” starring Dolph Lundgren. I chose this movie for several reasons. One is that I just watched it for the first time. Another is that it is a prime example of what I mean by a “bad movie”. Also, it is a super-hero movie of sorts, and they are really popular right now so maybe that might direct one or two people this way.

Now, unlike several other dedicated movie review websites that actually know things about the movies they review, I know nothing about this movie other than what I’ve read on its IMDb page. This will be true for any movie I review, with one possible exception. (That movie is only an exception because I know one of the actors in it.) Any facts I present will be common knowledge, obvious inference or drawn from the web, usually the IMDb page.

Continue reading Movie review: Masters of the Universe (1987)

Harry Potter

Nothing like jumping on the bandwagon a couple of years after it’s ridden off into the sunset. Today I would like to ramble on about the whole Harry Potter phenomena. For the sake of brevity and clarity, I will hereafter simply write “HP”. Even if you’ve never read any of the books nor seen any of the movies, surely you must have at least heard about him. (If not, what planet are you from?)

Continue reading Harry Potter

It’s been a while

Well, it’s been a while so I figured I had better post something new.  Actually, I’ve been meaning to post something for quite some time now, I’ve just never gotten around to it.  And, I’ve never gotten around to it because I never really had anything that I really wanted to say.  Not that I do now; it’s just that, as I just said, I haven’t posted in a long time and I figure I had better post something.

So, in lieu of anything better, I’m going to write about my most recent little project.  A few months ago I wrote a simple little game that Wikipedia says is called the 15-puzzle.  I’m sure you are all familiar with it under whatever name you happen to call it.  That’s what I’m going to talk about today.  I chose this topic partly because I need to show some math and I wanted to figure out how to do that using WordPress.

When writing the game, I installed a feature to “shuffle” the tiles randomly.  What my program actually does, however, is randomly move tiles a certain number of times (based upon the chosen difficulty level) from the final position.  I wondered two things: 1) How many random moves were “enough” to guarantee a completely random arrangement and 2) Is there some algorithm for randomly placing the tiles such that the puzzle is still solvable?

Before I go any further I need to introduce some terminology so we don’t get confused.  I have already called each piece a tile.  There is also one empty space.  All of the tiles and the one space occupy the rectangular grid.  Each place occupied by a tile or the empty space is a cell.  We will refer to grids as being m×n, and we will for the sake of convenience assert that m ≤ n.  Therefore, a m×n grid contains m×n cells which are occupied by m×n-1 tiles and one empty space.  We will call the number of cells Τ, so Τ = m×n.  For the 15-puzzle, m = n = 4, so the grid is 4×4 and there are Τ = 4×4 = 16 cells and Τ-1 = 15 tiles.  (Hence the name.)

Since the 15-puzzle uses a 4×4 grid, there are 16! = 20,922,789,888,000 possible arrangements. According to Wikipedia, it has been proven that half of these possibilities can be reached, the other half cannot. (This holds true for any rectangular grid.) Therefore, there are 10,461,394,944,000 valid arrangements of the puzzle.

It turns out that any of those arrangements can be reached from the unshuffled starting position by no more than 80 moves! Unfortunately, there is no neat and tidy formula for computing this value; it must be empirically determined. But, it got me thinking: is there a simple way to come up with a ballpark figure for any arbitrary sized grid? I believe I have come up with such a way, by estimating how many possible positions are reachable after each move.  Once the total number of positions reachable meets or exceeds the known number, we have our guess.  Since in reality we overestimate how many positions we can reach, our guess will always be an underestimate of the number of moves necessary.  Therefore, it will serve as a lower bound for the actual minimum number of moves necessary.

Remember, on each move we slide a tile into the empty space; we can instead think of this as sliding the empty space onto a tile.  For most of the cells, we can “move” the empty space onto any of four adjacent tiles.  Therefore, our first guess will be that for every possible current position, there are four times as many positions that can be reached on the next move.

A better guess takes into account the fact that the edge tiles can only be moved into three other tiles, and the corners onto only two.  What we now have to do is sum up all of these possibilities and divide by Τ to get our multiplier.  Looking back, we actually had to do this for our first guess too, but since all of the tiles were “4”, once we summed up 4 Τ times and then divided by Τ, we got 4 back.  There are (2×(m-2))+(2×(n-2)) cells that have 3 moves, and 4 cells (the corners) that have only 2 moves.  All of the other cells, (m-2)×(n-2), still have 4 moves.  Therefore, after each turn we need to multiply our previous count of positions by 4×(m-2)×(n-2) + 3×((2×(m-2))+(2×(n-2))) + 2×4, then divide by Τ.  This equation simplifies to 4×m×n - 2×m - 2×n.

That’s pretty good, but we can go one better with the exact same amount of effort.  You see, although each position can produce one of either 2, 3 or 4 new positions, they actually aren’t all new.  One of them has to be the position we came from.  Therefore, if we do the same thing as before but instead of 2 (for corners), 3 (for edges) and 4 (for interiors), we use 1, 2 and 3, we will get our best estimate yet.  Replacing the values in the previous equation and simplifying it, we get 3×m×n - 2×m - 2×n.

A quick note is in order here.  Obviously, any grid where m = 2 will not have any interior cells; they will all be corners or edges.  The math actually works out, though, because m - 2 = 0, so we multiply by zero and get zero in return.

This post is already running too long, so I’m going to cut this short and show my results:

Puzzle     Our guess  Multiple   Actual      Ratio
2x2 (3)        6        1/1         6        1.000
2x3           15                   21
2x4           22                   36
2x5           29                   55
2x6           36                   80
2x7           44                  108
2x8           52                  140
3x3 (8)       22        5/3        31        1.409
3x4           31                   53
3x5           41                   84
3x6           51                 95-130
3x7           62                 96-177
3x8           73                123-237
3x9           85                150-322
4x4 (15)      43        2/1        80        1.860
4x5           56                107-138
4x6           70                132-208
4x7           85                149-290
4x8          100                188-384
4x9          116                227-490
5x5 (24)      73       11/5     152-208   2.082-2.849
5x6           90                177-297
6x6 (35)     112        7/3     230-423   2.054-3.777
7x7 (48)     162       17/7     352-752   2.173-4.642

All of the values in the “Actual” column were obtained from a page linked to from the Wikipedia article.  (That link is actually to the WayBack Machine version of the page.)

Let’s go back to my original questions.  I asked how many random moves were enough to guarantee a completely random arrangement.  If by completely random arrangement we mean any of the 16!/2 possible positions, then we must make at least 80 moves.

Of course, just making 80 moves doesn’t guarantee that it will take 80 moves to return to the final position, since some of them might undo a previous move.  At the time I wrote the game I hadn’t looked up any of this information and I just made my highest difficulty level make 119 moves.  I arbitrarily chose this value because the program shows the moves being made and that was the longest I could sit still while it was making those moves.  (I show the moves being made so that on the easier levels you could try to memorize them and undo them in order.)  It looks like I should increase this value (and probably not show the moves to speed up the program on the higher difficulty levels) somewhat.

The other question I asked was is there some algorithm for randomly placing the tiles such that the puzzle is still solvable.  Well, the Wikipedia article makes a statement about the parity of the puzzle determining this, but I couldn’t follow the math to determine exactly what they meant for this specific application.  So, in other words, it looks like I will have to continue actually making valid moves from the final position to shuffle the game instead of randomly assigning tiles.

How about the ulterior motive for this post, figuring out how to show math?  There doesn’t seem to be any sort of equation editor or anything like that.  In the end, I chose to use “<code>” tags to show the math, and I used the special character set to show mathematical symbols.  All in all, not very satisfying.  Now I will try one more thing with this post, and that is to attach both the game in its current basic form as well as the program that calculated the values in the above table.  I will put them both in a ZIP file which you can download here.  Nope, WordPress says I can upload documents, but it doesn’t allow me to for some reason.  Maybe I’ll figure it out later.  (OK, I created a Google account and put the file there.  That link should now work.)

 

Godzilla

Godzilla.  King of the Monsters.  Owner of the longest movie franchise in history (take that, James Bond!).  If you’ve never heard of him, you must’ve been living in a cave for the last 60 years.  Whether you’re a cave-dweller or not, I’m going to give you a little history lesson so that we’re all on the same page.  (Emphasis on “little”; I highly recommend reading the Wikipedia articles on both the character and franchise!)

Continue reading Godzilla