Welcome to the Ranch
When you say non‑working attempt, it sounds as if you were guessing. That is a labour‑intensive way to get a correct program: you guess differently 1000000 times and there is a good chance that one of those programs will be correct. All you then have to do is work out which one
The alternative takes several steps. You need four pieces of hardware. One is the lead which connects your computer to the power supply. Lay that on the table so you can see both ends. The others are pencil paper and eraser. You write down, very carefully, in English (or other natural language) exactly how you intend to do the search. You refine the search process until you have words of one syllable only. Then you can reconnect your computer and try turning it into code.
Then you will have 999999 fewer versions than before, of which 1 will work