Insane Game 2.35 November 24th, 1996
by Martin Hock (oxymoron@aimnet.com)
NEW Page For My Games: http://www.aimnet.com/~oxymoron/zshell.html

** WARNING: I AM NOT LIABLE FOR ANY INJURY, NEURAL OR OTHERWISE, CAUSED BY THE
USE OF THIS PRODUCT, INCLUDING BUT NOT LIMITED TO BRAIN EXPLOSION OR LOSS OF
SANITY.  USE AT YOUR OWN RISK. **

I seem to have gotten rid of any deadly bugs in Insane Game, so there's no
need to back up your calculator before trying it, unless you're weird.

Oh joy, my SECOND game for ZShell!!  The first being Meister Mind.  And of
course, I'm continuing the odd naming tradition.

Do you have too much time on your hands?  Do you need to play a puzzle game
that is so frustratingly addictive that it will eat up all of your spare time?
Do you need to play an action game that so intense, it could result in some
sort of neural injury?  Do you need to play a game against a friend that could
result in a lawsuit?  If so, Insane Game is for you.  If not, well, try it
anyway :)  Featuring: Full Screen Puzzle Action!  The Exact Same Graphics
Algorithms Used For Meister Mind!  Except That This Time, There Aren't Any Big
Pictures, Just Small Ones!  Unique Scoring Algorithm!  Saved High Score and
Initials! Automatically Quits When You Can't Make Any More Moves!  Three,
Three, Three Games In One!  Pieces That Get So Fast, Your Ears Spew Blood!
Turn Off The Calculator If You Get Bored And Come Back Later!

Insane Game is a ZShell port of Same Game/SameGame.  Now, in version 2.0, it
adds two additional modes of play that I created myself, but both of them are
based on the original game.  I'm not too sure about the history of this game,
so please Send Me E-Mail if you have any information.  From what I can gather,
this game was created by someone in Japan.  There are 5 or so versions of this
game for Windows 3.1 alone, and all of them were made by Japanese people.  All
signs seem to point to Hudson Soft, a Japanese software company, as its
creator.  I'm not sure about the specific person, but I'm pretty sure that it
was Ken Takahasi.  There are many ports of the game.  If you have a browser
that supports Java (like Netscape 2.0 or higher or Internet Explorer 3.0),
http://www.cse.nd.edu/java/SameGame.html is a good version of the game.  It's
what turned me into a SameGame-maniac in the first place.

The object of Insane Game is to get rid of all the tiles.  In real life, you
could just dump the tiles into a garbage can and that would be the end of it,
but that would get boring after a while.  In Insane Game, you must eliminate
tiles by choosing groups of at least 2 or more touching tiles that are the
same type.  Hence the original name SameGame.  Here's an example:

12325
25555
12331

There are 2 eliminatable groups here.  Firstly, there is the gigantic group of
5s.  Secondly, there's the two 3s near the bottom that are hard to notice.

Ah, but this game would be pretty simple if all you did was choose the
existing groups of tiles.  It would be too obvious.  SO, we add the extra
factor of Gravity to the mix.  The pieces first want to fall downward.  If a
column is totally devoid of pieces after their initial descent, the pieces
will shift sideways to the left to eliminate it.  Let's see what would happen
if you got rid of those 5s:

1232           1
2        ->    2232
12331          12331

And look!  A new group of 2s has appeared out of nowhere!  Furthermore, the
existing group of 3s expanded to include another.  If you eliminated the 3s:

1              1              1
22 2     ->    22        ->   22 
12  1          12 21          1221

Note how first, the 2 fell, and then, the newly-empty column was eliminated
when everything else shifted to the left.

You can't always eliminate all the pieces.  In fact, you usually can't.
However, most of the time you can eliminate almost all of the pieces.  Just
think ahead and look for patterns.  And a surprising amount of the time, you
CAN eliminate all of the pieces.  Work from the top-right down, then to the
left.  Here, if we get rid of the 2s, and finally the 1s, we just got rid of
something that was seemingly pretty impossible!  Although the "official"
object is to get rid of every tile, in order to get the most points, it is
better to eliminate large groups of tiles and leave some remaining than to
eliminate small groups of tiles and get rid of all of them.

