magicsquare

package module
v0.0.0-...-a4290cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2013 License: GPL-3.0 Imports: 1 Imported by: 0

README

magicsquare

Package magicsquare is a Go library and command line utility, to generate magic squares.

Status

Build Status Build Status Coverage Status

Usage

A working Go installation is required to build magicsquare.

# We use the path 'magicsquare/magicsquare' to install the command line utility.
$ go get github.com/jmcvetta/magicsquare/magicsquare

$ magicsquare 7
   20   12    4   45   37   29   28
   11    3   44   36   35   27   19
    2   43   42   34   26   18   10
   49   41   33   25   17    9    1
   40   32   24   16    8    7   48
   31   23   15   14    6   47   39
   22   21   13    5   46   38   30

Documentation

See GoDoc for automatically generated API documentation.

License

This is Free Software, released under the terms of the GPL v3.

Documentation

Overview

Package magicsquare generates magic squares of odd size.

Index

Constants

This section is empty.

Variables

View Source
var EvenSizeError = errors.New("Size must be an odd number")

An EvenSizeError is returned when MagicSquare is called with an even number for the size of the square.

Functions

This section is empty.

Types

type Square

type Square [][]int

A Square is a regular quadrilateral.

func MagicSquare

func MagicSquare(size int) (Square, error)

MagicSquare generates a magic square of a given size, which must be an odd number.

Directories

Path Synopsis
A command line tool to generate magic squares of odd size.
A command line tool to generate magic squares of odd size.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL