tweaks
This commit is contained in:
parent
eac373c444
commit
e31c585e3a
|
@ -40,6 +40,8 @@ func doCommand(cmd command, s State, teamID int) State {
|
|||
pos := b.Position
|
||||
pos.Pos++
|
||||
s = removeObstacle(s, pos)
|
||||
b.v = 0
|
||||
s = updateBot(s, *b)
|
||||
}
|
||||
|
||||
if b := ActiveBot(s.Teams[teamID]); b != nil {
|
||||
|
|
|
@ -33,7 +33,7 @@ func maybePassBaton(s State, teamID int) State {
|
|||
if h.ID >= b.ID || h.Position.Lane != b.Position.Lane {
|
||||
continue
|
||||
}
|
||||
if abs(b.Position.Pos-h.Position.Pos) <= passDistance {
|
||||
if abs(b.Position.Pos-h.Position.Pos) <= PassDistance {
|
||||
h.v = 0
|
||||
h.a = 0
|
||||
s = updateBot(s, *h)
|
||||
|
@ -259,6 +259,6 @@ var (
|
|||
const (
|
||||
Steps = 40
|
||||
numBots = 4
|
||||
NumTeams = 4
|
||||
NumTeams = 2
|
||||
NumLanes = NumTeams
|
||||
)
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package game
|
||||
|
||||
func accelerate(b Bot) Bot {
|
||||
if b.a < -maxA {
|
||||
b.a = -maxA
|
||||
if b.a < -MaxA {
|
||||
b.a = -MaxA
|
||||
}
|
||||
if b.a > maxA {
|
||||
b.a = maxA
|
||||
if b.a > MaxA {
|
||||
b.a = MaxA
|
||||
}
|
||||
|
||||
b.v += b.a
|
||||
if b.v > maxV {
|
||||
b.v = maxV
|
||||
if b.v > MaxV {
|
||||
b.v = MaxV
|
||||
}
|
||||
if b.v < -maxV {
|
||||
b.v = -maxV
|
||||
if b.v < -MaxV {
|
||||
b.v = -MaxV
|
||||
}
|
||||
|
||||
return b
|
||||
|
@ -50,7 +50,7 @@ func collide(pos, lane int, s State) interface{} {
|
|||
|
||||
const (
|
||||
baseAccel = 1
|
||||
maxA = 1
|
||||
maxV = 2
|
||||
passDistance = 2
|
||||
MaxA = 1
|
||||
MaxV = 2
|
||||
PassDistance = 2
|
||||
)
|
||||
|
|
12
gfx/gfx.go
12
gfx/gfx.go
|
@ -109,13 +109,17 @@ func teamColors(ts []game.Team) map[*game.Team]pixel.RGBA {
|
|||
var c color.RGBA
|
||||
switch i {
|
||||
case 0:
|
||||
c = colornames.Cyan
|
||||
c = colornames.Red
|
||||
case 1:
|
||||
c = colornames.Gold
|
||||
c = colornames.Green
|
||||
case 2:
|
||||
c = colornames.Lavender
|
||||
c = colornames.Blue
|
||||
case 3:
|
||||
c = colornames.Rosybrown
|
||||
c = colornames.Magenta
|
||||
case 4:
|
||||
c = colornames.Cyan
|
||||
case 5:
|
||||
c = colornames.Yellow
|
||||
}
|
||||
m[&ts[i]] = pixel.ToRGBA(c)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue