RE: Perl 'Expert' Quiz of the Week #23 - Rotation

Rick Measham <[email protected]>
Newsgroups gmane.comp.lang.perl.qotw.discuss
Message-ID <a06002002bd66869086a0@[10.0.0.2]>
At 1:26 pm -0700 2004-09-09, Coleman Tom wrote:
>Here is a proposal:
>
>The dots are centers of rotation.
>The square does not change on ratation.
>
>initial blocks:
>
>     ##   .@  %.   *.*  &.&  ++.+  $.$
>     ##  @@    %%  *      &         $
>
>shapes rotated once clockwise ( dots do not move ):
>
>                               +
>         @     %  **     &     +    $
>     ##  @.   %.   .     .     .   $.
>     ##   @   %    *    &&     +    $
>

To extend that .. here's my rotations:

     #.   .@  %.   *.*  &.&  ++.+  $.$
     ##  @@    %%  *      &         $


                               +
         @     %  **     &     +    $
     #.  @.   %.   .     .     .   $.
     ##   @   %    *    &&     +    $




     #.   .@  %.     *  &    ++.+  $.$
     ##  @@    %%  *.*  &&&         $


                               +
         @     %   *     &&    +    $
     #.  @.   %.   .     .     .    .$
     ##   @   %    **    &     +    $


These are based on the first game of tetris I ever played. Note that 
the '+' piece doesn't really rotate around the designated point, it 
really toggles between horizontal and vertical.

>Rotation sometimes does not make the block extend lower than it was. 

Will never make it extend lower. There is always one segment below the pivot.


>Rotation is possible if all future blocks are open.

Correct. You do not have to work out the maths to make sure it could 
physically rotate. Consider this possible move:

           6| &  +     |          6| &        |          6| &        |
           5| &&&+&***+|          5| &&&+&***+|          5| &&& &***+|
           4|$$$&+&*@@+|          4|$$$&+&*@@+|          4|$$$& &*@@+|
           3|&$  + @@ +|          3|&$  + @@ +|          3|&$++++@@ +|
           2|&&&% %%%%+|          2|&&&%+%%%%+|          2|&&&% %%%%+|
           1+----------+          1+----------+          1+----------+
             ABCDEFGHIJ             ABCDEFGHIJ             ABCDEFGHIJ

Not possible in the physical world but allowable in Tetris.

>Rotation cannot be combined with a drop.

One move at a time at all times. A drop is a move. A rotation is a 
move. A left or right nudge is a move.

Thanks tom!

Cheers!
Rick

-- 
--------------------------------------------------------
             There are 10 kinds of people:
   those that understand binary, and those that don't.
--------------------------------------------------------
   The day Microsoft makes something that doesn't suck
     is the day they start selling vacuum cleaners
--------------------------------------------------------
"Write a wise proverb and your name will live forever."
    -- Anonymous
--------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.