Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Magic Squares - Alternative Rules for Building • 2D arrays and initializing a 'magic square' • uses WindowController only to  

Magic Squares - Alternative Rules for Building • 2D arrays and initializing a 'magic square' • uses WindowController only to  

Computer Science

Magic Squares - Alternative Rules for Building

• 2D arrays and initializing a 'magic square'

• uses WindowController only to  

... step through magic squares of various size on terminal

In your textbook is a section which discusses how to build a 'magic square' worth of integers.

Here's a link to a summary of both this method and the Dale 'Variant Rules'.

You will use the 'Variant Rules' so... read instructions in download code and

do not get over-invested in trying to remember and recreate code from the

book! The code above is the starting code

Here is the Eventful's Rules

One method for constructing magic squares of odd order involves placing the next number of the magic square 

diagonally down and to the right of the previous number, with the following caveats:

1. Begin by placing the number 1 in the middle of the bottom row.

2. Always assign the next number down and to the right from the current number.

3. UNLESS YOU CAN'T IN WHICH CASE:

a. One row "down" from the bottom row lands you in the top row.

b. One column "right" from the rightmost column lands you in the leftmost column.

c. If the desired cell is already occupied, then instead place the next 

number above the previous one.

But we need to do it in the Variant Rules

Switches up & down, bottom & top, above & below:

One method for constructing magic squares of odd order involves placing the next number of the magic square diagonally up and to the left of the previous number, with the following caveats:

1. Begin by placing the number 1 in the middle of the top row.

2. Always assign the next number up and to the left from the current number.

3. UNLESS YOU CAN'T IN WHICH CASE:

a. One row "up" from the top row lands you in the bottom row.

b. One column "left" from the leftmost column lands you in the rightmost column.

c. If the desired cell is already occupied, then instead place the next 

number below the previous one.

The expert’s code that needs to actually ?t the other code:

package javatest;

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions