Skip to content

Commit

Permalink
Remove rm
Browse files Browse the repository at this point in the history
  • Loading branch information
bethanyj28 committed Oct 3, 2021
1 parent 7703ef0 commit 85206f4
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ jobs:
key: ${{ secrets.OMEGA_SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
- name: Deploy with docker
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} -p ${{ secrets.SSH_PORT }} "docker stop bethanyj28_battlesnek; docker pull ghcr.io/bethanyj28/battlesnek:latest; docker run --name bethanyj28_battlesnek --restart unless-stopped --rm -d --network=proxy ghcr.io/bethanyj28/battlesnek:latest"
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} -p ${{ secrets.SSH_PORT }} "docker stop bethanyj28_battlesnek; docker pull ghcr.io/bethanyj28/battlesnek:latest; docker run --name bethanyj28_battlesnek --restart unless-stopped -d --network=proxy ghcr.io/bethanyj28/battlesnek:latest"
42 changes: 42 additions & 0 deletions internal/battle/clairvoyant/clairvoyant.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package clairvoyant

import "github.com/bethanyj28/battlesnek/internal"

// Snake is a clairvoyant implementation of snake
type Snake struct {
lookahead int
}

// NewClairvoyantSnake creates a new clairvoyant snake
func NewClairvoyantSnake(lookahead int) Snake {
if lookahead == 0 {
lookahead = 1
}
return Snake{lookahead: lookahead}
}

// Move decides which move is ideal based on seeing the future
func (s *Snake) Move(state internal.GameState) (internal.Action, error) {
moves := drillDown(state, s.lookahead)

return internal.Action{Move: moves.move}, nil
}

// Info ensures the snake is stylin and profilin
func (s *Snake) Info() internal.Style {
return internal.Style{
Color: "#00cc99",
Head: "beluga",
Tail: "freckled",
}
}

type route struct {
move string
food int
hazard int
}

func drillDown(state internal.GameState, lookahead int) route {
return route{}
}
2 changes: 0 additions & 2 deletions internal/battle/util/util.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package util

import (
"fmt"
"math"

"github.com/bethanyj28/battlesnek/internal"
Expand Down Expand Up @@ -158,7 +157,6 @@ func IntrovertSnake(self internal.Battlesnake, others []internal.Battlesnake, li
avgDist = dist / len(evalSnakes)
}

fmt.Println(avgDist)
if avgDist > limit {
dirs = append(dirs, dir)
}
Expand Down

0 comments on commit 85206f4

Please sign in to comment.