core

package
v0.0.0-...-e23204a Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2019 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

View Source
const (
	Left int = iota - 1
	Center
	Right // also used for down
)

movement directions

View Source
const BoardCols = 10
View Source
const BoardRows = 17
View Source
const ShapePieces = 4

Variables

This section is empty.

Functions

func StartGame

func StartGame(mode string)

StartGame setups the scene and stars the game

Types

type Board

type Board [BoardRows][BoardCols]Color

type Color

type Color = int // represents the color of the piece
const (
	Empty Color = iota
	Blue
	Purple
	Green
	Red
	Orange
	Yellow
	SkyBlue
)

type Piece

type Piece = int
const (
	IShape Piece = iota + 1
	JShape
	LShape
	OShape
	SShape
	TShape
	ZShape
	ShapesCount
)

type Player

type Player struct {
	Name     string
	Score    int
	GameOver bool
}

Player describes the player nickname, score if its

var Player1 Player
var Player2 Player

type Point

type Point struct {
	X, Y int
}

type Shape

type Shape struct {
	// contains filtered or unexported fields
}

Shape is a type containing four points, which represents the four points making a contiguous 'piece'.

var ActiveShape Shape
var Buffer Shape
var HoldedShape Shape
var NextShape Shape

Jump to

Keyboard shortcuts

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