Scoring: The score increases exponentially depending on the number of pieces
eliminated.  Basically, the score is calculated using the algorithm: (x-1)^2,
where x is the number of pieces eliminated at once.  Here is a brief chart:
# Eliminated   Score
2              1
3              4
4              9
5              16
6              25
7              36
8              49
9              64
10             81
11             100

and so on.  If you win, points are QUADRUPLED!  Go for it!  However, the key
to the top score is not to win so much as to blast large pockets of pieces.

Different Game Modes:     (Note that each mode has its own top score)

Puzzle Mode: The original SameGame.  Eliminate as many tiles in large groups
as you can from a single screen.  When you run out of moves, the game is over.

Action Mode: The screen is halfway filled with tiles.  Every so often, a new
tile appears.  The object is to last as long as you can before the screen
overflows!  YOU CAN'T WIN!  Mu hu ha ha! Note that pressing buttons hastens
tile appearances, so if you're trying to think, don't press any buttons!
Pressing More to pause becomes much more important in this game.  As the
time goes by, the pieces appear more and more frequently until your brain
explodes.

Versus Mode: Action Mode against another player.  Every tile over 2 that you
clear is sent over to the other player.  For example, if you cleared 10 tiles,
your unlucky opponent would suddenly discover 8 additional tiles sent over to
his side.  The object is to force your opponent to overflow his side.  Oh yes,
one more thing: YOU CAN'T PAUSE!  Mu hu ha ha! The reason for this is to keep
your opponent from gaining an unfair advantage. When you select the Versus
Mode option, your calculator first checks to see if another is waiting to
connect.  If it doesn't find one, it enters the "waiting to connect" mode.
So, here is the procedure to link up:
1) Bring both calculators to the title screen.
2) Connect them via a normal link cable (it comes with the calculator).
3) Choose "Versus Mode" for one of them.
4) When the calculator displays "Waiting...", choose "Versus Mode" for
   the other one.
5) Kick some ass.  Remember, you can't pause!  Try not to splatter your brain
   on your opponent if it explodes.


Control:
Up/Down/Left/Right: Select piece (cursor wraps around screen).
In initial selection mode, Up and Down select the letter used.

2nd or Enter: Get rid of piece and friends (Remember, it only works if 2 or
more pieces are touching each other!  Otherwise, that would defeat the purpose
of the game.)

F1: In any game mode except Versus, turns off calculator.  Perhaps if you're
at school? :)  Or, you can use it as a sort of game save if you're in the
middle of something.  In initial selection mode, enters the selected letter.

ON: Turns back on calculator.  Pretty nifty, eh?  This proves that you really
turned it off.

More: View your score.  Any key returns.  Acts as a pause feature in Action
Mode.  Hopefully you are getting close to beating the high score!  My personal
high score is 400 points for Puzzle Mode.  Almost anyone can beat this.  It's
very sad.  Some people manage to get over 1000 points.  Don't ask me how.
Getting over 1000 points becomes easier in the other games, but then again,
the higher score is earned.  See if you can play long enough to actually wrap
around the score counter!  This occurs at 65,536 points; instead of getting
that lovely score, you'll suddenly find yourself with 0 points.  Now, with
the increasing pieces, it is just about IMPOSSIBLE to get a score this high.
So don't worry about finding yourself with nothing.

Exit: Quit.  If you can't make any more moves, the calculator knows this and
quits you automatically.  So the main function for the Exit key is to "bail
out" if you get bored or if you know you're doing really crappy.  Also you can
now quit on the title screen in case all you wanted to do was check the high
score or something.  If you quit in Versus Mode, this counts as a forfeit.

No need to pause because you aren't timed.  And this time, I'm not even going
to listen to anyone about a timer because I couldn't STAND this game with a
timer.  Plus the whole screen is used up :)  But then again, Action Mode kind
of has a timer.

When you quit, you will be presented with your score.  Some strategies for a
high score:
* THINK AHEAD.  This is the most important skill for mastering this game.  Of
  course, I'm not any good at it :)
