Window Controller

Ace your studies with our custom writing services! We've got your back for top grades and timely submissions, so you can say goodbye to the stress. Trust us to get you there!


Order a Similar Paper Order a Different Paper

  

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 fit the other code:

package javatest;

Writerbay.net

Looking for top-notch essay writing services? We've got you covered! Connect with our writing experts today. Placing your order is easy, taking less than 5 minutes. Click below to get started.


Order a Similar Paper Order a Different Paper