Rate my assignment and give feedback, please

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 1026 Views - Last Post: 18 November 2019 - 05:52 PM Rate Topic: -----

#16 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7143
  • View blog
  • Posts: 24,251
  • Joined: 05-May 12

Re: Rate my assignment and give feedback, please

Posted 18 November 2019 - 01:01 PM

Do you like my magic square that passes your tests:
7 7 7
7 7 7
7 7 7


Was This Post Helpful? 0
  • +
  • -

#17 PendeJoe   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 09-October 19

Re: Rate my assignment and give feedback, please

Posted 18 November 2019 - 02:56 PM

hmm.. how would you recommend me to validate it though?
I've already turned in my assignment because of the due date but I would like to learn how to think the right way
Was This Post Helpful? 0
  • +
  • -

#18 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7143
  • View blog
  • Posts: 24,251
  • Joined: 05-May 12

Re: Rate my assignment and give feedback, please

Posted 18 November 2019 - 05:52 PM

As I stated in post #14:

View PostSkydiver, on 17 November 2019 - 09:10 PM, said:

Furthermore, in a traditional magic square, a value should only appear once.

One approach could be to created an array of booleans to correspond to the numbers 1 through ROWS*COLS. Set everything to false. As you find each element in the array, check if the entry for that number is false. If it is false, mark it as having been seen by setting it to true. If it is true, then that means you've seen the number before and you shouldn't consider this a true magic square. After going through all the elements, also make sure that there are no gaps in the numbers you've seen.
Was This Post Helpful? 1
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2