Git Product home page Git Product logo

nagini's Introduction

Nagini

Nagini is a snake who battles at: http://battlesnake.io

Getting Started

To start your Phoenix server:

  • Install dependencies with mix deps.get
  • Set up the event store with mix do event_store.create, event_store.init
  • Start Phoenix endpoint with mix phx.server

Now you can use localhost:4000 as a Battlesnake endpoint.

The logger is configured to log at the debug level (very verbose) and logs are stored in /tmp/nagini.log. This is a workaround for Nanobox stdout log streaming being broken.

To start your Ember admin frontend:

  • Change to the frontend directory with cd admin
  • Install dependencies with npm install
  • Start Ember with ./node_modules/.bin/ember serve

Now you can view localhost:4200/admin/

Configuration

To customize your snake, set these environment variables:

  • SNAKE_COLOR
  • SNAKE_HEAD
  • SNAKE_TAIL

To tune the solver, set these environment variables:

  • SOLVER_TIMEOUT=infinity
  • SOLVER_DEPTH=0

Development with Nanobox

  • Install Docker
  • Install Nanobox CLI and log in
  • nanobox dns add local nagini.local
  • nanobox run
  • Install dependencies and run start commands as normal

Note that Nanobox's Elixir engine may run a different version of Elixir than this project's .tool-versions lock file expects. This may not behave as intended.

Deployment with Nanobox

Test with a dry-run first:

  • nanobox evar add dry-run PORT=8080 MIX_ENV=prod EMBER_ENV=production
  • nanobox evar add dry-run ADMIN_USER=fixme ADMIN_PASS=fixme
  • nanobox evar add dry-run APPSIGNAL_APP_NAME="Nagini" APPSIGNAL_APP_ENV="dry-run" APPSIGNAL_PUSH_API_KEY="FIXME"
  • nanobox deploy dry-run
  • Test the dry-run deployed endpoint

Update the release version:

  • Edit mix.exs

Deploy:

  • nanobox remote add app-name
  • nanobox evar add app-name PORT=8080 MIX_ENV=prod EMBER_ENV=production
  • nanobox evar add app-name ADMIN_USER=fixme ADMIN_PASS=fixme
  • nanobox evar add app-name APPSIGNAL_APP_NAME="Nagini" APPSIGNAL_APP_ENV="prod" APPSIGNAL_PUSH_API_KEY="FIXME"
  • nanobox deploy

Monitoring

Monitoring is set up to work with AppSignal if the environment is configured.

To read the Nanobox server logs:

  • nanobox console app-name web.main
  • tail -f /tmp/nagini.log

IEx Console for Nanobox Remote

  • nanobox console app-name web.main
  • iex -S mix phx.server --no-start

The --no-start option prevents the normal applications from being started because that would throw errors such as the port being in use.

PSQL Usage for Nanobox Local

  • Find IP and password with nanobox info local
  • PGPASSWORD="" psql -h IP -p 5432 -U nanobox gonano

PSQL Usage for Nanobox Remote

  • Start the tunnel with nanobox tunnel data.event_store -p 5432
  • Find the password from Nanobox dashboard
  • psql -p 5432 -h 127.0.0.1 gonano nanobox
  • Enter the password`

License

Copyright 2019 Justin Workman. All Rights Reserved.

nagini's People

Contributors

xtagon avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

dachenscratch

nagini's Issues

Idea - Heatmap visualizer in admin panel

Basic prep work has begun on this. The idea is to show cells as collision probabilities with a heat-map, to help visualize how far ahead the AI is able to predict a collision given a scenario loaded from real game data.

Add "timeout riding" async technique

Elixir provides ample tools for asynchronous behavior. One idea is to use this so that a specific depth does not have to be set in the solver, instead, it should iterate as far as it can until a threshold just under the Battlesnake timeout, and return the best solution just before the timeout is reached.

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.