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 3d printing account algorithms android announcement architecture archives arduino artificial intelligence artix assembly async audio automation backups bash batch blender blog bookmarklet booting bug hunting c sharp c++ challenge chrome os cluster code codepen coding conundrums coding conundrums evolved command line compilers compiling compression containerisation css dailyprogrammer data analysis debugging demystification distributed computing dns docker documentation downtime electronics email embedded systems encryption es6 features ethics event experiment external first impressions freeside future game github github gist gitlab graphics hardware hardware meetup holiday holidays html html5 html5 canvas infrastructure interfaces internet interoperability io.js jabber jam javascript js bin labs learning library linux lora low level lua maintenance manjaro minetest network networking nibriboard node.js open source operating systems optimisation own your code pepperminty wiki performance phd photos php pixelbot portable privacy problem solving programming problems project projects prolog protocol protocols pseudo 3d python reddit redis reference releases rendering resource review rust searching secrets security series list server software sorting source code control statistics storage svg systemquery talks technical terminal textures thoughts three thing game three.js tool tutorial tutorials twitter ubuntu university update updates upgrade version control virtual reality virtualisation visual web website windows windows 10 worldeditadditions xmpp xslt


Art by Mythdael