anchor.diff:                                                       (/ 3, 3 /))
       integer                   :: mrot(3, 3, 3, 4), cube(3, 3, 3), calls
       type(puts_t), allocatable :: puts_cache(:)
  -    type(piece), allocatable  :: ps(:)
       type(list)                :: sols
       real                      :: t0, t1
  +    type(puzzle)              :: puzz
  +
  +    ! Parse command line.
  +    call get_command(cmd)
  +    elim_islands = (index(cmd, '--no-elim-islands') == 0)
  +    one_sol      = (index(cmd, '--many-sols') == 0)
  +    script_mode  = (index(cmd, '--script-mode') /= 0)
   
       call cpu_time(t0)
       call init_mrot(mrot)
       cube = 0
  -    call read_pieces(ps)
  +    call read_puzzle(puzz)
  +    if (.not.script_mode) call print_puzzle(puzz)
       sols%length = 0
       allocate(sols%d(3, 3, 3, 16))
   
       calls = 1
  -    call search(ps, size(ps), 1, cube, sols)
  +    call search(puzz%ps, size(puzz%ps), 1, cube, sols)
       call finish()
   
   contains
  
positive.code:         end do
      end subroutine
  
      subroutine print_piece(p)
          integer, intent(in) :: p(:, :)
          integer             :: i
  
negative.code:         end do
      end subroutine
  
      subroutine print_puzzle(puzz)
          type(puzzle), intent(in) :: puzz
          type(piece)              :: p
          integer                  :: i
  
          write (*, "(a, a)")  "puzzle name: ", puzz%name_
          write (*, "(a, i3)") "unique pieces: ", size(puzz%ps)
          print *
          do i = 1, size(puzz%ps)
              p = puzz%ps(i)
              write (*, "(a, i2, a, i2, a, i2)") "piece ", i, ", volume ", size(p%s, 2), ", count ", p%cnt
              call print_piece(p%s)
              print *
          end do
          write (*, "(a, i3)") "total pieces: ", sum(puzz%ps%cnt)
          print *
      end subroutine
  
  