Reverse Text

From Hack Wars Wiki

Jump to: navigation, search
Challenge Information for Reverse Text
Challenge Reverse Text
Code 6565
Input Example Hello World! (String)
Output Example  !dlroW olleH (String)
Level 0
Profit $1000
Experience 30 to each stat
Description Reverse the sentence letter by letter.


This is Dedrick's mission ! Now I will NOT put the solution as it would defeat the entire purpose of this challenge. It is pretty easy, once you think about it. Now I *might* say a little too much in there, if that's the case, please tell me how I could change it for the best !

The first piece of advise I would have for anyone starting with programming is GO LEARN A LANGUAGE ! I don't care which one (even though C would be a good idea), but if you want to learn HackScript, YOU HAVE TO KNOW A LANGUAGE ALREADY !

What am I supposed to do ?

Well first, you might want to create a new challenge script. Go to Hackscript Tutorial if you don't know how to do this. After creating a challenge script, you should end up with a sample code with the usual main function. For this challenge, I typed everything in there, no need to go do other functions. Now here is what we want our code to do, and which functions we need to use :

  • Get the first string that Derrick's app sends. For this, we use getInputString().
  • We'll want to know how many characters are left. For this, we will use a well-known C function : strlen().
  • We will want to get only ONE character from the main sentence string, so you will probably need to use substr() function.
  • Once we have all of this, we can use a loop, and just do the algorithm. It's just about using your brain after all this spoiler.
  • We finally to send our final string to Derrick's app. We use setOutputString().


Solution

As I said earlier, I will NOT give anyone the solution, especially after all those spoiler. BUT, if you REALLY need more help, go there : Reverse Sentence will give a good idea of how this works, without giving you the ability to copy-paste and boom it works.

How about even more help ?

These are good places if you need more help for anything else, or just to get your curiosity satisfied :

  • Functions : this is a repertory with ALL of the functions in HackWars.
  • Hackscript Tutorial if this is the first time you ever coded anything, this is a good place to start, even though i recommend learning another language first (it's really up to you).
Personal tools