## Stardust Blog

Archive

Mailing List Articles Atom Feed Comments Atom Feed Twitter

## Tag Cloud

3d account algorithms announcement archives arduino artificial intelligence assembly async audio bash batch blog bookmarklet booting c sharp c++ challenge chrome os code codepen coding conundrums coding conundrums evolved command line compiling css dailyprogrammer debugging demystification distributed computing downtime embedded systems encryption es6 features event experiment external first impressions future game github github gist graphics hardware hardware meetup holiday html html5 html5 canvas interfaces internet io.js jabber javascript js bin labs learning library linux low level lua maintenance network networking node.js operating systems performance photos php pixelbot portable privacy programming problems project projects prolog protocol protocols pseudo 3d python reddit reference release releases resource review rust secrets security series list server software sorting source code control statistics svg technical terminal textures three thing game three.js tool tutorial tutorials twitter ubuntu university update updates upgrade version control visual web website windows windows 10 xmpp

## Coding Conundrums Evolved 5: Space Transmissions

(Banner from here with the seed 64oekm9bi4cg.)

This post is part of a biweekly series of programming problems, targeted at those learning to program using C# at University. The problems will vary in difficulty - some will be rather easy, and some will be quite challenging! Don't worry if you can't solve a problem just yet - come back to it in a few months and it'll seem a lot easier than it did before.

Coding Conundrums Evolved is back for another episode! I can't promise that these will be a regular feature on here due to the amount of time they take to put together, but I had a good idea for another one that I really couldn't turn down :D

The 2 new elligon-class starships, called the Lilai and the Inveinya, are on a joint mission deep in the newly-discovered Tenobulet Nebula. Due to the thickness of the gas clouds surrounding the 2 ships, they are having difficulty communicating, as talking over a video-link is causing the quantum neural-network based interference analysis system is draining all their available power clearing up the incoming data streams.

To combat this, the genius communications officer Mr. Ümafa has devised the Dassma System. The system allows the 2 ships to communicate by sending text-based messages, reducing power usage by sending a quantum coaxial error correction stream in parallel to the actual message stream.

Anyway, Mr. Ümafa needs your help as the newly-hired systems programming engineer, since all the other programmers onboard are busy scratching their heads over a new asymmetric inverse shift register algorithm whilst writing a firmware upgrade for the quadrilateral energy transmission stabilisers to increase their efficiency.

Unfortunately, his dassma system can only transmit messages in short chunks of 128 characters, and he's finding it terribly cumbersome to keep splitting up the long messages that the crew keep asking him to send.

Given a long string as input, write a program that splits the input into multiple chunks that are at most 128 characters long, and outputs each chunk on a separate line.

### Helpful Hints

• Perform every step of the process on paper first.
• Draw a flowchart of what your program needs to do.
• If you're having trouble, step through your code line by line and inspect it's state at each point.

### Challenge

Mr. Ümafa is impressed with your program, but he's got an additional request or two. Unfortunately, Communications Officer Bramaar of the Iveinya keeps mixing up the different message parts, and he finds it annoying when it splits a message in the middle of a word.

Mr. Ümafa would like you to upgrade your program so that it only splits on spaces, and so that it labels each of the chunks with their number in the sequence.

The solution archive is here. I'll release the password to this challenge in the comments in 2 weeks time.

## Coding Conundrums Evolved Series List

Since a while ago I didn't have the time to write the next episode of Coding Conundrums Evolved and then I kind of forgot about it (sorry! I really haven't had much time since September this year, and they take ages to write... :-(), I've decided post a series list for the 4 episodes I've posted so far.

Before I forget though, the (long overdue!) password for last episode's solution (#4) is illykin. Remember to attempt the challenge yourself first before looking at my solution! Working out how you'd attempt a problem is just as important as actually writing the solution itself.

With the last password revealed, here's the series list:

While I'm certainly not averse to releasing a new entry in this series, it'll probably have to wait until the end of this year - unless I think of a really good idea that can't wait. Suggestions and ideas are welcome though :-)

## Coding Conundrums Evolved 4: Prime Wall Hangings

This post is part of a biweekly series of programming problems, targeted at those learning to program using C# at University. The problems will vary in difficulty - some will be rather easy, and some will be quite challenging! Don't worry if you can't solve a problem just yet - come back to it in a few months and it'll seem a lot easier than it did before.

Welcome to episode 4 of coding conundrums evolved. If you missed the last one, it is all about fiddly fuel and is located here. The password to the archive that contains my solution for it is iveinya, but try solving it on your own first if you haven't already :-). This episode holds a bit of a different challenge for you.

The famous Professor Arkin, discoverer of illykin theory (the technology behind the quadrilateral engine first installed in the Lilai), has recently been recognised and awarded the prestigious Byema Or award. Along with this award comes a place for a statue in the hall of fame at Timiku University on the planet Eiriodin, the most distinguished and renowned University in the galaxy!

Since it's generally considered to be rather important to have an impressive statue (as you'd naturally expect!), Professor Arkin hired only the most skilled craftsmen to create his statue. After having the magnificent statue made and put in the hall, he thinks that there is still something missing.

Professor Arkin, upon hearing about your impressive skills from Chief Engineer Nebrilla, has asked you to write a program that generates a wall hanging to go behind his statue. In his specification for the wall hanging, he wrote this:

The exact nature of the wall hanging is up to you, but I am interested in something particularly impressive looking. The more impressive it looks, the more credits I will pay you for your trouble!

One of the key secrets to my illykin theory is actually prime numbers, so your design should feature them prominently.

