models

package module
v0.0.0-...-588e3e1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 13 Imported by: 2

README

neuralknight backend models

Build Status Coverage Status

Rebuild of https://github.com/dsnowb/neuralknight in go.

Authors: David Snowberger, Shannon Tully, Asa Katida

Version: 2.0.0

Getting Started

Requirements
  • Python 3.5 or greater
  • pip package manager
Installation

Installation is as simple as installing from pip: pip install neuralknight

Running the app

To launch neuralknight, type the following into a shell: neuralknight https://neuralknight.herokuapp.com

Should you wish to run a purely local instance:

  • Download the source from here

  • Create a postgres database named neuralknight

From inside the source directory:

  • Initialize the database with initialize_neuralknight_db

  • Launch the local server with pserve production.ini

  • In another shell, run the client with neuralknight

Architecture

This app is written using Python 3.6, Pyramid, and Postgres, with Heroku as a deployment platform

API

See our API docs here

Change Log

  • 05 April 2018 - Repo Created
  • 19 April 2018 - 1.0.0 release

Documentation

Index

Constants

View Source
const (
	BISHOP uint8 = 2
	KING   uint8 = 4
	KNIGHT uint8 = 6
	PAWN   uint8 = 8
	QUEEN  uint8 = 10
	ROOK   uint8 = 12
)

BISHOP piece.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	PlayRound(decoder *json.Decoder) BoardStateMessage
	GetState(decoder *json.Decoder) BoardStateMessage
}

Agent agent.

func GetAgent

func GetAgent(ID uuid.UUID) Agent

GetAgent agent.

type AgentCreateMessage

type AgentCreateMessage struct {
	User      bool
	GameURL   url.URL
	Lookahead int
	Delegate  string
}

AgentCreateMessage model.

type AgentCreatedMessage

type AgentCreatedMessage struct {
	ID uuid.UUID
}

AgentCreatedMessage model.

func MakeAgent

func MakeAgent(decoder *json.Decoder) AgentCreatedMessage

MakeAgent agent.

type Board

type Board interface {
	AddPlayer(decoder *json.Decoder) BoardStateMessage
	GetInfo(decoder *json.Decoder) BoardStateMessage
	GetState(values url.Values) BoardStateMessage
	GetStates(decoder *json.Decoder) BoardStateMessage
	PlayRound(decoder *json.Decoder) BoardStateMessage
}

Board board.

func GetGame

func GetGame(ID uuid.UUID) Board

GetGame game.

type BoardCreatedMessage

type BoardCreatedMessage struct {
	ID uuid.UUID
}

BoardCreatedMessage board.

func MakeGame

func MakeGame(decoder *json.Decoder) BoardCreatedMessage

MakeGame agent.

type BoardInfoMessage

type BoardInfoMessage struct {
	Print string
}

BoardInfoMessage board.

type BoardStateMessage

type BoardStateMessage struct {
	End, Invalid bool
	State        board
}

BoardStateMessage models.

type BoardStatesMessage

type BoardStatesMessage struct{ Games []uuid.UUID }

BoardStatesMessage models.

func GetGames

func GetGames(decoder *json.Decoder) BoardStatesMessage

GetGames game.

type GameJoinMessage

type GameJoinMessage struct {
	AgentURL url.URL
	ID       uuid.UUID
}

GameJoinMessage board

type InvalidMove

type InvalidMove struct{}

InvalidMove error.

func (InvalidMove) Error

func (err InvalidMove) Error() string

type Piece

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

Piece with position.

type PlayMessage

type PlayMessage struct {
	State board
}

PlayMessage agent

type UserMoveMessage

type UserMoveMessage struct {
	Move [2][2]int
}

UserMoveMessage Human Agent

Jump to

Keyboard shortcuts

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