[Community Puzzle] Bob the ASCII teacher

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @Antsurf,validated by @El_trombone,@BloCubiks and @Eulero314.
If you have any issues, feel free to ping them.

The case where rwidth=1 only appears in a validator and not in tests. It is misleading.

2 Likes

Seems to be easy, but my program cannot pass the “S+” validator.

I correctly handle all sizes including 1. I even handle the (presumably useless) case “size = 0” so the shape is not drawn.
I suppose the “XXX IS NOT A SHAPE” sentence must appear once, even if there are multiple occurrences of “XXX” in the input.
I suppose that if there are multiple forms that can’t be drawn, the sentences “XXn IS NOT…” don’t have to be separated by a blank line (I tested both, with and without a blank line).

The puzzle description lacks some information!

1 Like

Try this custom test case (similar to S+ validator) :

12
30
10
21
# \ +
LINE BANANA RECTANGLE REVERSE_TRIANGLE TRIANGLE

Expected output:

BANANA IS NOT A SHAPE

############

\\\\\\\\\\
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\        \
\\\\\\\\\\

+
++
+ +
+  +
+   +
+    +
+     +
+      +
+       +
+        +
+         +
+          +
+           +
+            +
+             +
+              +
+               +
+                +
+                 +
+                  +
+++++++++++++++++++++

+++++++++++++++++++++
+                  +
+                 +
+                +
+               +
+              +
+             +
+            +
+           +
+          +
+         +
+        +
+       +
+      +
+     +
+    +
+   +
+  +
+ +
++
+

It seems that this puzzle was approved without checking anything at all (as often).

Just for the record: I slightly copyedited the Input and Constraints sections.

Also, the desciption has some grammatical errors. I suggest the following rewrite (I’m not native, so this might not be perfect):

Bob wants to teach his students about ASCII art. He wants to use the following basic shapes for his lesson: {{LINE}}, {{RECTANGLE}}, {{TRIANGLE}} and {{REVERSE_TRIANGLE}}.
-----------------------------------------------
You are one of Bob's students and to get an A on your test, you need to write a program that will output different space-filled shapes whose borders are drawn with particular characters.

You will always be given three ASCII characters. The first one will be used for the border of the {{LINE}}, the second one for the {{RECTANGLE}} and the last one for the {{TRIANGLE}}  and {{REVERSE_TRIANGLE}}.

The {{TRIANGLE}} and {{REVERSE_TRIANGLE}}'s base will be equal to its height ([[theight]]). The right angle of a {{TRIANGLE}} lies at the bottom left of the shape and that of a {{REVERSE_TRIANGLE}} at the top left.

To the creator: Unlike in French, English punctuation marks are generally written with one succeeding and no preceding space.

Thank you. My code produces the exact expected output for this test case.
Unfortunately, it still doesn’t pass the S+.

OK…so…try this one (extremely close to S+ validator) :

27
18
20
15
* _ \
LINE CROSS RECTANGLE TRIANGLE REVERSE_TRIANGLE

Expected output :

CROSS IS NOT A SHAPE

***************************

____________________
_                  _
_                  _
_                  _
_                  _
_                  _
_                  _
_                  _
_                  _
_                  _
_                  _
_                  _
_                  _
_                  _
_                  _
_                  _
_                  _
____________________

\
\\
\ \
\  \
\   \
\    \
\     \
\      \
\       \
\        \
\         \
\          \
\           \
\            \
\\\\\\\\\\\\\\\

\\\\\\\\\\\\\\\
\            \
\           \
\          \
\         \
\        \
\       \
\      \
\     \
\    \
\   \
\  \
\ \
\\
\

Thank you again! This time it’s OK :slight_smile:
I just had forgotten that the “*” could be problematic in a shell script.
Sure the puzzle description could be improved, but for this oversight I’m the only one to blame.

1 Like

I have passed all tests and validators except the basic shapes but different size. Any ideas on what might be causing an issue? Since it is a validator I cannot see where it is failing.

Are you handling width == 1?
Basic shapes but different size is the only validator that uses it.

Yes, I’ve tried a couple different ways of handling width == 1 and still not passing.

Here’s a test case similar to Basic shapes but different size validator

99
7
1
10
# | >
LINE RECTANGLE TRIANGLE
Expected answer
###################################################################################################

|
|
|
|
|
|
|

>
>>
> >
>  >
>   >
>    >
>     >
>      >
>       >
>>>>>>>>>>

In the test cases, the order is always line, rectangle, (one or more ) triangle. In the validators it seems to be different.
The first character is always for line, second for rectangle and third for triangles. So make sure you use the correct character.
Just took me a long time to find this error in my code.

Hey, so first of all thanks for your feedbacks. Then I wanted to apologize if the puzzle is bad written or else, it’s my first one.

However, I decided to delete the rwidth = 1 Validator as it was not inside a test.

Thanks !