class               TBLOCK

{

public:

    using           TYPE        = unsigned short;


private:

    const   TYPE    bits_set[ 8 ]

    {

        0xFFFF, 0xA808, 0x840A, 0x8888, 0xC808, 0xA088, 0x8848, 0xA880,

    };


    const   TYPE    spin_geometry[ 16 ]

    {

        0x0001, 0x0002, 0x0004, 0x0010,

        0x4000, 0x0008, 0x0080, 0x0020,

        0x2000, 0x8000, 0x0800, 0x0040,

        0x1000, 0x0400, 0x0200, 0x0100,

    };


    TYPE            bits  = bits_set[ 0 ];

    int             index = 0;


public:

    auto&           operator=( const TBLOCK& other )

    {

        bits = other.bits;

        index = other.index;

        return  *this;

    }


    auto&           operator=( const int index )

    {

        bits = bits_set[ this->index = index ];

        return  *this;

    }


                    TBLOCK() = default;

                    TBLOCK( const int index ) : index( index )

    {

        *this   = index;                

    }

    

    auto            rotate_cw()

    {

        bits    = ( bits << 4 ) & 0xFFF0 | ( bits >> 12 ) & 0x000F;

    }


    auto            rotate_ccw()

    {

        bits    = ( bits >> 4 ) & 0x0FFF | ( bits << 12 ) & 0xF000;

    }


    template< class T, int H, int W >

    auto            draw_to( T (&dst)[ H ][ W ], const int x, const int y )

    {

         T*  d = (T*)dst + y * W + x; 

         for( int v = 0; v < 4; ++v, d += W )

            for( int u = 0; u < 4; ++u )

                if( bits & spin_geometry[ v * 4 + u ] )

                    d[ u ] = index;

    }

};


int board[ 24 ][ 12 ];


#include <iostream>

using   namespace   std;


template< class T, int H, int W >

auto                draw_array( T (&dst)[ H ][ W ] )

{

    for( int v = 0; v < H; ++v, puts( "" ) )

        for( int u = 0; u < W; ++u )

            putchar( dst[ v ][ u ] ? '#' : ' ' );

}


#include <cstring>


int main()

{

    TBLOCK blocks[]{ 0, 1, 2, 3, 4, 5, 6, 7 };

    for( int direction = 0; direction < 4; ++direction )

    {

        std::memset( board, 0, sizeof board );

        int x = 0;

        for( auto& block : blocks )

            block.draw_to( ( block.rotate_cw(), x++, board ),

            ( x & 1 ) * 5 + 1, ( x >> 1 ) * 5 + 1 );

        draw_array( board );

    }

    return 0;

}


솔까말 내 경우 주석이 필요한 경우는 코드 리마킹할 때랑

아가들이 전혀 스스로의 의도와 다른 코딩 했을때 코드리뷰 해주는 용도 뿐.