Giter Site home page Giter Site logo

paintbot-client-go's Introduction

Paintbot client in Go

This is a Paintbot Client written in Go 1.14.

For more information about what Paintbot is, see: https://paintbot.cygni.se/

For running your own server see Paintbot Server Repository

Requirements

  • Go 1.16
  • Paintbot Server (local or remote, there's one running by Cygni so no worries ;) )

Usage

  • Clone this repository
  • Execute: run the client
> cd <repo>/cmd/examplebot
> go run main.go

Implementation

You only need to implement when function in order to have your own bot up and running. see ExampleBot

func calculateMove(updateEvent models.MapUpdateEvent) models.Action {
	utility := maputility.MapUtility{Map: updateEvent.Map, CurrentPlayerID: *updateEvent.ReceivingPlayerID}
	me := utility.GetMyCharacterInfo()
	move := models.Stay
    // ...
    // super smart logic
    // ...
	return move
}

calculateMove will be called every time a map update is received from the server. You are expected to reply with a CharacterAction (UP, DOWN, LEFT, RIGHT, STAY or EXPLODE). And don't forget to respond within the time limit. default is 250 ms including networking.

Help

There's a utility class with nifty methods to help you out. Take a look at Map utility

Pitfalls

Beware the common mishaps:

  • If two bots try to move to the same empty space, they will collide and stun each other. Once the stun ends, they risk doing the same thing again. And again, and again. Don't be the bot who runs into another bot the whole game!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.