10667 - Block 3   

Description

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 and apply them to solva one problem:

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,

1.

@OOX
OOXX
XXXX
XXXX

and

XXXX
XXXX
XXOO
XOO@

are EQUAL

2.

@OOX
OOXX
XXXX
XXXX

and

XOO@
OOXX
XXXX
XXXX

are DIFFERENT

3.

XXXX
XXXX
XXXX
XXXX

and

XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX

are DIFFERENT.

 

You need to implement the three functions in function.cpp

Finally, you need to use equal() to check two blocks and output the result.

Input

The input will be given in main.cpp

Output

The output will be generated by main.cpp

Sample Input  Download

Sample Output  Download

Partial Judge Code

10667.cpp

Partial Judge Header

10667.h

Tags




Discuss