Zhao-hangtian / magic-square

magic square

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

magic-square 幻方

v0.1 实现普通幻方完美幻方的检查,幻方的定义参考:

主要参考百度百科西塘沿河博客

A magic square is a n × n grid of numbers such that the sum of each row is equal, and equal to the sum of each column.
  4 9 2
  3 5 7
  8 1 6
Some definitions also require the sum along the main diagonals to add to the same total.

普通幻方定义为行、列、主、副对角线各数之和均相等。

完美幻方(完全幻方)定义为行、列、主、副对角线及泛对角线各数之和均相等。

Demo

img1 img2 img3 img4 img5

其他参考

Wiki

Jenny Kenkel 课件

知乎

About

magic square

License:Apache License 2.0


Languages

Language:Python 100.0%