Individual work incorporated via pull requests. See PRs and open branches for details on each team member's work.
The snake was ultimately deployed from the branch nate-new
to http://this-snake.herokuapp.com/.
To compile docs,
npm run docs
Add documentation in the JSdoc format, found here
If you wish to edit the README, please do so on the README_snakespeare.md file. It is used to autogenerate the README.md, so anything you add to README.md will be overwritten each time npm run docs
is run.
The documentation.yml file is for configuring the documentation generator.
Use branches for feature development or personal experimentation: git checkout -b some-new-branch-name
Merge to master via Github pull requests.
To run tests,
npm test
Current Heroku deployment: http://this-snake.herokuapp.com/
Can be updated or replaced as development progresses.
A simple BattleSnake AI written in Javascript for NodeJS. Founded on the Sendwithus starter snake
See https://github.com/sendwithus/battlesnake-node for full details or to start a new snake from a blank slate.
To get started you'll need a working NodeJS development environment, and at least read the Heroku docs on deploying a NodeJS app.
If you haven't setup a NodeJS development environment before, read how to get started with NodeJS. You'll also need npm for easy JS dependency management.
This client uses Express4 for easy route management, read up on the docs to learn more about reading incoming JSON params, writing responses, etc.
Clone this repo via HTTPS or SSH.
Install the client dependencies:
npm install
Create an .env
file in the root of the project and add your environment variables (optional).
Run the server:
nf start web
Test the client in your browser: http://localhost:5000
Weighting scheme will assign 1 to edges going out to vertices which are unoccupied
Parameters
Returns number weight
Creates a graph of the board. See API of Graph.js
Parameters
grid
Array<Array> the grid of snakesrule
function? This is how we assign weights to edges between the cells of the board.
default sets all edges to open vertices value 0) w/ edge weight 1, 0 otherwise (optional, default simple
)Returns Graph
Should return an guestimation the probability of next cell being occupied on the nth turn:
Parameters
grid
snake
Parameters
Will return a copy of the snake who has moved in the direction specified. The direction will be taken whether or not its walkable, it is the responsibility of the board keep track of snake, and tell it on next turn whether or not it has died.
Parameters
direction
string either of "up, "down", "left", "right"Returns Snake a clone having taken the move.
Looks for set of cells that are or distance n from the head Disregards all other snakes on board. Might return negative indices.
Parameters
head
distance
height
width
Looks for set of cells that are or distance n from the head Disregards all other snakes on board. Doesn't return negative indices.
Parameters
Search First search all of moves keeping other snakes fixed. Can go deeper Then choose closest head, and if it is within the search depth*2, and search all combinations of all snakes heads mark all paths that give death as negative score
Takes a look at where other snake's heads might be in the short term.
Parameters
Board
Board turns
integer how many turns to look at into the future.
Keep in mind that we shouldn't look too far, because this is O(3^n). Eek!board
Find all snakes that you could have a head-on collision with within distance turns Note: this assumes all other snakes are static when calculating number of turns until collision between two snake heads.
Parameters
board
distance
Returns Array<Object> an array of objects w/ {snake: Snake, path: Array
Check if next move could result in checkmate.
Find shortest path by dijkstra's algorithm given changing graph values
Parameters
Finds shortests path, faster normally the dijkstra's algorithm
Parameters
Returns an object with values indices[l,m] of neighbours that aren't other snakes
Parameters
Keeps track of when another snake eats, and if planning on going into last element of tail, abort!
Parameters
board
Board Calculates taxi-car distance between two points
Parameters
startVertex
endVertex