Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def spacingFigures(board: Board, figures: Array[Figure]): Array[Board] = {
- var boards = Array[Board]()
- for (x1 <- 0 to board.size - 1) {
- for (y1 <- 0 to board.size - 1) {
- if (board.cells(x1)(y1).status == Free() && figures(0).validateCell(board, Cell(x1, y1, Free()))) {
- println(x1 + "," + y1)
- var board_tmp1 = board
- figures(0).changeFields(board_tmp1, Cell(x1, y1, Free()))
- for (x2 <- 0 to board.size - 1) {
- for (y2 <- 0 to board.size - 1) {
- if (board.cells(x2)(y2).status == Free() && figures(1).validateCell(board, Cell(x2, y2, Free()))) {
- println(x2 + "," + y2)
- var board_tmp2 = board
- figures(1).changeFields(board_tmp2, Cell(x2, y2, Free()))
- for (x3 <- 0 to board.size - 1) {
- for (y3 <- 0 to board.size - 1) {
- if (board.cells(x3)(y3).status == Free() && figures(0).validateCell(board, Cell(x3, y3, Free()))) {
- println(x3 + "," + y3)
- var board_tmp3 = board_tmp2
- figures(2).changeFields(board_tmp3, Cell(x3, y3, Free()))
- board_tmp3.printBoard
- boards ++= Array(board_tmp3)
- }
- }
- }
- }
- }
- }
- }
- }
- }
- boards
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement