I'm working on a game where the player going to encounter a alien race, which is suppose to have a digit up to 16. I have manage to make the code that can translate Alien to Human. But not Human to Alien. I'm using A-G in the code for the 10-16 digits. How do I make the Human to Alien method?

Just in case someone wants/need to see my code that translate Alien to Human.

This isn't too hard, you just have to convert from base 10 to base 17 or vice versa (it's base 17 since you have 17 possible digits). How you do this is successively divide your number by whatever base you are converting to and keep track of the remainders.

In your case, just call convertToBase(whateverNumebr, 17). That should work fine. Converting from one base to another is a similar process.

EDIT: I didn't notice that you wanted it to work for negative values as well. Just check if the integer is negative at the beginning of the method and multiply by -1. Then put a final "-" string at the front of output before you return.

2nd EDIT: Oh wow, I didn't realize that the Integer.parseInt() method could do this for you. I agree with those above, just use that instead of writing your own method. Still, it's nice to know how it works!

This is correct. You are not in hexidecimal since you have 17 symbols (0-9 and A-G) representing values. That means that each place value represents a power of 17. In regular old decimal we call these the 1's place, 10's place, 100's place, etc., which you learned about in school. So your alien numerical system works on base 17 so you have the 1's place, 17's place, 289's place (17*17), 4913's place (17*17*17), and so on.

Thanks, now I understand how it works. I was so stuck in base 10 that I didn't know what changing to base 17 was going to do ^^

However, if even you as the developer had problems to understand this, maybe it's not such a good idea to put it into the game...

And your reason behind that is, what exactly? I want to push my boundaries so I can learn something. If I didn't I wouldn't been able to code at all since I don't understand it there for I shouldn't learn it.

And your reason behind that is, what exactly? I want to push my boundaries so I can learn something. If I didn't I wouldn't been able to code at all since I don't understand it there for I shouldn't learn it.

It was just a hint that the player might have the same or worse problems. So if its important to the game to be able to get these numbers, almost nobody will be able to. If it's not important, then it doesn't matter...

And your reason behind that is, what exactly? I want to push my boundaries so I can learn something. If I didn't I wouldn't been able to code at all since I don't understand it there for I shouldn't learn it.

It was just a hint that the player might have the same or worse problems. So if its important to the game to be able to get these numbers, almost nobody will be able to. If it's not important, then it doesn't matter...

That's what play testers are for. But I had just planned to use this as a count down in seconds to things like self-destruct. But also have it spread around the game to clew the players that it's numbers.

If you want something a little more interesting you should look into alternate numerical systems. For example, the ancient Mayans had a cool counting system based on base 60(!) and writing a translator could be a lot of fun actually. You could change the symbols to be more "alieny" as well. I like the idea of aliens having their own language in general, I think that's pretty cool.

If you want something a little more interesting you should look into alternate numerical systems. For example, the ancient Mayans had a cool counting system based on base 60(!) and writing a translator could be a lot of fun actually. You could change the symbols to be more "alieny" as well. I like the idea of aliens having their own language in general, I think that's pretty cool.

Good luck with your game.

Thanks, I think I stay at base 17, at least for this race. But I will use another font so the alien words looks different, I'm to lazy to come up with a whole new language.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org