Skip to content

VKoptev/hex

Repository files navigation

hex

GoDoc

Realization of hexagonal grids

This library is representation of hexagonal grids that describe in article from Red Blob Games

How to use

package main

import (
	"fmt"
	
	"github.com/VKoptev/hex"
)

func main() {
	h := hex.New(1, 2)

	fmt.Printf("equal: %v", h.Equal(hex.ZE))
	fmt.Printf("to east: %v", h.Add(hex.EE))
	fmt.Printf("to west: %v", h.Sub(hex.EE))
	fmt.Printf("no way: %v", hex.ZE.Mul(10))
	// ...
}