/r/NerdyChallenge

Photograph via snooOG

Programming challenges for programmers of any experience. The challenges are meant to be fun, with a strong accent on fantasy, sci-fi, geeky themes.

Welcome to /r/NerdyChallenge!

Here you'll find programming challenges for programmers of any experience. The challenges are meant to be fun, with a strong accent on fantasy, sci-fi, geeky themes.

You can try to solve the challenges in any programming language you like the best. This is a great way of learning a new language!

Anyone is invited to submit challenges and post solutions to tasks already submitted.

When posting a new challenges, try to give it a catchy, thematic name and specify in the title a difficulty level in the range [Easy] [Intermediate] or [Hard].

You can submit solutions as comments to the post or by linking an external page (for example a Github repository). When submitting as a comment, format the code by indenting it with four spaces. They'll appear "hidden" till you hover the mouse on them. This prevents spoilers to others that might be still working on it.

/r/NerdyChallenge

1,634 Subscribers

3

Announcing 2nd edition fo 10 Days Challenge

0 Comments
2020/06/21
13:29 UTC

9

A famous wizard needs the proper spell [intermediate / difficult --- interface problem]

Wizard McWizardface is creating a clockwork army to decimate his rival, Warlock McWarlock face. The problem is he can only generate a certain amount of mana on his own each month. Wizard accomplices can help him by contributing their own mana via mana stones. His different accomplices have signed up to contribute various amounts of mana each week. Wizard McWizard face needs a simple interface to generate mana invoices for his buddies. He needs: Month

Name

Amount contributed each week

Number of contributing weeks in the month

Total contributed mana needed for the month

Any streamlining for wizard McWizardface is appreciated as the simple data base will be used over the course of a couple years to help the cause against warlock mcwarlockface. The invoice created should be generated as a text file or something equivalent. I for one hope his clockwork army is raised sooner than later.

Have fun spellcasters

5 Comments
2016/04/22
03:07 UTC

10

[Intermediate] Teach a computer a foreign language using Duolingo.

So someone asked me if it would be possible to get a computer to automatically go through the skills on Duolingo in order to gain lingots. I think it's possible and maybe not all that hard.

So the challenge is to write a program that will go through and "learn" a language on Duolingo.

(Here's what I think needs to happen for each lesson).

2 Comments
2016/01/31
04:53 UTC

15

Bluff challenge

Elon Musk, Stephen Hawking and anyone who visited a cinema in the last 30 years, are worried that the world will be taken over by an AI. Contribute for the computer team and write an AI that can bluff!

We have built a coding challenge based on the board game Bluff / Liar's Dice, and the AI can be written in Javascript, C #, Python, Java, C++ and C.

There are prizes for the best contributions (deadline March 31, 2016). The cake is real.

http://honeypot.softwareskills.se/#/landingpage/55f67c9b92be260c0f8a62ac

0 Comments
2016/01/16
14:30 UTC

26

Dr. Frankensteel and Dr. Frankensteal [HARD]

In the creepy land of the eastern-European region known as Transilvania, lies a creepy valley where two mad scientists have been challenging each other for years. Hidden in their spooky mansions, Dr. Frankensteel and Dr. Frankensteal have a new hobby. Tired of handling corpse parts, they both have started creating robots assembling used robot parts they have laying around.

Competitive as they are, and animated by an ancient hate for each other, they've started fighting on who has the largest army of robots. In need of robot parts, every night they send their minion in the dump of the robot factory Droidsky Lte. To assemble a single robot, they need:

Head, Body, "Left arm", "Right arm", "Left leg", "Right leg", "CPU", "RAM", "Hard drive"

The first night, in the factory there are 20 random robot parts chosen from the above. Every night the factory dumps 1 to 4 random body parts that add to those already in the dump. At the same time, the minions of both the scientists go to the dump and each collect 1 to 4 random body parts from those in the dump. They then go back to their mansion and handle the collected parts to their masters.

Dr. Frankensteel and Dr. Frankensteal, then, try to assemble as many robots as they can with the body parts they have.

To run the simulation, each night occurs after 100 milliseconds. The factory and the two minions operate at the very same time (you got it, this is a problem in concurrently programming and shared resources!). See after 100 nights (10 seconds) which doctor has assembled more robots!

6 Comments
2015/12/21
15:51 UTC

21

[Easy] Robot Miners on Rigel 9

#Robot Miners!!!

One of the barren moons of Rigel 9 is a great source of pure Madeitupium® used for FTL travel. We have automated bots that mine this resource without human intervention. However, fuel for the miners is expensive and limited.

The mining area is a 9x9 grid where an 'X' is solid rock, and an '@' sign is Madeitupium. You can choose any entry/exit point you wish.

#Rules

  1. The bot can only travel or mine in four directions, NSEW, no diagonal movement.
  2. The bot has no knowledge of where the ore is. edit: The bot can see any ore in blocks adjacent to the block it is in (except diagonally)
  3. The bot uses 1 unit of fuel for every block that is solid rock only. (mining the ore, and moving through already mined blocks is 'free'.
  4. The bot can only move one unit on the grid at a time.

#Input

X X X X X @ @ X X
X X @ X X X X X X
@ @ X @ X X @ X X
X X X X X X X X X
X X @ X @ X X @ X
X @ @ X X X X @ @
X X X @ X X X X X
X X X X X X @ @ X
X X @ X X X X X @

#Output

Minimum number of fuel units expended to get every piece of ore.

12 Comments
2015/12/21
02:55 UTC

19

[Easy] Defend your home planet from Space Tigers!

You are a general whose army is at war with a race of mutant space tigers that are invading your lands. These space tigers understand English, but they have limited decryption skills. You must find a way for your troops to communicate without those messages falling into the wrong paws. Your solution is to encrypt your messages in the following way:

First, the spaces and punctuation are removed from the text. Let L be the length of this text. Then, characters are written into a grid, whose rows and columns have the following constraints:

⌊√L⌋ ≤ rows ≤ column ≤ ⌈√L⌉, where ⌊x⌋ is floor function and ⌈x⌉ is ceiling function, and √ is the square root. Floor and Ceiling work by returning the next lowest or next highest integer, respectively.

For example, the message The enemy base is between the mountains to the east. Attack at dawn. after removing spaces and punctuation is 54 characters long, so it is written in the form of a grid with 7 rows and 8 columns.

theenemy  
baseisbe          
tweenthe  
mountain  
stotheea  
stattack  
atdawn

Ensure that rows×columns ≥ L
If multiple grids satisfy the above conditions, choose the one with the minimum area.
The encoded message is obtained by displaying the characters in a column, inserting a space, and then displaying the next column and inserting a space, and so on. For example, the encoded message for the above rectangle is:

tbtmssa hawottt eseuoad eeentta ninthtw estaean mbhiec yeenak



Messages:

  1. Need supplies. Cannot hold our position for long.

  2. Tiger stronghold was found in the west. Second division attacks tomorrow. Fry those furry bastards with napalm.

  3. Our new secret weapon is a giant ball of catnip! We will lure the entirety of their forces into our trap. Extra string and laser pointer rations will be dispensed tonight.

15 Comments
2015/12/20
15:22 UTC

22

Indiana Jones and the Falling Ceiling [Easy]

The tugs of the evil Cult of the Winged Goat have stolen four treasures from the British Museums: the Amulet of Yawin ("a"), the Bracelet of Wiggins ("b"), the Collar of Cervesa ("c") and the Demijohn of Ferility ("d").

Doctor Jones manages to retrieve them in the Pakistani Temple of the Winding Fear, but on his way out he got trapped in a room with the ceiling falling down on him.

On a wall, he notices four recesses that seem to be the same size of the treasures. He tries to put a treasure in each of them and he discovers that each treasure must be placed in the exact recess. Meanwhile, the ceiling keeps falling! When he placed the treasures, noticed that one of the four green gems stuck in the wall lit. He understands that it indicates how many of the treasures were in the correct position (only one!).

Write a mastermind-like game that accepts input from the player in the form of

a b c d

and tells how many treasures have been placed in the correct position. At every run, the correct position of the treasures is chosen randomly. The player only has 7 rounds before the ceiling crushes Indiana Jones! Here is an example of the output:

Time is running out and the ceiling is falling on you!
> a b c d
Only one treasure is in the correct position. You hear the ceiling coming down!
> a c d f
You don't have such treasure!
> a c d f asd asd as dlaks d
You don't have such treasure!
> a b d c
Only two treasures are in the correct position. You hear the ceiling coming down!
> d b c a
You did it! Indiana managed to escape the room!
16 Comments
2015/12/18
09:33 UTC

18

[Hard/Insane] For the Imperium!

The God-Emperor of Mankind is working on predicting the outcome of future battles against Tyranids so that he can allocate Space Marines more effectively to reclaim the galaxy. However, he can only communicate through the Emperor's Tarot due to his situation (read that first link). So, this is what we have:

A given Legion has some number of Space Marines large enough that you don't need to worry about running out. Each Legion has a unique history and favored foe, meaning that each Legion performs differently against the Tyranids. Furthermore, there is an equal number of Planets as there are available Legions infested with a known amount of Tyranids. Lastly, the directions must be communicated via divinations through the Emperors Tarot; 4 cards are drawn, with the second and fourth card giving meaning to the first and third respectively.

Input is given as Legion (a single letter) followed by sets of 3 numbers (Skills), 'a', 'b', and 'c'; if the number of Tyranids remaining is divisible by 'a', 'b' of them can be killed at a cost of 'c' Space Marines in one standard (Earth) day. All Legions can kill Tyranids at a minimum Skill of 1 with a loss of 1 (aka, every Legion implicitly has 1 1 1). All Legions have some number of Skills, but the number of Skills varies (you're only guaranteed that the number of numbers after a letter is divisible by 3). After 13 Legions (A-M), 13 Planets will be listed (M-Z) with a single-letter name followed by a number of Tyranids infesting the planet.

Your goal is to calculate the Legion-Planet combinations that kill all of the Tyranids with minimal loss of Space Marines. Your output should be a set of two Number-Legion/Planet pairs; The first number is the longest number of days it takes to win the first 6 planets, followed by the 6 Legion-Planet pairs as a string, then the longest number of days it takes to win the subsequent 7 planets followed by their Legion-Planet pairs.

Small (not calculated, made up to show format) Example:

Input:

A 2 4 1 3 2 1
B 11 4 2 50 100 70
N 1000
O 12600

Output:

250 AN 1200 BO

And after converting to Emperors Tarot:

1200 ANBO

NOTE: If the Tyranid infestations are taking too long to process, or you don't want to deal with the weird solution that's required due to the infestations being larger than Int32 max value, divide each Planets infestation size by 1,000 or 10,000 and note it in your solution.

Real Input:

A 11 40 1 7 50 2 200 150 6 2 4 1 1000 600 30 
B 30 20 5 18 200 2 95 500 5 256 512 32 20 10 1
C 10000 40000 400 1290 600 100 65 40 2 77 45 3 14 7 1
D 345 564 21 30 50 10 77 29 1 290 362 84 361 716 34 26 8 1
E 38 1221 65 14 35 6 344 256 37 6 8 5
F 678 268 69 79 846 53 12 6 1 343 75 41 69 77 9 
G 546 465 45 890 126 5 56 7 5 59 16 2 384 67 8 
H 345 452 87 79 8 4 56 13 2 465 34 5 664 51 3 
I 925 1098 91 355 646 7 82 35 3 376 21 46 62 34 7
J 654 567 23 98 80 7 96 32 1 865 3464 83 746 367 5
K 895 2345 90 354 5708 32 156 67 5 546 2608 93 
L 56 345 63 868 1352 34 81 68 3 473 61 98 45 6 1
M 133 345 65 67 31 3 457 625 33 12 5 1 6487 5132 48
N 12000000 
O 1234567890
P 7000000000
Q 916917918
R 123454321
S 47891545
T 8902635894
U 954795454
V 7324345
W 9431436875
X 246677842
Y 348341778
Z 17892341732

Real Output: TBA

[INSANE+]

Optimize for minimum number of standard days to total conquest, weighted against increase in lives lost such that conquer achieved 10 days faster is worth one additional death. For example, if previously it would take 800 days, but now you can do it in 790 days, its acceptable only if the Space Marine deaths increase by no more than 1; else, keep the original 800 day result and print that the increase in lives lost is too great. This doesn't need to be printed as Emperors Tarot.

INSANE++

Do all of the above, and optimize for best possible runtime. I won't know what the theoretical best possible runtime is for a little while, so stay tuned!

INSANE++

Do all of the above, and optimize for minimum memory use. I won't know what the theoretical minimum memory use is for a little while, so stay tuned!

HINTS

Spoiler tags don't quite work, so mouse over the link until the 'URL' pops up, which is the hint text.

Basic Hint

Specific Hint

INSANE+ Hint

INSANE++(a)(b) Hint

EDIT:

The output of the example (which wasn't calculated so the numbers are made up) indicated that after 800 days (aka, applications of a rule) the Tyranid population of planet N was reduced to 0 by legion A. The rule [2 4 1] indicates that if the current population of Tyranids is divisible by 2, you can reduce it by 4 at a cost of 1 death in one day (all rules take one day to apply).

So, say there are 10 Tyranids; 10 % 2 == 0 so we can do 10 - 4, deaths + 1, giving us the next "day"; 6 Tyranids left with one Space Marine dead.

Now that 6 % 3 == 0 and 6 % 2 == 0, we have to see which is 'cheaper' in terms of Space marine deaths; reducing by 2 at a cost of 1 (rule [3 2 1]) or reducing by 4 at a cost of 1 ( rule [2 4 1]). This gives us two new possible results, 4 Tyranids left with 2 Space Marines dead on day 2, or 2 Tyranids left with 2 Space Marines dead on day 2.

The final day will apply rule [2 4 1] on both options because neither is divisible by 3, giving us two final possibilities, both of which are 0 Tyranids left after 3 days with 3 dead.

So, to display that, you'd print 3 AN indicating that planet N could be conquered by legion A in 3 days, best-case.

EDIT 2: Added option of reducing Tyranid infestation size.

18 Comments
2015/12/17
14:37 UTC

15

The xenozoo of Delta Dandelion [Part 1] [Easy]

The family-friendly moon of Delta Dandelion hosts one of the biggest zoos of the galaxy. You've been asked to prepare a new attraction for the guests. It consists of a cage with beasts of different races in it. Since the beasts they have in mind are rather aggressive, fun is guaranteed.

You must be able to generate a cage of any size, since they must change their mind at any moment. An empty cage cell is represented by a dot "." This is an example of a 5x5 cage:

.....
.....
.....
.....
.....

At the zoo they have a large amount of three species of beats: the Arctic Ants of Arthurus, the Betlegeusian Baboons and Chimeras from Centauri. On the map they're gonna be represented by "A", "B" and "C".

Ants eat Baboons, Baboons eat Chimeras and Chimeras eat Ants.

You might be asked to put any numbers of beasts of any kind in the cage. You should place them in random empty spaces. This is an example of a cage with 5 Ants, 4 Baboons and 3 Chimeras:

.B..A
C.A.B
.A...
C..BA
A.B.C

The simulation is updated every second. You should update the representation accordingly to reflect the changes.

Every second each beast:

  • Tries to move
  • It moves orthogonally (up, down, to the left or to the right) but never diagonally
  • To move, it first locates the nearby good cells. If no good cell is found, it doesn't move
  • A good cell is a cell that is either empty or contains a beast of it same species or a beast of the kind it eats. A cell containing a beast of the species it's eaten by is not a good cell.
  • Among the good cells, it randomly chooses one
  • If the cell is empty, simply move there
  • If the cell contains a beast it eats, it moves there and the eaten beast is dead and removed from the cage
  • If the cell contains a beats of its same species, it doesn't move there. Instead, it locates another adjacent cell that is empty, and there, if found, it spawns a new beast of its species (you got it right, they mate)

Now, build a 15x15 cage with 10 beast per race and see what happens!

Easy peasy! You don't have much time to work on this, they're already advertising the new cage on the intergalactic television and the second part of the simulation is coming soon!

4 Comments
2015/12/17
08:00 UTC

25

Cool christmas themed coding challenges [Easy - Intermediate]

1 Comment
2015/12/17
06:24 UTC

68

NerdyChallenge is now a trending subreddit! Congrats everyone and thanks folks :)

8 Comments
2015/12/16
09:51 UTC

34

Cosmic Conflicts Part 7: The Strength Rises [Easy]

Today is the day! The most awaited movie of the year is out: Cosmic Conflicts Part 7: The Strength Rises!

Let's recreate the now legendary fight between the evil Derp Water and his son Puke Skypeworker, each armed with a powerful Plasma Dagger.

The lazy screenwriter didn't have time to write all the 28 minute long scene that made the history of Cinema. He, instead, wrote it using a well known code used in Hollywood for battle scenes.

For each character he wrote a sequence of letters like this:

ZSwmMcHD3rkPausABJKLVzyd5YFOW2iRX8...
  • Turn each letter into its corresponding ascii code, so that 'a' is 97, 'A' is 65 and so on

  • Concat the numbers treating them as strings to obtain a long sequence of numbers ('aA...' -> '9765...')

  • If the resulting string has an odd number of characters, remove the last one

  • If the length of the obtained strings is different, shorten the longest one to match the length of the other

  • The first ten numbers represent hit points (HP) for ten body parts. The ordered list of body parts is:

    Head, Back, Torso, Stomach, Left Arm, Right Arm, Left Leg, Right Leg, Arse, Groin

  • So, if the string begins with "9765...", it means that the Head has 9 hit points, the back 7 HP and so on

  • Each couple of numbers from the eleventh to the end represent a blow done by the character. The first number of the couple is the body part of the enemy he hits (according to the previous list, 0 means that he hits the enemy's head, 1 his back and so on). The second number represents how many HP of damage he deals to that part. So, [4 8] means that a character is hitting his foes's left arm for 8 damages.

  • Each turn both the characters hit their foe. A hit body part loses HP. For example, if Derp Water has 8 HP on his Right Leg and it is hit for 6 point, his Right Leg has now 2 HP

  • A body part cannot ever have less than 0 HP and more than 9 HP

  • When a body part is hit and drops to 0 HP, all the other body parts receive 0.5 damage

  • After each turn, when both the characters have hit the enemy, all the body parts of both characters heal for 0.5 HP (this is thanks to the Strength and for cinematographic reasons!).

  • When all the hits of both characters have been done, sum the HP of all the body parts for each characters. Whoever has the highest number is the winner of the fight!

Example

Puke Skypeworker code stars with:

9485829472847285638274836284...

The first ten number (9485829472) are his body parts HP.

The pairs of numbers from the 11nth on (847285638274836284...) are his hits ([8 4], [7 2], [8, 5]...). On the first round he hits Derp Water's arse for 4 HP, on the second round he hits his evil father's right leg for 2 points and so.

Input

Stolen from the original 1980 movie script, this is Puke Skypeworker's code:

VHcNPqjzphogX0dlaY5DvwWeZ7TGuIQ8B4Kxfbi1rSFE23RJs6nC9AUtMkLmOy

And this is Derp Water's:

T4ZIaO8czKuXM6GEi1hDLPyJtAUfpsRNnoQrjYveVd709H2Bwm5gWbxS3CFqkl

Who wins this epic fight?

BONUS

Print out the battle script as it goes on to have something like:

  • Derp Water hits Puke Skypeworker's stomach for 4 HP
  • Puke Skypeworker's hits Derp Water's groin for 7

...

When a blow deals 0 damages, print something like:

  • Derp Water misses Puke Skypeworker's head

May the strength be with you!

15 Comments
2015/12/16
09:50 UTC

33

Giving vampires a little tan [Intermediate / Hard]

Totally non stealing the idea from the Blade saga movies, researchers at Vamonos Vamps Ltd have invented a new powerful weapon to contrast the recent rising of vampire attacks: ultraviolet light bombs!

The undead creatures live in rooms like the following where a hash "#" represents a wall and a dot "." is a blank space:

###########################
#.........................#
#.........................#
#.........................#
#.........................#
#......................4..#
#.........................#
#.....3...................#
#.........................#
#.........................#
###########################

The numbers your see in the map are vampires. As you may guess, they are different in strength, from 1 (the glittery Edward Cullen) to 9 (Count Dracula). So the 4 you see is the position of a middle-range vampire.

Each bomb is identified by four parameters: where it has been thrown, its range and its power. The bomb [4 6 3 5], for example, is a light bomb dropped in position 4, 6 (where 4 is the x coordinate and 6 the y coordinate) with a range of 3 and a power of 5. Coordinates are relative to each map where (0, 0) is the upper-left corner.

When a bomb is thrown, it deals its full damage (5 in our example) in the position where it's dropped. It deals max power-1 in the adjacent cells, max power-2 in the cells of the outer ring and so on till its range. The bomb [6 4 3 5], for example, deals the following damages:

###########################
#.........................#
#...33333.................#
#...34443.................#
#...34543.................#
#...34443..............4..#
#...33333.................#
#.........................#
#.........................#
#.........................#
###########################

Whenever a vampire is hit by a bomb, he is dead if the power of the damage is equal or greater than his strength. Explosions don't sum up! So, if a vampire of strength 6 is hit by two explosions, one of power 3 and one of power 4, he is still alive.

These are the records of a recent attack. Can you tell how many vampires have been killed in total? Each record is made up of a map and the list of dropped bombs.

####################
#....7.............#
#..................#
#..................#
#...2..............#
#...............3..#
####################
-
16 1 3 5
4 1 2 8
6 3 5 5
14 4 4 7
-----
############################
#......................3...#
#..........................#
#...9......................#
#..........................#
#.................1........#
#..........................#
#.....2....................#
#..........................#
#..........................#
#...................5......#
#..........................#
############################
-
22 2 4 5
18 5 2 3
23 9 5 8
9 5 9 12
-----
#################################################
#..............1.1..........................3...#
#...2..................2............5...........#
#.......6...................8...................#
#################################################
-
16 1 2 2
6 2 5 8
30 2 10 13
40 2 5 7
31 3 4 10

[HARD]

So far we've dealt with the richest vampires that live in luxury, squared apartments. But most vampires lurk in the sewages and as you know sewages tend to be quite intricate. This makes things a bit harder.

In the following example, if a bomb is dropped at the asterisk position, no matter how powerful it is, the vampire of power 2 won't be hit because he is protected by a wall!

#################
#...*...........#
#######.........#
      #2........#
      ###########

To analyze the following records, you must take into account if it is possible to draw a straight line from the bomb to the vampire and check if it's been actually hit.

Hint: One way of doing this is to use the Bresenham line algorithm!

These are the records of the attacks in the sewages. How many vampires have been killed?

      ########################
      #...............1.....2#
      #..3...........#########
      #............3.#
#######..............#
#..........#####.....#
#.......6..#   #..1..#
############   #######
-
20 2 4 5
13 4 7 10
4 5 6 15
-----
    ###############
    #....4........#
######.............###  #############
#..................2.#  #...2.......#
#...6................####...........#
#######......................########
     #...5..................#
     #......................#
     #.........#####.....####
 #####........2#   #..2..#
 #3......#######   #.....#
 ##.....1#         #....4#
  ########         #######
-
21 5 5 6
24 5 5 7
8 8 6 10
10 9 4 7
7 2 5 10
27 7 6 6
23 10 2 3
12 3 7 7
20 Comments
2015/12/15
08:50 UTC

68

The Türinng machine [Intermediate]

Earth, year 2134. Our beloved planet has been invaded by a race of evil, yet rather stypid, platypus-like aliens. Human resistance is fighting against them at its best, but it is losing badly. Fortunatly, in what remains if Finland, a group of brave scientists led by Professor Türinng, is trying to turn things in our favor by deconding the encrypted radio transmissions of the aliens. The scientists are building the so-called Türinng machine and the project is all laid-out.

As a member of the rebel group, you are asked to actually construct the machine and try to decode an alien messaged that has been intercepted. The alien message is the following:

Ev vek avwur mqjk ckutkjkr te nmk uqxn lkqgx vh nmk eteknkkenm skenwgl nmqn nmtx avgur aqx cktei aqnsmkr bbkkeul qer suvxkul cl tenkuutikeskx igkqnkg nmqe oqe'x qer lkn qx ovgnqu qx mtx vae; nmqn qx oke cwxtkr nmkoxkujkx qcvwn nmktg jqgtvwx sveskgex nmkl akgk xsgwntetxkr qer xnwrtkr, dkgmqdx quovxn qx eqggvaul qx q oqe atnm q otsgvxsvdk otimn xsgwntetxk nmk ngqextken sgkqnwgkx nmqn xaqgo qer owuntdul te q rgvd vh aqnkg. Atnm tehtetnk svoduqskesl oke aken nv qer hgv vjkg nmtx iuvck qcvwn nmktg utnnuk qhhqtgx, xkgkek te nmktg qxxwgqesk vh nmktg kodtgk vjkg oqnnkg. Tn tx dvxxtcuk nmqn nmk tehwxvgtq werkg nmk otsgvxsvdk rv nmk xqok. Ev vek iqjk q nmvwimn nv nmk vurkg avgurx vh xdqsk qx xvwgskx vh mwoqe rqeikg, vg nmvwimn vh nmko veul nv rtxotxx nmk trkq vh uthk wdve nmko qx todvxxtcuk vg todgvcqcuk. Tn tx swgtvwx nv gksquu xvok vh nmk okenqu mqctnx vh nmvxk rkdqgnkr rqlx. Qn ovxn nkggkxngtqu oke hqestkr nmkgk otimn ck vnmkg oke wdve Oqgx, dkgmqdx tehkgtvg nv nmkoxkujjkx qer gkqrl nv akusvok q otxxtveqgl kenkgdgtxk. Lkn qsgvxx nmk iwuh vh xdqsk, oterx nmqn qgk nv vwg oterx qx vwgx qgk nv nmvxk vh nmk ckqxnx nmqn dkgtxm, tenkuuksnx jqxn qer svvu qer wexlodqnmknts, gkiqgrkr nmtx kqgnm atnm kejtvwx klkx, qer xuvaul qer xwgkul rgka nmktg duqex qiqtexn wx. Qer kqgul te nmk nakentknm skenwgl sqok nmk igkqn rtxtuuwxtveoken.

Nmk duqekn Oqgx, T xsqgskul ekkr gkoter nmk gkqrkg, gkjvujkx qcvwn nmk xwe qn q okqe rtxnqesk vh 140,000,000 otukx, qer nmk utimn qer mkqn tn gksktjkx hgvo nmk xwe tx cqgkul mquh vh nmqn gksktjkr cl nmtx avgur. Tn owxn ck, th nmk ekcwuqg mldvnmkxtx mqx qel ngwnm, vurkg nmqe vwg avgur; qer uvei ckhvgk nmtx kqgnm skqxkr nv ck ovunke, uthk wdve tnx xwghqsk owxn mqjk ckiwe tnx svwgxk. Nmk hqsn nmqn tn tx xsqgskul vek xkjkenm vh nmk jvuwok vh nmk kqgnm owxn mqjk qsskukgqnkr tnx svvutei nv nmk nkodkgqnwgk qn amtsm uthk svwur ckite. Tn mqx qtg qer aqnkg qer quu nmqn tx ekskxxqgl hvg nmk xwddvgn vh qetoqnkr kpptxnkesk.

Lkn xv jqte tx oqe, qer xv cuterkr cl mtx jqetnl, nmqn ev agtnkg, wd nv nmk jkgl ker vh nmk eteknkkenm skenwgl, kpdgkxxkr qel trkq nmqn tenkuutiken uthk otimn mqjk rkjkuvdkr nmkgk hqg, vg terkkr qn quu, cklver tnx kqgnmul ukjku. Evg aqx tn ikekgquul werkgxnvvr nmqn xtesk Oqgx tx vurkg nmqe vwg kqgnm, atnm xsqgskul q fwqgnkg vh nmk xwdkghtstqu qgkq qer gkovnkg hgvo nmk xwe, tn ekskxxqgtul hvuuvax nmqn tn tx evn veul ovgk rtxnqen hgvo ntok'x ckiteetei cwn ekqgkg tnx ker.

Professor Türinng believes that their encoding algorithm is a simple letter substitution one. That means that each letter of the message simply corresponds to another letter. The eso-linguists working in the team have found that some letters are more common that others in the alien language. Their guessing is that "e" is the most common letter, followed by the letter "t". This is the complete list of letters in order of how common they are in the evil pletypus language:

e,  t,  a,  s,  r,  i,  n,  o,  h,  l,  d,  m,  u,  c,  f,  y,  p,  b,  w,  v,  g,  x,  k,  q

Your implementation of the Türinng machine should find the most common letter in the encoded message and replace it with "e", then find the second most common letter and turn it into a "t" and so on till the whole message is decoded. Time is running out and a new attack may be imminent! Good luck!

37 Comments
2015/12/14
13:05 UTC

63

The Lizardmen General Register Office [Easy]

Down in the depth of Dungeon Inc., a factory specialized in the production of dungeon items, the workers are very busy. The factory has received an order for a huge number of lizardmen and they're working 24/7 on hatching lizard eggs.

The General Register Office is going crazy finding names for all the lizard babies and it's running out of imagination and available names. You've been asked to create the mighty Name'omatic machine to help their task. The machine should generate appropriate lizardy names and help the poor employees of the office. Since the lizardmen society has strict rules for their names, the machine must adhere to some rules to generate believable names.

  • The language of the lizardmen has the following constants: [b d f g l m n p s t v z]
  • The letters "th" syllable is also available in their language and counts as a single consonant
  • The language of the lizardmen has the following vowels: [a e i o u]
  • The consonants [s t z] have twice the probability of being chosen that all the other consonants
  • A lizardman name is composed of at least two syllables each composed of one consonant (or the group "th") plus one vowel
  • After the first two syllables has been chosen, there is 60% of probability of a third syllable. After this third syllable, there is 50% of probability of a fourth syllable. After the fourth, 40% of probability of a sixth syllable to occur in the name and so on.
  • Each syllable starting with a "s" ha 50% of probability of having the "s" doubled to "ss".
  • The names must be capitalized
  • The last syllable of the name doesn't have a vowel

Here are some example valid names:

  • Pigof
  • Nanas
  • Tidad
  • Nateg
  • Gessopithumob
  • Satadet
  • Nos
  • Muzofen
  • Fenufap
  • Vum
  • Fuzop
  • Ssithitep
  • Viss
  • Munass
  • Nudov
  • Neg
  • Puzis
  • Nez
  • Gudip
  • Simug

When posting your solution, provide an example of 10 lizardy names generated by your Name'omatic. Have fun!

42 Comments
2015/12/14
10:31 UTC

Back To Top