From 007d00594170e1885b5478b3fcbedcb28d12b94e Mon Sep 17 00:00:00 2001 From: Joop Kiefte Date: Mon, 14 Sep 2020 09:26:28 +0200 Subject: Add score and next, fixes #2 and #3 --- tris/next.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tris/next.go (limited to 'tris') 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 +} -- cgit v1.2.3-70-g09d2