Thursday, July 14, 2005
Stanislav Petrov
(http://en.wikipedia.org/wiki/Stanislav_Petrov).
Having never heard of Stanislav Petrov before or the events of September 26, 1983, I was amazed and grateful for his actions. I'm not sure I would've trusted my intuition that much - I'm glad he did.
Friday, May 27, 2005
Top Grossing Movies Of All Time
Being the guy I am though (and also that I don't consider Titanic to be all that great of a movie despite it's #1 ranking), I decided to find an inflation calculator and adjust the numbers to see what would turn up. Wow, what a difference!
Here is the top 20 from the original list that is NOT adjusted for inflation. As you can tell, with a few notable exceptions, most all of these movies are from the late 1990's and on. Which makes sense since the price of a ticket has gone through the roof. (not sure why there's a big white space here...scroll down...)
Rank | Title | Year | Unadjusted Sales |
1 | Titanic | 1997 | $600,779,824 |
2 | Star Wars | 1977 | $460,935,665 |
3 | Shrek 2 | 2004 | $436,471,036 |
4 | E.T. the Extra-Terrestrial | 1982 | $434,949,459 |
5 | Star Wars: Episode I - The Phantom Menace | 1999 | $431,065,444 |
6 | Spider-Man | 2002 | $403,706,375 |
7 | The Lord of the Rings: The Return of the King | 2003 | $377,019,252 |
8 | Spider-Man 2 | 2004 | $373,377,893 |
9 | The Passion of the Christ | 2004 | $370,270,943 |
10 | Jurassic Park | 1993 | $356,784,000 |
11 | The Lord of the Rings: The Two Towers | 2002 | $340,478,898 |
12 | Finding Nemo | 2003 | $339,714,367 |
13 | Forrest Gump | 1994 | $329,691,196 |
14 | The Lion King | 1994 | $328,423,001 |
15 | Harry Potter and the Sorcerer's Stone | 2001 | $317,557,891 |
16 | The Lord of the Rings: The Fellowship of the Ring | 2001 | $313,837,577 |
17 | Star Wars: Episode II - Attack of the Clones | 2002 | $310,675,583 |
18 | Star Wars: Episode VI - Return of the Jedi | 1983 | $309,125,409 |
19 | Independence Day | 1996 | $306,124,059 |
20 | Pirates of the Caribbean: The Curse of the Black Pearl | 2003 | $305,388,685 |
To adjust the figures, I used the Consumer Price Index tables found at ftp://ftp.bls.gov/pub/special.requests/cpi/cpiai.txt. I took the CPI from this year (2005), divided it by the CPI from the year the movie was released and multiplied by the unadjusted amount. If this is the wrong way to do this, somebody please let me know.
Now, here's the list adjusted for inflation. Now we're talking! Classics all the way down the list. And only ONE (Titanic) was released after 1983. In fact, the first movie from the 2000's that enters the list, does so at number 31...and it's Shrek 2...ugh...grossing $443M
Rank | Title | Year | Adjusted Sales |
1 | Gone with the Wind | 1939 | $2,744,015,350.79 |
2 | Snow White and the Seven Dwarfs | 1937 | $2,465,673,133.33 |
3 | Star Wars | 1977 | $1,460,390,225.74 |
4 | Bambi | 1942 | $1,210,862,134.97 |
5 | The Sound of Music | 1965 | $994,829,933.71 |
6 | One Hundred and One Dalmatians | 1961 | $982,474,916.39 |
7 | Jaws | 1975 | $927,881,040.89 |
8 | The Exorcist | 1973 | $884,605,405.41 |
9 | E.T. the Extra-Terrestrial | 1982 | $865,391,669.72 |
10 | The Jungle Book | 1967 | $815,388,428.26 |
11 | Titanic | 1997 | $718,689,882.92 |
12 | The Sting | 1973 | $690,162,162.16 |
13 | Doctor Zhivago | 1965 | $680,972,190.48 |
14 | Star Wars: Episode V - The Empire Strikes Back | 1980 | $676,098,060.58 |
15 | Mary Poppins | 1964 | $633,600,000.00 |
16 | The Godfather | 1972 | $619,277,865.65 |
17 | The Graduate | 1967 | $600,127,053.41 |
18 | Star Wars: Episode VI - Return of the Jedi | 1983 | $595,904,402.89 |
19 | Butch Cassidy and the Sundance Kid | 1969 | $535,240,021.80 |
20 | Grease | 1978 | $534,066,257.67 |
Just thought this was interesting. Also, if you do the numbers, each successive Star Wars movie has made less and less money when adjusted for inflation:
Star Wars - $1.492B
Empire Strikes Back - $736M
Return of the Jedi - $590M
Episode I - $491M
Episode II - $330M
Episode III - ?? (so far, it's $191M)
I guess this is why I get a little irritated when they say a movie had a "record breaking" weekend. It's only record breaking because a ticket cost $8 now instead of 50 cents (or whatever it cost it 1939). Oh well...it's interesting nonetheless.
Wednesday, January 26, 2005
Accessing Private Fields
I found that my Player objects should not expose their amount of cash as a publicly accessible field or method. Players in the real game of Monopoly, need not reveal how much money they have on hand. However, this presented a problem from two standpoints:
- The Bank (or some other aspect of the game) might need to know how much money they have left in order to properly control the flow of the game - I have yet to actually run into this scenario yet, so I'm going to employ the principle of YouArentGonnaNeedIt - and not worry about it until I need to.
- During unit testing, the cash level of a player indicates a successful test or not. This I have ran into and have used reflection to solve the problem.
Here is a method that accesses a private int field of any object:
private int getObjectPrivateIntValue(Class clazz, String fieldName, Object object) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
return field.getInt(object);
}
This is my first time bypassing the security of a class like this, so I'm not sure of all the ramifications yet. One thing I've noticed though, is that I'm tempted to put this kind of method into my actual application. This seems like a really bad idea. But, for unit testing code, it seems ok.
My next challenge, which is along these lines, is going to figure out how to make it so certain methods on Players (such as sendToJail() and pay(int amount) ) are only accessible to authorized classes (such as the Bank or Board objects). I can't make these methods package protected because other Player objects should not be allowed to call these methods. I need either some sort of SecurityManager. Maybe this is another place that aspects could help?
Wednesday, January 19, 2005
Monopoly Simulator
So, now I think I'm resigned to develop it just for learning's sake - which is sort of freeing.
I started out ok last week and identified which objects I would need and came up with what I thought would be a working model. Things were going ok, but then in typical form, I got a little excited about the whole thing and threw TDD out the window. Several lunch hours later, I had a Monopoly simulator that was "working" in that it actually simulated games and had a winner at the end, but I had no idea if it was working properly because I had no unit tests. The design also ended up in a rather unsatisfying mess with little room for expansion or flexibility. I need to refactor, but looking at it again I think I need to start over and just pull bits and pieces out as I need them.
I'm really interested in trying to integrate AOP in here somehow. I think in the area of generating statistics this will be great because that is certainly a cross-cutting concern. Each action in the game should be able to register some statistic of what just happened. Also, I'm thinking of using a rule engine for the player rules. That way, it's much easier to modify the player behavior using pseudo-english and, who knows, may even help get someone else to develop their own player.