my code pass all the test on submission save for the Lorem Ipsum one. I am testing for a space character and filling the respective output length with the same character. This is driving me crazy.
I didnât have to test for a space, hyphen, or any non [a-zA-Z] character at all for that matter.
I basically parsed the testWord to chars, then during conversion to decimal ASCII, fettered out the non-alpha characters.I then used the decimal values as beginning indices for substrings, which I pulled from the ascii-art String input. These substrings got concatenated & became my output.
No need to search for non-alpha characters, as anything that wasnât alpha got its substring index pointed to the â?â at the end.No need to search the ascii-art input either, as itâs really nothing more than a series of âimagesâ the substrings point to.
For me, the biggest problem with the âanother ascii/loremâ tests was remembering NOT to hard code the widths & lengths or the formulas that use them (failed the first few times before I finally figured out what I was doing wrong).
So basically, for the cranky test that has spaces in it, donât think too hard. The question never said to handle spaces, so spaces should show up as question marks. I special formatted my text to handle spaces at first, got it wrong, checked here, then changed it, and it works.
Good luck!
I must say that this challenge isnât algorithmically though but it either has a bug or isnât completely well explained or both.
Bottom line: the âlorem ipsum âŠâ challenge doesnât pass. My solution is identical to the one described by @pegleg. (I have an array whose keys are the askii codes of the [a-zA-Z] codes, and they store the position on the alphabet (in input file) corresponding to the char they represent - on top of it when reading the file, I use dynamically the H,L and the dictionary described to locate the askii sequence needed, and then concatenate the sequence with former chars of T already parsed and part of the sequence). Every non [a-zA-Z] code, gets mapped to and index containing the pos of â?â on the input alphabet, so basically as some of u already commented spaces are not an issue, as they just get mapped to a â?â ⊠Neverttheles
1 - Lorem opossum still doesnât work
2 - the person that proposed testing locally on your pc, ignores that we donât know all the input params (L,H and askii alphabet), so testing locally is a weak test bc it doesâ represent real conditions.
3 - there are definitely bugs on the software analysing the results (Iâm 100% sure of this bc by deleting a variable definition that is NOT used at all on my program), causes the failure of another 3 tests. YES, I repeat; deleting an old variable which is not used at all, will cause my program to fail extra tests @ submitting time. I saw a bug similar to this on the example #1. Up until now , using 6 languages, Iâve had bugs only when programming in C, so it seems the analysing software for C is particular error prone.
Any new info - particularly if u used C, would be nice. Thx
THIS IS THE REAL PROBLEM:
Ok, Iâm sorry if this seems arrogant,but after suffering HOURS with C (and having a solution that completely follows the spec), the problem making the âlorem ipsumâ test fail is the presence of the character â0â (askii 0 == Null char) on T. Remember how the instructions say that you should map all non [a-zA-Z] to â?â ? Well, that isnât completely true, as with a 0, you have to terminate the sequence, basically 0 is here your EOF - finito - fertig - donât go ahead.
@antonioiturriza
the character you are speaking of is â\0â, and in C, it means the end of the char*, and is a norm for c-string. if you use strlen for example, it will return the length of the string up to that character, so it is not a strange behavior
@CvxFous, Hi; thx for your comment, you are completely right. It ist not a problem on the spec of this problem; and this a standard chracteristic of Strings termination.
Aside from that, when Iâm coding here in C (here at codingame); I donât have access to such standard string C functions (like strlen or strcpy - and yes, the #include <string.h> is there); allways receiving: â[NAME OF FUNCTION] was not declared in this scopeâ ⊠So, I did assume we arenât intended to use them, and did it manually. Since that end of String âproblemâ was causing my solution to fail the lorem itsum test, I wanted to share that with the ppl here that seemed to struggle with the same.
Bottom line, thanks; you are right, there is not a problem on the spec; nevertheless there is a reason why 80% of this blog is related to ppl failing just that test (lorem itsum), and wanted to share that with them, so that theyâll save time.
I like how you answer nice and politely, thatâs really cool
Thatâs clearly isnât normal, what include are you using? if you type âman strlenâ on a term, you should see you need to do #include < string.h>. if you are using C inside C++ code, you should use #include < cstring>.
Either way, you definitly have access to all the standard library!
Tell me if you have any more trouble and keep coding
Well, now that you mention it, it is kinda weird⊠Upon closer inspection, I am running C code in a C++ project (how embarrasing is that XD) so the #include should have been string.h instead of string.
Thaks again, my faith on the standard lib is recovered!
@antonioiturriza actually, my post was badly edited, in your case, the code you are looking for is
# include <cstring>
Every C library in C++ need to be prefixed by the character âcâ, example for stdio.h:
#include <cstdio>
The following test cases do not show:
Test AB!!CD (100 pts)
Test Lorem ipsum dolor sit amet,⊠(100 pts)
Câest assez difficile de solutionner le Lorem Ipsum, mon programme passe tous les tests sans problĂšme mais celui ci, non. Les espaces sont remplacĂ©s par des â?â et tout est ok.
Le Lorem Ipsum Ă©tant un texte complet de test de mise en forme connu, jâai fait un gros copy/paste de tout le texte que jâai simulĂ© en input, et ce que mon code renvoie est totalement dĂ©structurĂ©, par contre si jâenvoie la phrase uniquement en 2moitiĂ© ou en 3tiers, tout passe correctement.
Une idée ?
Tu utilises quel langage ? Si les tableaux ont besoin dâune taille prĂ©dĂ©finie comme en C, le bugue est peut-ĂȘtre lĂ .
En Python, ce nâest pas le cas sauf en interne (dans la tambouille de lâinterprĂ©teur) et mon code est passĂ© sans problĂšme.
Aucune idĂ©e pour moi. En plus jâai plus accĂšs aux tests validateurs maintenant sighâŠ
Tu peux mâenvoyer ton code Ă comtealexis[at]gmail[dot]com si tu veux que je tâaide.
Ne me linchez pas, jâutilise VB.Net ⊠Je vais me renseigner sur la taille maxi des Arrays, bien vu.
Câest sĂ»rement temporaire, jâai rencontrĂ© la mĂȘme blague avec le TEADS.
Tu parles des tests validateurs?
Je ne sais pas sâils sont accessibles Ă la soumission, mais ce que je voulais dire câest que quand jâĂ©tais en stage Ă Codingame, je pouvais voir les entrĂ©es exactes donnĂ©es par ces tests, et donc plus facilement deviner dâoĂč pouvait provenir les bugs.
Ha OK, je ne savais pas que tu avais un accĂšs interne.
my solution works for every test except âTest HELLO with another ASCII representation (100 pts)â. Donât really understand it either. Any help?
Try to debug with the error output?