# # Yet another cube puzzle. # # Gershon Elber, Jan 1999 # Stick1 = box( vector( -0.5, 0, -3 ), 1, 1, 6 ) - box( vector( -1, -0.5, 1 ), 2, 1, 1 ); attrib( Stick1, "rgb", "255, 0, 0" ); Stick2 = box( vector( -0.5, 0, -3 ), 1, -1, 6 ) - box( vector( -1, -0.5, -2 ), 2, 1, 3 ); attrib( Stick2, "rgb", "255, 100, 0" ); Stick3 = box( vector( -3, -0.5, -1 ), 6, 1, 1 ) - box( vector( -2, -1, -0.5 ), 1.75, 2, 1 ) - box( vector( 0.25, -1, -0.5 ), 1.75, 2, 1 ) - box( vector( -0.5, 0, -1 ), 1, 2, 2 ); attrib( Stick3, "rgb", "255, 0, 100" ); Stick4 = Stick3 * ry( 180 ); attrib( Stick4, "rgb", "255, 100, 100" ); Stick5 = box( vector( 0, -3, -0.5 ), 1, 6, 1 ) - box( vector( 0.5, -2, -1 ), -1, 4, 2 ); attrib( Stick5, "rgb", "255, 100, 0" ); Stick6 = Stick5 * ry( 180 ); attrib( Stick6, "rgb", "255, 50, 50" ); ################################# Bar1 = box( vector( -3, -0.5, 1 ), 6, 1, 2 ) - ( box( vector( -0.5, -1, 1 ), 1, 1, 3 ) + box( vector( -0.5, -1, 2 ), 1, 3, 2 ) ); attrib( Bar1, "rgb", "0, 255, 0" ); Bar2 = box( vector( -0.5, 1, -3 ), 1, 2, 6 ) - box( vector( -1, 2, -0.5 ), 2, 2, 1 ); attrib( Bar2, "rgb", "100, 255, 0" ); Bar3 = Bar2 * rz( 180 ); attrib( Bar2, "rgb", "20, 255, 100" ); Bar4 = Bar1 * rx( 180 ); attrib( Bar4, "rgb", "100, 255, 100" ); ################################# Block1 = box( vector( -3, -3, -3 ), 2.5, 6, 6 ) - ( box( vector( -1, -4, -0.5 ), 1, 8, 1 ) + box( vector( -5, -0.5, -4 ), 6, 1, 8 ) ) + box( vector( -1.001, -1, -0.5 ), -0.5, 2, 1 ); attrib( block1, "rgb", "50, 100, 255" ); Block2 = Block1 * rz( 180 ); attrib( block2, "rgb", "100, 50, 255" ); # # Add the animation curves: # mov_xyz = creparam( cbspline( 2, list( ctlpt( E3, 0, 0, 0 ), ctlpt( E3, 0, 0, 16 ), ctlpt( E3, 0, 4, 16 ) ), list( KV_OPEN ) ), 0, 2 ); attrib( Stick1, "animation", mov_xyz ); free( mov_xyz ); mov_xyz = creparam( cbspline( 2, list( ctlpt( E3, 0, 0, 0 ), ctlpt( E3, 0, 0, 16 ), ctlpt( E3, 0, -2, 16 ) ), list( KV_OPEN ) ), 0, 2 ); attrib( Bar1, "animation", mov_xyz ); free( mov_xyz ); mov_xyz = creparam( cbspline( 2, list( ctlpt( E3, 0, 0, 0 ), ctlpt( E3, 0, -1, 0 ), ctlpt( E3, 0, -1, 12 ) ), list( KV_OPEN ) ), 2, 3 ); attrib( Bar2, "animation", mov_xyz ); free( mov_xyz ); mov_y = creparam( cbspline( 2, list( ctlpt( E1, 0 ), ctlpt( E1, -2 ) ), list( KV_OPEN ) ), 3, 4 ); mov_xyz1 = creparam( cbspline( 2, list( ctlpt( E3, 0, 0, 0 ), ctlpt( E3, 0, -6, 0 ), ctlpt( E3, 2, -6, 0 ) ), list( KV_OPEN ) ), 8, 10 ); mov_xyz2 = creparam( cbspline( 2, list( ctlpt( E3, 0, 0, 0 ), ctlpt( E3, 0, -6, 0 ), ctlpt( E3, -2, -6, 0 ) ), list( KV_OPEN ) ), 8, 10 ); attrib( Stick5, "animation", list( mov_y, mov_xyz1 ) ); attrib( Stick6, "animation", list( mov_y, mov_xyz2 ) ); free( mov_y ); free( mov_xyz1 ); free( mov_xyz2 ); mov_xyz = creparam( cbspline( 2, list( ctlpt( E3, 0, 0, 0 ), ctlpt( E3, 0, -1, 0 ), ctlpt( E3, 0, -1, 12 ), ctlpt( E3, 0, -3, 12 ) ), list( KV_OPEN ) ), 4, 7 ); attrib( Bar3, "animation", mov_xyz ); free( mov_xyz ); mov_xyz = creparam( cbspline( 2, list( ctlpt( E3, 0, 0, 0 ), ctlpt( E3, 0, -1, 0 ), ctlpt( E3, 0, -1, 12 ) ), list( KV_OPEN ) ), 4, 6 ); attrib( Stick2, "animation", mov_xyz ); free( mov_xyz ); mov_z = creparam( cbspline( 2, list( ctlpt( E1, 0 ), ctlpt( E1, -6 ) ), list( KV_OPEN ) ), 7, 8 ); attrib( Stick3, "animation", mov_z ); free( mov_z ); mov_z = creparam( cbspline( 2, list( ctlpt( E1, 0 ), ctlpt( E1, -8 ) ), list( KV_OPEN ) ), 7, 8 ); attrib( Bar4, "animation", mov_z ); free( mov_z ); mov_z = creparam( cbspline( 2, list( ctlpt( E1, 0 ), ctlpt( E1, 6 ) ), list( KV_OPEN ) ), 7, 8 ); attrib( Stick4, "animation", mov_z ); free( mov_z ); mov_x = creparam( cbspline( 2, list( ctlpt( E1, 0 ), ctlpt( E1, -2 ) ), list( KV_OPEN ) ), 10, 11 ); attrib( Block1, "animation", mov_x ); free( mov_x ); mov_x = creparam( cbspline( 2, list( ctlpt( E1, 0 ), ctlpt( E1, 2 ) ), list( KV_OPEN ) ), 10, 11 ); attrib( Block2, "animation", mov_x ); free( mov_x ); ################################# All = list( Stick1, Stick2, Stick3, Stick4, Stick5, Stick6, Bar1, Bar2, Bar3, Bar4, Block1, Block2 ); interact( All ); save( "puz_cube", All ); free( Stick1 ); free( Stick2 ); free( Stick3 ); free( Stick4 ); free( Stick5 ); free( Stick6 ); free( Bar1 ); free( Bar2 ); free( Bar3 ); free( Bar4 ); free( Block1 ); free( Block2 ); free( All );