aboutsummaryrefslogtreecommitdiff
path: root/tris
diff options
context:
space:
mode:
authorJoop Kiefte <ikojba@gmail.com>2020-09-14 09:26:28 +0200
committerJoop Kiefte <ikojba@gmail.com>2020-09-14 09:26:56 +0200
commit007d00594170e1885b5478b3fcbedcb28d12b94e (patch)
tree7de5092d2cfb7e8c491441ceec3b8c57eb3840d6 /tris
parentd6dfb7146bc208667c57d66816195333414a038d (diff)
Add score and next, fixes #2 and #3
Diffstat (limited to 'tris')
-rw-r--r--tris/next.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/tris/next.go b/tris/next.go
new file mode 100644
index 0000000..e72a4ff
--- /dev/null
+++ b/tris/next.go
@@ -0,0 +1,13 @@
+package tris
+
+func (b Bag) Next(n int) (Bag, Field) {
+ var f Field
+ for len(b) < n {
+ b = append(b, NewBag()...)
+ }
+ nextpieces := b[:n]
+ for i, p := range nextpieces {
+ f = f.Add(Placement{piece: p, Y:2+i*4})
+ }
+ return b, f
+}