(Author's Note: No actual funds will be paid upon completion of this challenge! Post about your creations in the comments and have a virtual cookie instead :D)

Write a program that generates a suitable wall hanging for Professor Arkin. Make sure that you feature prime numbers in your design!

### Helpful Hints

• Plan your design on paper first so that you have something to work towards.
• There isn't any set solution for this problem (though I will certainly be providing mine in the next episode!).
• GDI+ is the native drawing library for C#. Make sure you include a reference to System.Drawing.dll if you decide to use it!
• I've written a simple image generator template here: ImageGenerator.cs. If you have trouble getting started, feel free to use it as a starting point!

Here's what I managed to put together. I'm sure you can do better than I :-)

There isn't a challenge for this conundrum this time - though if you want one you could always try and animate your wall hanging (Professor Arkin is considering digital projector-based installations too). As usual the archive for my solution is here, and the password will be released in the next post.

## Coding Conundrums Evolved 3: Fiddly Fuel

This post is part of a biweekly series of programming problems, targeted at those learning to program using C# at University. The problems will vary in difficulty - some will be rather easy, and some will be quite challenging! Don't worry if you can't solve a problem just yet - come back to it in a few months and it'll seem a lot easier than it did before.

(Above: Some 15 RS-25 rocket engines at NASA. Source: NASA Image and Video Library)

Get ready for 3rd episode of Coding Conundrums Evolved! This time, you've been asked to write some software for a brand new ftl engine.

First though, the password to the last solution is zirros.

It's the year 2252, and the engineers at the Hazuva spacecraft dry dock orbiting the ocean world Eiriodin are busily working away on putting the finishing touches to a brand new elligon class starship. Capable of FTL travel like no other craft before it, the new ship (dubbed the Lilai by the engineers) will be able to take its crew on an unforgettable journey across the stars.

There's a problem though. The Lilai has a brand new engine that was designed from scratch with a quadrilateral fuel regulation valve. As a result, the standard linear fuel balancing agent on the engine's control computer needs to be completely rewritten! Upon hearing the news, Chief Engineer Nebrilla has hired you to do the job.

The engine in question handles fuel through a grid of reactor cells. Oddly enough, the fuel in the reactor cells must be arranged in ratios such that they form a 5x5 magic square.

17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9

(Above: An example magic square.)

Write a program that outputs a 5x5 magic square.

### Helpful Hints

• The Siamese method can be used to programatically generate a magic square.
• Read the description of the algorithm carefully and make sure you understand it before writing any code.
• Follow the algorithm through on paper first.
• You may want to take a look at using a 2D array to store information about your magic square.
• I've written a magic square validator so that you can test your implementation.
• Use it like this on Windows: type MagicSquare.txt | ./MagicSquareValidator.exe [Order] [MagicNumber]
• ...or this on Linux: cat MagicSquare.txt | mono ./MagicSquareValidator.exe [Order] [MagicNumber]

### Challenge

The new engine design tested in the Lilai was so successful that a second ship, the Iveinya, is going to be retrofitted with a modified version of the engine. This new modified engine takes a 3x3 fuel matrix, which, surprisingly enough, also has to take fuel in ratios that form a magic square.

Since you wrote the control program for the original engine, you've been drafted in to update your program to work with the new engine.

Adjust your program so that it supports generating magic squares of any size.

My solution to this puzzle is here - the password to the archive will be released in the next post.

Find the last post here: Binary Biomass

## Coding Conundrums Evolved 1: Alien Encounter

(Banner generated with LC_ALL=C tr -c "[:lower:]" " " < /dev/urandom | dd cbs=\$COLUMNS conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]", adapted from here)

This post is part of a new biweekly series of programming problems, targeted at those learning to program using C# at University. The problems will vary in difficulty - some will be rather easy, and some will be quite challenging! Don't worry if you can't solve a problem just yet - come back to it in a few months and it'll seem a lot easier than it did before.

The year is 2258. Humans have established themselves as spacefarers and have made contact with several alien species. You are a member of the esteemed Captain Obanji's crew aboard the spaceship iveinya, on a mission to explore the galaxy! While out exploring, you and your crew discover a new species of intelligent life! You decide to call them the Outer Clockwise Eyamporreans (simply because it sounds cool).

Chief of Communications Officer Bramaar has been analysing the Eyamporreans' language. He has discovered that it is based on the english alphabet (abcdefghijklmnopqrstuvwxyz) managed to work out that he can use a simple substitution cipher to translate the Eyamporreans' language into English. He has also worked out what each letter in their language corresponds to in english:

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

(abcdefghijklmnopqrstuvwxyz / iucravjwmdqonbfplyetskzgxh)

Unfortunately, he has been having a spot of bother whilst writing an automatic translator for the language. This is where you come in. Given a single line of Eyamporrean through the standard input, translate it into English and output the result. See if you can translate the following alien communications back into english:

jyaatmbje, etyibja cyaitsyae!

za zfsor omqa tf zaocfna xfs tf fsy poibat.

rf xfs wika ibx yfcqat vsao? fsy epicacyvt me ysbbmbj fst.

### Helpful Hints

• The input will only contain the lowercase letters of the alphabet, spaces, and possibly punctuation such as ! and ?.
• You should pass any characters such as whitespace and punctuation that your program doesn't understand straight through your translator.
• It never hurts to do a quick .ToLower() call on all the input your program receives, just in case.

### Challenge

Officer Bramaar and Captain Obanji are impressed with your work. Using your translator, they have been able to understand the Eyamporreans' messages and ascertain their intentions. Now, they would like to send a message back.

Alter your program so that you can not only translate Eyamporrean messages into english, but also translate English into Eyamporrean.

See if you can translate these messages into Eyamporrean:

hello eyamporreans! we come in peace.

we represent the planet earth.

do you require assistance?

The solution to this puzzle can be found here. The password to the archive will be released along with next week's challenge.

Update: The next post has been released! Find it here: Binary Biomass

Art by Mythdael