diff --git a/4forces.xcworkspace/xcuserdata/yorickgeoffre.xcuserdatad/UserInterfaceState.xcuserstate b/4forces.xcworkspace/xcuserdata/yorickgeoffre.xcuserdatad/UserInterfaceState.xcuserstate index c829ef8..26be134 100644 Binary files a/4forces.xcworkspace/xcuserdata/yorickgeoffre.xcuserdatad/UserInterfaceState.xcuserstate and b/4forces.xcworkspace/xcuserdata/yorickgeoffre.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/4forces.xcworkspace/xcuserdata/yorickgeoffre.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/4forces.xcworkspace/xcuserdata/yorickgeoffre.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index ae40b44..c2414bc 100644 --- a/4forces.xcworkspace/xcuserdata/yorickgeoffre.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/4forces.xcworkspace/xcuserdata/yorickgeoffre.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -263,8 +263,8 @@ filePath = "forcesPack/Sources/forcesPack/Rules/AreRows4x.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "20" - endingLineNumber = "20" + startingLineNumber = "21" + endingLineNumber = "21" landmarkName = "isRuleMet(grid:targetedRow:targetedCol:)" landmarkType = "7"> @@ -274,13 +274,14 @@ @@ -295,9 +296,9 @@ filePath = "forcesPack/Sources/forcesPack/Game.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "39" - endingLineNumber = "39" - landmarkName = "init(_:)" + startingLineNumber = "46" + endingLineNumber = "46" + landmarkName = "init(_:printer:reader:)" landmarkType = "7"> @@ -311,9 +312,9 @@ filePath = "forcesPack/Sources/forcesPack/Game.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "38" - endingLineNumber = "38" - landmarkName = "init(_:)" + startingLineNumber = "45" + endingLineNumber = "45" + landmarkName = "init(_:printer:reader:)" landmarkType = "7"> @@ -327,9 +328,9 @@ filePath = "forcesPack/Sources/forcesPack/Game.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "26" - endingLineNumber = "26" - landmarkName = "init()" + startingLineNumber = "31" + endingLineNumber = "31" + landmarkName = "init(printer:reader:)" landmarkType = "7"> @@ -343,26 +344,502 @@ filePath = "forcesPack/Sources/forcesPack/Game.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "24" - endingLineNumber = "24" - landmarkName = "init()" + startingLineNumber = "29" + endingLineNumber = "29" + landmarkName = "init(printer:reader:)" + landmarkType = "7"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/4forces/4forces/main.swift b/4forces/4forces/main.swift index 5aa57a0..64725ef 100644 --- a/4forces/4forces/main.swift +++ b/4forces/4forces/main.swift @@ -8,4 +8,8 @@ import Foundation import forcesPack -var g: Game = Game() +func printer(str: String){ + print(str) +} + +var g: Game = Game(printer: printer,reader: readLine) diff --git a/forcesPack/Sources/forcesPack/Board.swift b/forcesPack/Sources/forcesPack/Board.swift index 57ceb49..9e2c0b2 100644 --- a/forcesPack/Sources/forcesPack/Board.swift +++ b/forcesPack/Sources/forcesPack/Board.swift @@ -12,6 +12,11 @@ public struct Board : CustomStringConvertible{ return toString() } + public var lastinsert: Int{ + return lastInsertIndex + } + + private var lastInsertIndex: Int = 0; private var nbRows = 4 private var nbColumn = 4 @@ -49,13 +54,14 @@ public struct Board : CustomStringConvertible{ print("insert not nil err") return false; } + lastInsertIndex = row grid[row][col] = id //print(grid) return true; } public mutating func insertPeice(id: Int, row: Int) -> Bool{ - guard !isFull() && row >= 0 else{ return false } + guard !isFull() && row >= 0 && row < grid[0].capacity else{ return false } var colToInsert: Int = nbColumn-1 @@ -109,4 +115,22 @@ public struct Board : CustomStringConvertible{ str += String(repeating: "═╩", count: (nbColumn)-1) + "═╝\n" return str } + + public func coalesceWonBoard(winningAlignementGrid: [[Int?]]) -> String{ + var str: String = "" + str += "╔" + str += String(repeating: "═╦", count: (nbColumn)-1) + "═╗\n" + for collNum in 0...nbRows-1{ //parcours de la grille du bas vers le haut + for rowNum in 0...nbColumn-1{ + str += "║" + str += String(winningAlignementGrid[rowNum][collNum] != nil ? "\u{001B}[0;33" : "") + str += String(((grid[rowNum][collNum] == nil) ? "▒" : String((grid[rowNum][collNum] ?? 0)))) + str += "\u{001B}[0;30" + } + str += String("║\n") + } + str += "╚" + str += String(repeating: "═╩", count: (nbColumn)-1) + "═╝\n" + return str + } } diff --git a/forcesPack/Sources/forcesPack/Game.swift b/forcesPack/Sources/forcesPack/Game.swift index a96598d..94104e0 100644 --- a/forcesPack/Sources/forcesPack/Game.swift +++ b/forcesPack/Sources/forcesPack/Game.swift @@ -12,14 +12,19 @@ public class Game{ private var players: [Player] private var winRules: [Rule] private var winner: Player? - public init() { + private var printerFunc: (String)->() + private var readerFunc: (Bool)-> String? + + public init(printer: @escaping (String)->(),reader: @escaping (Bool)->String?) { + readerFunc = reader + printerFunc = printer board = Board() players = [] - winRules = [AreCols4x(), AreRows4x(), AreDiags4x()] + winRules = [AreCols4xL(), AreRows4xL(), AreDiags4xL()] CreatePlayers() while(true){ while(doGameLoop()){} - print(winner == nil ? "stalemate!" : "player: "+String(winner?.id ?? -1)+" has won the game") + printerFunc(winner == nil ? "stalemate!" : "player: "+String(winner?.id ?? -1)+" has won the game") if(winner != nil){ break } sleep(1) winner = nil @@ -27,30 +32,37 @@ public class Game{ } } - public init(_ pl: [Player]){ + public init(_ pl: [Player], printer: @escaping (String)->(),reader: @escaping (Bool)->String?){ + readerFunc = reader + printerFunc = printer players = pl board = Board() - winRules = [AreCols4x(), AreRows4x(), AreDiags4x()] + winRules = [AreCols4xL(), AreRows4xL(), AreDiags4xL()] while(true){ while(doGameLoop()){} - print(winner == nil ? "stalemate!" : "player: "+String(winner?.id ?? -1)+" has won the game") + printerFunc(winner == nil ? "stalemate!" : "player: "+String(winner?.id ?? -1)+" has won the game") if(winner != nil){ break } sleep(1) board = Board() } } - public convenience init(_ test: Int){ - self.init([IA(id: 0), IA(id: 1)]) + public convenience init(_ test: Int, printer: @escaping (String)->(), reader: @escaping (Bool)->String?){ + self.init([IA(id: 0, reader: reader), IA(id: 1,reader: reader)], printer: printer, reader: reader) } private func doGameLoop() -> Bool{ for p in players{ - while(!board.insertPeice(id: p.id, row: p.play(board.nbCols-1))){} - print(board) + var played: Int = p.play(board.nbCols-1) + while(!board.insertPeice(id: p.id, row: played)){ + printerFunc("Incorrect choice, pick another:\n") + played = p.play(board.nbCols-1) + } + printerFunc(board.description) for gRule in winRules { - if(gRule.isRuleMet(grid: board.playspace, targetedRow: 0, targetedCol: 0)){ + if(gRule.isRuleMet(grid: board.playspace, targetedRow: board.lastinsert, targetedCol: played)){ winner = p + printerFunc(board.coalesceWonBoard(winningAlignementGrid: gRule.results ?? [[0]])) return false } if board.isFull() { @@ -65,18 +77,18 @@ public class Game{ private func CreatePlayers(){ var humans:Int = 0 var AI:Int = 0 - print("Création des joueurs, combien d'humains au total?\n>") - if let typed = readLine() {if let num = Int(typed) {humans = num}} + printerFunc("Création des joueurs, combien d'humains au total?\n>") + if let typed = readerFunc(true) {if let num = Int(typed) {humans = num}} - print("Création des IA, combien d'IA au total?\n>") - if let typed = readLine() {if let num = Int(typed){AI = num}} + printerFunc("Création des IA, combien d'IA au total?\n>") + if let typed = readerFunc(true) {if let num = Int(typed){AI = num}} var ids: Int = 0 if(humans > 0){ let humanRange = 1...humans for index in humanRange{ - players.append(Human(id: ids)) + players.append(Human(id: ids, reader: readerFunc)) ids+=1 } } @@ -84,12 +96,12 @@ public class Game{ if(AI > 0){ let AIRange = humans...((humans)+(AI-1)) for index in AIRange{ - players.append(IA(id: ids)) + players.append(IA(id: ids, reader: readerFunc)) ids+=1 } } - print(String(players.count) + " joueurs créés") - print(players) + printerFunc(String(players.count) + " joueurs créés") + printerFunc(players.description) } } diff --git a/forcesPack/Sources/forcesPack/Players/Human.swift b/forcesPack/Sources/forcesPack/Players/Human.swift index 83f9b34..ce21099 100644 --- a/forcesPack/Sources/forcesPack/Players/Human.swift +++ b/forcesPack/Sources/forcesPack/Players/Human.swift @@ -12,7 +12,7 @@ public class Human: Player { public override func play(_ max: Int)-> Int{ print("pick a row (0-"+String(max)+"):\n>") - if let input = readLine() { + if let input = reader(true) { if let number = Int(input){ return number } diff --git a/forcesPack/Sources/forcesPack/Players/Player.swift b/forcesPack/Sources/forcesPack/Players/Player.swift index 224f646..739d07e 100644 --- a/forcesPack/Sources/forcesPack/Players/Player.swift +++ b/forcesPack/Sources/forcesPack/Players/Player.swift @@ -9,10 +9,11 @@ import Foundation public class Player : CustomStringConvertible{ public var description: String{return "Player " + String(id)} - + internal var reader: (Bool) -> String? internal var id: Int - public init(id: Int) { + public init(id: Int, reader: @escaping (Bool)-> String?) { self.id = id + self.reader = reader } public func play(_ max: Int)-> Int{ return -1 diff --git a/forcesPack/Sources/forcesPack/Rules/AreCols4x.swift b/forcesPack/Sources/forcesPack/Rules/AreCols4x.swift index cf6cb96..99abc94 100644 --- a/forcesPack/Sources/forcesPack/Rules/AreCols4x.swift +++ b/forcesPack/Sources/forcesPack/Rules/AreCols4x.swift @@ -6,12 +6,12 @@ // import Foundation -public class AreCols4x: Rule{ //TODO: use the targeted row/col for more precision - public init() {} +public class AreCols4x: gridRule, Rule{ //TODO: use the targeted row/col for more precision public func isRuleMet(grid: [[Int?]], targetedRow: Int, targetedCol: Int) -> Bool { -// print("rule: cols") var i: Int = 0 var old: Int? = -1 + var rowid = 0 + var colid = 0 for row in grid{ for cell in row{ if(cell == old && cell != nil){ @@ -23,7 +23,10 @@ public class AreCols4x: Rule{ //TODO: use the targeted row/col for more precisi if(i >= 3){ return true } + colid += 1 } + rowid+=1 + colid = 0 i = 0 } return false; diff --git a/forcesPack/Sources/forcesPack/Rules/AreCols4xL.swift b/forcesPack/Sources/forcesPack/Rules/AreCols4xL.swift new file mode 100644 index 0000000..307cbcc --- /dev/null +++ b/forcesPack/Sources/forcesPack/Rules/AreCols4xL.swift @@ -0,0 +1,33 @@ +// +// File.swift +// forcesPack +// +// Created by yorick geoffre on 08/02/2023. +// + +import Foundation + +public class AreCols4xL: gridRule, Rule{ + public func isRuleMet(grid: [[Int?]], targetedRow: Int, targetedCol: Int) -> Bool { + var old: Int? = grid[0][targetedCol] + var count: Int = 0 + var index: Int = 0 + for cell in grid[targetedRow]{ + if(cell == old && old != nil){ + count += 1 + }else{ + count = 0 + } + old = cell + if count >= 4{ + prepareGrid(grid) + for idx in index-3...index{ + resultsGrid?[targetedRow][idx] = old + } + return true; + } + index += 1 + } + return false; + } +} diff --git a/forcesPack/Sources/forcesPack/Rules/AreDiags4x.swift b/forcesPack/Sources/forcesPack/Rules/AreDiags4x.swift index f1e7a9e..7a38465 100644 --- a/forcesPack/Sources/forcesPack/Rules/AreDiags4x.swift +++ b/forcesPack/Sources/forcesPack/Rules/AreDiags4x.swift @@ -7,9 +7,10 @@ import Foundation -public class AreDiags4x: Rule{ //TODO: use the targeted row/col for more precision - public init() {} +public class AreDiags4x: gridRule, Rule{ //TODO: use the targeted row/col for more precision + public func isRuleMet(grid: [[Int?]], targetedRow: Int, targetedCol: Int) -> Bool { + let colRange = 0...grid.count-1 let rowRange = 0...grid[0].count-1 diff --git a/forcesPack/Sources/forcesPack/Rules/AreDiags4xL.swift b/forcesPack/Sources/forcesPack/Rules/AreDiags4xL.swift new file mode 100644 index 0000000..2ea5b36 --- /dev/null +++ b/forcesPack/Sources/forcesPack/Rules/AreDiags4xL.swift @@ -0,0 +1,60 @@ +// +// File.swift +// forcesPack +// +// Created by yorick geoffre on 08/02/2023. +// + +import Foundation + +public class AreDiags4xL: gridRule, Rule{ //TODO: use the targeted row/col for more precision + + public func isRuleMet(grid: [[Int?]], targetedRow: Int, targetedCol: Int) -> Bool { + var old: Int? = grid[targetedRow][targetedCol] + var count : Int = 0 + let rowsize = grid[0].capacity-1 + + for index in -3...3{ // comme / + if((0...grid.capacity-1).contains(targetedRow + index) && (0...rowsize).contains(targetedCol + index)){ + if(old == grid[targetedRow+index][targetedCol+index] && old != nil){ + count += 1 + }else{ + count = 0 + } + old = grid[targetedRow+index][targetedCol+index] + if(count >= 4){ + prepareGrid(grid) + for idx in index-3...index{ + resultsGrid?[targetedRow+idx][targetedCol+idx] = old + } + return true; + } + }else{ + count = 0 + } + } + //--------------------------------------------------------------- + count = 0 + old = grid[targetedRow][targetedCol] + for index in -3...3{ // comme \ + if((0...grid.capacity-1).contains(targetedRow - index) && (0...rowsize).contains(targetedCol + index)){ + if(old == grid[targetedRow-index][targetedCol+index] && old != nil){ + count += 1 + }else{ + count = 0 + } + old = grid[targetedRow-index][targetedCol+index] + if(count >= 4){ + prepareGrid(grid) + for idx in index-3...index{ + resultsGrid?[targetedRow-idx][targetedCol+idx] = old + } + return true; + } + }else{ + count = 0 + } + } + return false; + } +} diff --git a/forcesPack/Sources/forcesPack/Rules/AreRows4x.swift b/forcesPack/Sources/forcesPack/Rules/AreRows4x.swift index 3f81b55..5f4eda3 100644 --- a/forcesPack/Sources/forcesPack/Rules/AreRows4x.swift +++ b/forcesPack/Sources/forcesPack/Rules/AreRows4x.swift @@ -7,10 +7,11 @@ import Foundation -public class AreRows4x: Rule{//TODO: use the targeted row/col for more precision - public init() {} +public class AreRows4x: gridRule, Rule{//TODO: use the targeted row/col for more precision + public override init(){} public func isRuleMet(grid: [[Int?]], targetedRow: Int, targetedCol: Int) -> Bool { -// print("rule: rows") + var rowid = 0 + var colid = 0 var i: [Int] = Array( repeating: 0, count: grid.count) var old: [Int?] = Array( repeating: nil, count: grid.count) var idx: Int = 0 @@ -25,8 +26,11 @@ public class AreRows4x: Rule{//TODO: use the targeted row/col for more precision if(i[idx] >= 3){ return true } + colid += 1 idx += 1 } + rowid += 1 + colid = 0 idx = 0 } return false; diff --git a/forcesPack/Sources/forcesPack/Rules/AreRows4xL.swift b/forcesPack/Sources/forcesPack/Rules/AreRows4xL.swift new file mode 100644 index 0000000..526a6fc --- /dev/null +++ b/forcesPack/Sources/forcesPack/Rules/AreRows4xL.swift @@ -0,0 +1,33 @@ +// +// File.swift +// +// +// Created by yorick geoffre on 07/02/2023. +// + +import Foundation + +public class AreRows4xL: gridRule, Rule{ + public override init(){} + public func isRuleMet(grid: [[Int?]], targetedRow: Int, targetedCol: Int) -> Bool { + var old: Int? = grid[0][targetedCol] + var count: Int = 0 + for index in 0...grid[0].capacity-1{ + print(grid[0].capacity) + if(grid[index][targetedCol] == old && old != nil){ + count += 1 + }else{ + count = 0 + } + old = grid[index][targetedCol] + if count >= 4{ + prepareGrid(grid) + for idx in index-3...index{ + resultsGrid?[idx][targetedCol] = old + } + return true; + } + } + return false; + } +} diff --git a/forcesPack/Sources/forcesPack/Rules/Rule.swift b/forcesPack/Sources/forcesPack/Rules/Rule.swift index 79084d0..ac4ff37 100644 --- a/forcesPack/Sources/forcesPack/Rules/Rule.swift +++ b/forcesPack/Sources/forcesPack/Rules/Rule.swift @@ -7,6 +7,6 @@ import Foundation -public protocol Rule{ +public protocol Rule : gridRule{ func isRuleMet(grid: [[Int?]], targetedRow: Int, targetedCol: Int)-> Bool } diff --git a/forcesPack/Sources/forcesPack/Rules/gridRule.swift b/forcesPack/Sources/forcesPack/Rules/gridRule.swift new file mode 100644 index 0000000..132eb9a --- /dev/null +++ b/forcesPack/Sources/forcesPack/Rules/gridRule.swift @@ -0,0 +1,18 @@ +// +// File.swift +// +// +// Created by yorick geoffre on 07/02/2023. +// + +import Foundation +public class gridRule{ + public init(){} + internal var resultsGrid : [[Int?]]? = nil + + public var results: [[Int?]]? {get{return resultsGrid}} + + internal func prepareGrid(_ grid: [[Int?]]){ + resultsGrid = Array(repeating: Array( repeating: nil, count: grid[0].count), count: grid.count) + } +} diff --git a/forcesPack/Sources/forcesPack/Rules/gridRuleEnumResult.swift b/forcesPack/Sources/forcesPack/Rules/gridRuleEnumResult.swift new file mode 100644 index 0000000..a8d2ad1 --- /dev/null +++ b/forcesPack/Sources/forcesPack/Rules/gridRuleEnumResult.swift @@ -0,0 +1,14 @@ +// +// File.swift +// +// +// Created by yorick geoffre on 07/02/2023. +// + +import Foundation + +public enum gridRuleResult{ + case unfinished + case won + case stalemate +} diff --git a/forcesPack/Tests/forcesPackTests/GameTests.swift b/forcesPack/Tests/forcesPackTests/GameTests.swift index 68d9d10..16961cf 100644 --- a/forcesPack/Tests/forcesPackTests/GameTests.swift +++ b/forcesPack/Tests/forcesPackTests/GameTests.swift @@ -9,8 +9,17 @@ import Foundation import forcesPack import XCTest +public func printer(str: String){ + +} + +public func reader(bool: Bool)-> String{ + return "test" +} + final class GameTests: XCTestCase{ + public func testGame(){ - XCTAssertNoThrow(Game(-1)) + XCTAssertNoThrow(Game(-1,printer: printer,reader: reader)) } } diff --git a/forcesPack/Tests/forcesPackTests/PlayerTests.swift b/forcesPack/Tests/forcesPackTests/PlayerTests.swift index f14fcb7..0ef935c 100644 --- a/forcesPack/Tests/forcesPackTests/PlayerTests.swift +++ b/forcesPack/Tests/forcesPackTests/PlayerTests.swift @@ -9,20 +9,24 @@ import XCTest import forcesPack final class PlayerTests: XCTestCase { + func reader(_ ign: Bool) -> String?{ + return "" + } + func testPlayers(){ - var p: Player = IA(id: 0) + var p: Player = IA(id: 0, reader: reader) XCTAssertNotNil(p) var ret = p.play(10) XCTAssertTrue( ret <= 10 && ret >= 0) XCTAssertEqual(p.description, "IA 0") - p = Player(id: 0) + p = Player(id: 0, reader: reader) XCTAssertNotNil(p) ret = p.play(10) XCTAssertTrue( ret == -1) XCTAssertEqual(p.description, "Player 0") - p = Human(id: 0) + p = Human(id: 0, reader: reader) XCTAssertNotNil(p) XCTAssertEqual(p.description, "Human 0") } diff --git a/forcesPack/Tests/forcesPackTests/boardRulesTests.swift b/forcesPack/Tests/forcesPackTests/boardRulesTests.swift index e8412b6..c2070ae 100644 --- a/forcesPack/Tests/forcesPackTests/boardRulesTests.swift +++ b/forcesPack/Tests/forcesPackTests/boardRulesTests.swift @@ -19,6 +19,9 @@ final class BoardRulesTests: XCTestCase { var ruleCol : Rule = AreCols4x() var ruleRow: Rule = AreRows4x() var ruleDiag: Rule = AreDiags4x() + var ruleRowL: Rule = AreRows4xL() + var ruleColL: Rule = AreCols4xL() + var ruleDiagL: Rule = AreDiags4xL() XCTAssertFalse(ruleCol.isRuleMet(grid: boardEmpty, targetedRow: 0, targetedCol: 0)) XCTAssertFalse(ruleRow.isRuleMet(grid: boardEmpty, targetedRow: 0, targetedCol: 0)) @@ -28,13 +31,34 @@ final class BoardRulesTests: XCTestCase { XCTAssertFalse(ruleRow.isRuleMet(grid: boardRow, targetedRow: 0, targetedCol: 0)) XCTAssertFalse(ruleDiag.isRuleMet(grid: boardRow, targetedRow: 0, targetedCol: 0)) + print(ruleCol.results) + XCTAssertFalse(ruleCol.isRuleMet(grid: boardCol, targetedRow: 0, targetedCol: 0)) XCTAssertTrue(ruleRow.isRuleMet(grid: boardCol, targetedRow: 0, targetedCol: 0)) XCTAssertFalse(ruleDiag.isRuleMet(grid: boardCol, targetedRow: 0, targetedCol: 0)) + print(ruleRow.results) XCTAssertFalse(ruleCol.isRuleMet(grid: boardDiag, targetedRow: 0, targetedCol: 0)) XCTAssertFalse(ruleRow.isRuleMet(grid: boardDiag, targetedRow: 0, targetedCol: 0)) XCTAssertTrue(ruleDiag.isRuleMet(grid: boardDiag, targetedRow: 0, targetedCol: 0)) + + + XCTAssertTrue(ruleColL.isRuleMet(grid: boardRow, targetedRow: 0, targetedCol: 0)) + XCTAssertFalse(ruleRowL.isRuleMet(grid: boardRow, targetedRow: 0, targetedCol: 0)) + XCTAssertFalse(ruleDiagL.isRuleMet(grid: boardRow, targetedRow: 0, targetedCol: 0)) + + XCTAssertFalse(ruleColL.isRuleMet(grid: boardCol, targetedRow: 0, targetedCol: 0)) + XCTAssertTrue(ruleRowL.isRuleMet(grid: boardCol, targetedRow: 0, targetedCol: 0)) + XCTAssertFalse(ruleDiagL.isRuleMet(grid: boardCol, targetedRow: 0, targetedCol: 0)) + + XCTAssertFalse(ruleColL.isRuleMet(grid: boardDiag, targetedRow: 0, targetedCol: 0)) + XCTAssertFalse(ruleRowL.isRuleMet(grid: boardDiag, targetedRow: 0, targetedCol: 0)) + XCTAssertTrue(ruleDiagL.isRuleMet(grid: boardDiag, targetedRow: 0, targetedCol: 0)) + + + print(ruleRowL.results) + print(ruleColL.results) + print(ruleDiagL.results) } }