https://github.com/calebwin/magic-square
A magic square data structure for the Python programming language
https://github.com/calebwin/magic-square
Last synced: about 1 year ago
JSON representation
A magic square data structure for the Python programming language
- Host: GitHub
- URL: https://github.com/calebwin/magic-square
- Owner: calebwin
- License: mit
- Created: 2018-09-18T23:28:01.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-19T03:25:15.000Z (almost 8 years ago)
- Last Synced: 2025-03-23T18:50:54.404Z (over 1 year ago)
- Language: Python
- Size: 6.84 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## What it is
A magic square data structure for the Python programming language.
## How to use it
```python
my_magic_square = magic_square.MagicSquare(3, 15) # initialize a new 3X3 magic square with magic constant of 15
my_magic_square.set(0, 0, 5) # set the cell at position (0, 0) to 5
my_magic_square.is_valid() # False
my_magic_square.rotate(-27) # rotates magic square clockwise 27 times
print(my_magic_square)
print(my_magic_square.center_of_mass())
print(my_magic_square.moment_of_inertia())
```