From a9af8146643fdb64909db63689d19f49df061862 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Mon, 1 Jul 2019 14:41:42 +0200 Subject: [PATCH] Allow problem packs to have arbitrary sizes --- mlp/i8pcube.go | 8 ++++---- mlp/i8pcube_test.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mlp/i8pcube.go b/mlp/i8pcube.go index c84c0be..4426f10 100644 --- a/mlp/i8pcube.go +++ b/mlp/i8pcube.go @@ -57,10 +57,10 @@ const ( type I8PPool map[I8PType][]Card // MakeI8PCube takes an organized set of cards and sorts them into a draftable I8PCube -func MakeI8PCube(cards I8PPool, schema I8PSchema) *I8PCube { +func MakeI8PCube(cards I8PPool, schema I8PSchema, problemPackSize int) *I8PCube { return &I8PCube{ Main: makeMainSet(cards, schema), - Problems: makeProblemSet(cards), + Problems: makeProblemSet(cards, problemPackSize), } } @@ -102,7 +102,7 @@ func makeMainSet(cards I8PPool, schema I8PSchema) (set *I8PSet) { return } -func makeProblemSet(cards I8PPool) (set *I8PSet) { +func makeProblemSet(cards I8PPool, problemPackSize int) (set *I8PSet) { set = &I8PSet{ Cards: I8PPool{ I8PTypeProblem: cards[I8PTypeProblem], @@ -111,7 +111,7 @@ func makeProblemSet(cards I8PPool) (set *I8PSet) { set.Schema = draft.PackSchema{ Slots: []draft.PackSlot{ { - Amount: 12, + Amount: problemPackSize, Provider: set.ProviderByType(I8PTypeProblem), }, }, diff --git a/mlp/i8pcube_test.go b/mlp/i8pcube_test.go index 19fc153..d041f06 100644 --- a/mlp/i8pcube_test.go +++ b/mlp/i8pcube_test.go @@ -21,7 +21,7 @@ func TestDraftI8PCube(t *testing.T) { mlp.I8PTypeEntry: mockCards("e1", "e2", "e3", "e4", "e5"), mlp.I8PTypeProblem: mockCards("P1", "P2"), } - cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema()) + cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema(), 12) pack1 := draft.MakePack(cube.Main) pack2 := draft.MakePack(cube.Main) @@ -57,7 +57,7 @@ func TestDryCube(t *testing.T) { mlp.I8PTypeMulti: mockCards("m1", "m4"), mlp.I8PTypeEntry: mockCards("e1", "e4"), } - cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema()) + cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema(), 12) pack := draft.MakePack(cube.Main) if len(pack) != 11 { t.Fatalf("Expected 11 cards in pack but got %d", len(pack)) @@ -93,7 +93,7 @@ func TestPodI8PCube(t *testing.T) { "Q9", "Q10", "Q11", "Q12", ), } - cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema()) + cube := mlp.MakeI8PCube(pool, mlp.DefaultI8PSchema(), 12) remainingStart := i8pCountRemaining(cube)