diff options
author | Joop Kiefte <ikojba@gmail.com> | 2020-09-20 09:44:21 +0200 |
---|---|---|
committer | Joop Kiefte <ikojba@gmail.com> | 2020-09-20 09:44:21 +0200 |
commit | de36bfd4aecb683c128fb4294de545317fc0edab (patch) | |
tree | 1a33dd93d772fda98533565ea5c416606961fa2a | |
parent | f8ec632ce36fa33aadfb28f515ac585b45118179 (diff) |
Fix nextbox colors
-rw-r--r-- | main.go | 2 | ||||
-rw-r--r-- | tris/core.go | 2 | ||||
-rw-r--r-- | tris/next.go | 2 |
3 files changed, 3 insertions, 3 deletions
@@ -90,7 +90,7 @@ func main() { slines := fmt.Sprintf("lines %d", linescleared) if !harddrop { fpos(0, 0, f.Add(p)) - next := tris.NewField(20, 4) + var next tris.Field b, next = b.Next(5) npos(0, 24, next) ppos(1, 32, sscore) diff --git a/tris/core.go b/tris/core.go index e0ae111..6963294 100644 --- a/tris/core.go +++ b/tris/core.go @@ -168,7 +168,7 @@ func (f Field) Add(p Placement) Field { } } for _, point := range p.Points() { - if point.Y < 0 || point.Y > f.H() || point.X < 0 || point.X > f.W() { + if point.Y < 0 || point.Y >= f.H() || point.X < 0 || point.X >= f.W() { continue } fn[point.Y][point.X] = p.Color() diff --git a/tris/next.go b/tris/next.go index e72a4ff..1a9903f 100644 --- a/tris/next.go +++ b/tris/next.go @@ -1,7 +1,7 @@ package tris func (b Bag) Next(n int) (Bag, Field) { - var f Field + f := NewField(20, 4) for len(b) < n { b = append(b, NewBag()...) } |