# include # include # include using namespace std; # include "polyomino_transform.hpp" int main ( ); //****************************************************************************80 int main ( ) //****************************************************************************80 // // Purpose: // // POLYOMINO_TRANSFORM_TEST tests POLYOMINO_TRANSFORM. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 28 April 2018 // // Author: // // John Burkardt // // Local parameters: // // Local, int M, N, the number of rows and columns in the representation // of the polyomino P. // // Local, int P[M*N], a matrix of 0's and 1's representing the // polyomino. The matrix should be "tight", that is, there should be a // 1 in row 1, and in column 1, and in row M, and in column N. // { string label; int m = 3; int mq; int n = 3; int nq; // // P is given by columns, not rows. // int p[3*3] = { 0, 1, 0, 1, 1, 1, 1, 0, 0 }; int *q; int reflect; int rotate; cout << "\n"; cout << "POLYOMINO_TRANSFORM_TEST:\n"; cout << " C++ version\n"; cout << " POLYOMINO_TRANSFORM can transform a polyomino.\n"; cout << " Generate all 8 combinations of rotation and reflection\n"; cout << " applied to a polyomino represented by a binary matrix.\n"; polyomino_print ( m, n, p, " The given polyomino P:" ); for ( reflect = 0; reflect <= 1; reflect ++ ) { for ( rotate = 0; rotate <= 3; rotate++ ) { polyomino_transform ( m, n, p, rotate, reflect, mq, nq, &q ); label = " P after " + to_string ( reflect ) + " reflections and " + to_string ( rotate ) + " rotations:"; polyomino_print ( mq, nq, q, label ); delete [] q; } } // // Terminate. // cout << "\n"; cout << "POLYOMINO_TRANSFORM_TEST:\n"; cout << " Normal end of execution.\n"; return 0; }