Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
A = input
B = input
C = 15 - A - B
E = 5
G = 15 - C - E = 10 - C
I = 15 - A - E = 10 - A
D = 15 - A - G
F = 15 - C - I
H = 10 - B
and got 22 / 146 / 50 .
I used two ROMs to store the eight possible magic squares and read them aloud on the go. :)
There is only one 3x3 magic square (and all other magic squares are rotations or reflections). We know first 2 squares (input) and center square (5, never moves).
Knowing that the "magic sum" is always 15 lets us populate a few more numbers. Repeat until we've populated the whole square. This just takes some simple algebra.
After generating a square like this, loop through all digits 1-9, and make sure each digit is present exactly once in the square. This'll tell us that it's the actual magic square. We already know the sums will match, we just need to eliminate square with duplicates or digits outside of [1,9].
Then, just output the square if it's valid, error if not.
Getting all this to fit on the board was not easy. I had to get pretty creative with trace routing!
https://i.imgur.com/YHXSvlp.jpg
https://i.imgur.com/QTB0CuS.jpg
27/1227/65