* If you want to keep all of the existing groups intact, eliminate from the
  top down.
* If you see some big groups at first, it's often best to get rid of them
  before something happens to them.  Big Groups = Mucho Points.
* Don't lose your head!  Pause if you can sense an explosion coming on.  Or
  just give up if you're playing against a friend.
* If you're working in Action or Versus mode, try getting the whole thing to
  shift to the left.  A new column is a good piece repository.
* Also for Action or Versus, don't press Enter/2nd unless you're going to
  eliminate some pieces!  Pressing it makes a new pieces more likely to appear
  than if you're just waiting or pressing directions.

Do you like Insane Game?  If so, please send me e-mail!  I would very much
like to know of you.  Your encouragement will help convince me to make more
and better games.  Really!  Comment on such things as the lovely gravity
algorithm and the extreme speediness of the whole thing.  Also on the three
modes of play.

Version History:
1.0  The original.  7-bit random number, crappy score algorithm.
1.2  9-bit random number, title graphic, top score saved, better score
     algorithm.
1.21 Attempted to make random number faster, but failed.  (Not released)
1.22 Managed to make random number faster.  Not much though.  (Not released)
1.5  Enter initials, figures out when you've lost.
1.51 Initials now also appear on the Score screen.
1.52 Managed to figure out why random number was so slow, and sped it up.
     Also optimized things a bit.  (Released with 2.0-2.3)
1.53 Small optimization.  10 fewer bytes!  (Released with 2.35)
2.0  Three modes of play!  Each with its own high score!  Lots of stuff!
     Possibly some bugs with link transmission.  Uses ultimate RET routine!!
     NEVER worry about crappy stack again!
2.01 Fixed a potential problem if someone cleared the screen in Versus Mode.
     Consequently, I made it so that clearing the screen doesn't force a win.
     Also changed point system so winning doesn't quadruple points in Versus
     mode.  Points get high enough.
2.1  Doesn't hang up as much on Versus Mode.  Changed speed settings a bit.
2.3  Gradually increasing piece rate.  F1 blanks screen.  Use F1 for initials.
2.35 No more blinking cursor.  F1 now actually turns off the calculator.

Version 2.5 may have difficulty settings.  Higher difficulty = More points.
I may also make a save game feature.


Now that I have reached the critical 2, Insane Game is at the point that I
rather like it.  If you don't like the new version, 1.53 is included.  It's
only 1710 bytes, yet it packs in tons of features.  Consider it to be an
"Insane Game Lite".  Once you stop being a weenie, though, you'll probably
opt for the bigger, better, newer version.  2.35 is still just 2616 bytes,
and if you consider that it's 3 games in one, that's only 872 bytes per
game!!


Special Thanks To:
* Zilog, for making such a neat little processor.  (Too bad the registers are
  handled inconsistently... oh well, it gives the code a bit of flavor :)
* Whoever created SameGame.
* The creator of the previously-mentioned Java version of SameGame, which is
  what introduced me to the game in the first place.
* Pascal Bouron for the VERY lovely link routines.  I didn't even have to
  worry that data is transmitted as bits.  I didn't have to worry about
  handshaking, either.  These link routines KICK ASS.
* Keith Burzinksi for Key Code Lock 85, which I disassembled (sorry Keith!) in
  order to do the F1 shutdown.  NO THANKS to Michael Wyman, whose PowerDown
  source had illegal opcodes and didn't compile until I fixed it, and after
  that reset my calculator!!!  I disassembled PowerDown and found that it
  really wasn't anything at all, just two out (3),a statements and a bunch of
  invalid crap.  You think I'm weird?  This guy is WEEEEEIRD.
* Chris Busch, for his peachy keen random number algorithm.
* Tae Ho Kim for letting me borrow his calculator to develop Versus Mode.
* Mike Baker, Jimmy Mardell, David Ellsworth, and everyone else involved with
  TI calculator hacking.
* Obviously to the people who made ZShell.
* Everyone out there that sends me e-mail.  Thank you thank you thank you!!!!
* Whoever sent me the poorly forged hate mail.  Proof that someone is jealous
  of me.
