ASCII art puzzle discussion

it say’s a.replace(",", “whatever you want”) is not a function on other tipes of framework it works… i stored the need strings in an array
after that i sliced that array and pushed it into another array and when i read that array with for loop i get the text but i get it with comas after each string , i guess what i need to do print some how every string from the array …

i can not beleive javascript is so dumb, need to test it

it’s a pity for me that i read the whole documentation on this method and understood like only half

i can send you my code to check it out and see

I’m not sure I understand what you are trying to do. Try to think about it this way.

As input you get a string with the text (save it as a string). You also get a number of strings with the “artwork” for the letters. The first string represents the first line of the letters and so on (save them as an array of strings).

Then you have to print out the text with the artwork, also line after line.

For each line.
    Let *str* be an empty string.
    For each letter in the text.
        Take the corresponding substring from the array and append it to *str*
    Print *str*.

You don’t have to transform any arrays, you just have to lookup the result with an array access and the substring function. You already know how to calculate the indices for substring.

hello (world)
first of all i am using java to solve the game

i am putting all the ascii representation of the letters in a hashMap with the letters as keys and String arrays as values.
to print the answer i build a string for each line of the answer, from the corresponding line of the letters.

for some reason when i enter the strings to the arrays on the map they lose the space characters on their end
i can solve it for most cases by hardcoding an extra space when i insert it to the answer.
but i am looking for a way to get those spaces in without hardcoding solutions.

this is the code i am using to insert values to the map:

for (int i = 0; i < h; i++) // inserts values to ascii map
        {
        String rOW = in.nextLine();
        for (char j='A';j<='Z';j++)
        {
            String letter = String.valueOf(j);
            String arr[] = ascii.get(letter);
            arr[i]=rOW.substring(0,l-1);
            rOW=rOW.substring(l);
        }
        ascii.get("question mark")[i]=rOW.substring(0,l-1);
    }

what map? you are overwriting the task

[NO FULL CODE]

bvs23bkv33 thanks for the answer

i am not sure why but i wanted it to be easy to access the ascii letter even out of the loop so i created the map to store the values.

now i have solved it with your idea and it works.
but i am still trying to figure out why it dropped the spaces at the end of the strings before.

thanks for your help i solved it eventualy …

abdi

Hi I seriously need help creating Ascll art but I need most
help debugging and solving it , please help .

I’m at a loss for what I’m missing - here’s the console output from the first test case:

L: 4
H: 5
T: E
### 
#   
##  
#   
### 


Fail
Found:    "### "
Expected: "### "

Maybe a \n missing?

How would I validate that? I’m using C# and (despite it probably being overly complicated) I’m building an 2-D array of output characters, then spitting out each row with Console.WriteLine(new string(output[rowIdx]));.

Dear fellow coders,

I’m quite new to Python, please explain me why is it not working as I think it should work.

For this pretty simple exception handling use case (sorry for the indentation, dunno how should i format it here):

try:
indexes.append(letters.index(t[i].upper()))
except ValueError:
indexes.append(letter.index(’?’))

Now, when I’m trying to get a character from the list, which is not present in the letters list, like ‘@’, then the console is rather complain about the unexpected exception instead of just jumping to the except part of the code.
Is it normal? How should I handle these cases otherwise?

Thanks.

Why not using a set or a hashtable (dict)?

Bonjour,

je ne comprend pas le problème :

Voici ce que j’obtiens pour M@NH@TT@N

Fail
Found: "# # "
Expected: “# # #”

Je ne comprend absolument pas pourquoi l’expected me montre une chaîne de 5 caractères de long, alors que dans le fichier de données, la première ligne contient 4, qui est “la largeur L d’une lettre representée en art ASCII. Toutes les lettres font la même largeur.”

Dans l’expected, je vois la première ligne du M puis le premier caractère du “?”.

C’est confirmé par :
Fail
Found: "# # "
Expected: "# # " (votre moulinette d’affichage (mais pas celle de l’édition) des messages sur le forum effectue une suppression des espaces qu’elle juge inutiles, mais la console m’affiche bien deux espaces avant le deuxième ")
pour le cas MANHATTAN,

et par :
Fail
Found: " .----------------. "
Expected: " .----------------. " (votre moulinette d’affichage (mais pas celle de l’édition) des messages sur le forum effectue une suppression des espaces qu’elle juge inutiles, mais la console m’affiche bien deux espaces avant le deuxième ")
pour le cas avec une autre représentation ASCII.
A chaque fois, l’expected me montre L caractères + 1, au lieu de L caractères.

Il n’y a que le cas E qui passe.

Merci.

Hello coders! In the last test with a different ASCII fonts it seems to be a trouble with Letter “N” How to ask a developers of TEST CASE to sort it out?

1 Like

Beware if your code is in Javascript because : str.search(’.’) returns 0 and not -1 as expected if str is not empty !!! I don’t understand why…

That’s why this test can’t pass for me. I replaced str.search() by str.IndexOf() and all is ok !

str.search converts its argument to a regular expression and uses that to search, and in a regular expression the point stands for “any symbol”.

1 Like

OMG ! I’m so stupid ! Thank you for explaining me my mistake !

I Found the same problem as you! The first line for the letter “N” as one “-” more than all the others, and doesn’t end with a blank space, like the other letters do!