Cody

# Problem 556. Stuff the Board

Solution 1155898

Submitted on 7 Apr 2017 by Jack Knoll
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
tiles = [7 12 8 6 9]; nRows = 2; nCols = 2; omit = 6; board = fill_board(tiles,nRows,nCols); tiles_used = tiles(board(:)); assert(isequal(setdiff(tiles,tiles_used),omit))

m = 4 w = 0 c = 0 d = 0 q = 1 w = 12 I = 2 tiles = 1.0e+09 * 0.0000 -2.1475 0.0000 0.0000 0.0000 c = 2 w = 9 I = 5 tiles = 1.0e+09 * 0.0000 -2.1475 0.0000 0.0000 -2.1475 c = 2 5 w = 8 I = 3 tiles = 1.0e+09 * 0.0000 -2.1475 -2.1475 0.0000 -2.1475 c = 2 5 3 w = 7 I = 1 tiles = 1.0e+09 * -2.1475 -2.1475 -2.1475 0.0000 -2.1475 c = 2 5 3 1 d = 2 q = 2 d = 2 5 q = 3 d = 2 5 3 0 q = 4 d = 2 5 3 1 q = 5

2   Pass
tiles = [12 6 1 20 18 7 4 17]; nRows = 3; nCols = 2; omit = [1 4]; board = fill_board(tiles,nRows,nCols); tiles_used = tiles(board(:)); assert(isequal(setdiff(tiles,tiles_used),omit))

m = 6 w = 0 c = 0 d = 0 q = 1 w = 20 I = 4 tiles = 1.0e+09 * 0.0000 0.0000 0.0000 -2.1475 0.0000 0.0000 0.0000 0.0000 c = 4 w = 18 I = 5 tiles = 1.0e+09 * 0.0000 0.0000 0.0000 -2.1475 -2.1475 0.0000 0.0000 0.0000 c = 4 5 w = 17 I = 8 tiles = 1.0e+09 * 0.0000 0.0000 0.0000 -2.1475 -2.1475 0.0000 0.0000 -2.1475 c = 4 5 8 w = 12 I = 1 tiles = 1.0e+09 * -2.1475 0.0000 0.0000 -2.1475 -2.1475 0.0000 0.0000 -2.1475 c = 4 5 8 1 w = 7 I = 6 tiles = 1.0e+09 * -2.1475 0.0000 0.0000 -2.1475 -2.1475 -2.1475 0.0000 -2.1475 c = 4 5 8 1 6 w = 6 I = 2 tiles = 1.0e+09 * -2.1475 -2.1475 0.0000 -2.1475 -2.1475 -2.1475 0.0000 -2.1475 c = 4 5 8 1 6 2 d = 4 q = 2 d = 4 5 q = 3 d = 4 5 8 0 q = 4 d = 4 5 8 1 q = 5 d = 4 5 8 1 6 0 q = 6 d = 4 5 8 1 6 2 q = 7

3   Pass
tiles = [2 10 25 38 39 5 24 14 4]; nRows = 2; nCols = 3; omit = [2 4 5]; board = fill_board(tiles,nRows,nCols); tiles_used = tiles(board(:)); assert(isequal(setdiff(tiles,tiles_used),omit))

m = 6 w = 0 c = 0 d = 0 q = 1 w = 39 I = 5 tiles = 1.0e+09 * 0.0000 0.0000 0.0000 0.0000 -2.1475 0.0000 0.0000 0.0000 0.0000 c = 5 w = 38 I = 4 tiles = 1.0e+09 * 0.0000 0.0000 0.0000 -2.1475 -2.1475 0.0000 0.0000 0.0000 0.0000 c = 5 4 w = 25 I = 3 tiles = 1.0e+09 * 0.0000 0.0000 -2.1475 -2.1475 -2.1475 0.0000 0.0000 0.0000 0.0000 c = 5 4 3 w = 24 I = 7 tiles = 1.0e+09 * 0.0000 0.0000 -2.1475 -2.1475 -2.1475 0.0000 -2.1475 0.0000 0.0000 c = 5 4 3 7 w = 14 I = 8 tiles = 1.0e+09 * 0.0000 0.0000 -2.1475 -2.1475 -2.1475 0.0000 -2.1475 -2.1475 0.0000 c = 5 4 3 7 8 w = 10 I = 2 tiles = 1.0e+09 * 0.0000 -2.1475 -2.1475 -2.1475 -2.1475 0.0000 -2.1475 -2.1475 0.0000 c = 5 4 3 7 8 2 d = 5 q = 2 d = 5 4 q = 3 d = 5 4 3 q = 4 d = 5 4 3 7 0 0 q = 5 d = 5 4 3 7 8 0 q = 6 d = 5 4 3 7 8 2 q = 7