NOTICE: You are asked to use C++11 compile setting while submitting your code.
In function.h we define a class called Block. Several constructors and member functions are implemented. Your task is to complete the implementation of the following three functions:
1. void clockwise90();
This function rotates the pattern by 90 degrees clockwise. For example,
@OOX
OOXX
XXXX
XXXX
becomes
XXO@
XXOO
XXXO
XXXX
2. Block& doublesize();
This function enlarges the pattern to make it twice as wide and twice as tall. For example,
CCCC
OOOO
OOOO
LLLL
becomes
CCCCCCCC
CCCCCCCC
OOOOOOOO
OOOOOOOO
OOOOOOOO
OOOOOOOO
LLLLLLLL
LLLLLLLL
3. friend bool equal(const Block& a, const Block& b);
This function checks if two blocks a and b have the same pattern under rotation. You need to take into consideration the four orientations. For example,
@OOX
OOXX
XXXX
XXXX
and
XXXX
XXXX
XXOO
XOO@
are EQUAL
But
@OOX
OOXX
XXXX
XXXX
and
XOO@
OOXX
XXXX
XXXX
are DIFFERENT
You need to implement the three functions in function.cpp.
You can use main.cpp and function.h in 10596 to accomplish it.
The input will be given in main.cpp.
The output will be generated by main.cpp