A higher resolution is required to access the IDE
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
In this puzzle, you are given a 20x20 grid showing a shape drawn on a board. The shape is rendered using the characterAll the grids were generated by a pseudo-random algorithm. The algorithm picks one of three geometric shapes—circle, square, or triangle—and draws it with random properties:
â–¶ Position and Rotation: The shape is placed roughly in the middle of the board with a random orientation (for the square and triangle). Some shapes might also be slightly cut off at the edge by a small portion, but the shape remains easily recognisable.
â–¶ Size Variability: The dimensions of the shape vary within certain ranges.
â–¶ Noise: After the shape is drawn, a small amount of noise is added. This means that a few extra empty cells will be filled with
The challenge is to recognise the underlying shape despite the noise and random transformations.
Input
20 lines: Each line contains a string of 39 characters, consisting of 20 space separated # s or . s.
Output
Line 1: A single word: Circle , Square , or Triangle , representing the detected shape.
Constraints
The shape is placed approximately at the center of the grid, but not always in the same position.
Squares and triangles have a random rotation.
All triangles are equilateral.
The shape's size varies within a predefined range.
The shape is easily recognisable by the human eye, ensuring no ambiguity.
A small amount of noise is added to the grid, altering a few cells.
Some shapes might be slightly cut off at the edge by a small portion, but the shape remains easily recognisable.
Squares and triangles have a random rotation.
All triangles are equilateral.
The shape's size varies within a predefined range.
The shape is easily recognisable by the human eye, ensuring no ambiguity.
A small amount of noise is added to the grid, altering a few cells.
Some shapes might be slightly cut off at the edge by a small portion, but the shape remains easily recognisable.
Example
Input
# . # . . # . . . # . # . . . . . . . . . # . . # # # . . . . . # . . # . . . . . . # . # # # # . . . . . . . . # . . . . . . . # # # # # . . . . . # . . . . . . . . . # # # # # # . . . . . . . . . . . . . # # # # # # # # . . . . . # . . . . . . # # # # # # # # # . . . . . . . . . . . # # # # # # # # # # . . . . . . . . . # # # # # # # # # # # # . . . . . . . . # # # # # # # # # # # # # . . . . . . . # # # # # # # # # # # # # # . . # . . # # # # # # # # # # # # # # # # . . . . # # # # # # # # # # # # # # # # # . . # # # # # # # # # # # # # . . . . . . . . # # # # # # # # . . . . . . . . . . . # # # # # . # . # . . . . . . . . . . . # . . . # . . . . . . . . . . . . . . . . # . . # . . . . # . . . . . . . . . # . . . . . . . . . . . # . . # # . . . . . . . . . . . . . . . . . . . . . . . .
Output
Triangle
A higher resolution is required to access the IDE