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.

Rocket engines at NASA. (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 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

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 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 pseudo 3d python reddit reference release releases resource review rust secrets security series list server servers software sorting source code control svg technical terminal textures three thing game three.js tool tutorial twitter ubuntu university update upgrade version control visual web website windows windows 10 xmpp


Art by Mythdael