diff --git a/client/CubePress.xcodeproj/project.pbxproj b/client/CubePress.xcodeproj/project.pbxproj index 5521c97..de2bb26 100644 --- a/client/CubePress.xcodeproj/project.pbxproj +++ b/client/CubePress.xcodeproj/project.pbxproj @@ -8,7 +8,7 @@ /* Begin PBXBuildFile section */ 7A1DD01F29F1DF9E00CD0321 /* KociembaSolver in Frameworks */ = {isa = PBXBuildFile; productRef = 7A1DD01E29F1DF9E00CD0321 /* KociembaSolver */; }; - 7A1DD02129F99BFD00CD0321 /* Controler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A1DD02029F99BFD00CD0321 /* Controler.swift */; }; + 7A1DD02129F99BFD00CD0321 /* Mover.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A1DD02029F99BFD00CD0321 /* Mover.swift */; }; 7A2E13A02953D5D60048628D /* CubePressApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2E139F2953D5D60048628D /* CubePressApp.swift */; }; 7A2E13A42953D5D70048628D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7A2E13A32953D5D70048628D /* Assets.xcassets */; }; 7A2E13A72953D5D70048628D /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7A2E13A62953D5D70048628D /* Preview Assets.xcassets */; }; @@ -64,7 +64,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 7A1DD02029F99BFD00CD0321 /* Controler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Controler.swift; sourceTree = ""; }; + 7A1DD02029F99BFD00CD0321 /* Mover.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Mover.swift; sourceTree = ""; }; 7A2E139C2953D5D50048628D /* CubePress.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CubePress.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7A2E139F2953D5D60048628D /* CubePressApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CubePressApp.swift; sourceTree = ""; }; 7A2E13A32953D5D70048628D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -224,7 +224,7 @@ 7AF1922629A00BDE00711273 /* SettingsModel.swift */, 7AF1924829B15F1E00711273 /* ColorFinder.swift */, 7A430F6E29C4CEB700E6A684 /* Solver.swift */, - 7A1DD02029F99BFD00CD0321 /* Controler.swift */, + 7A1DD02029F99BFD00CD0321 /* Mover.swift */, ); path = Models; sourceTree = ""; @@ -398,7 +398,7 @@ 7AF1922929A6D93000711273 /* CameraView.swift in Sources */, 7AF1922D29A7F58300711273 /* FrameModel.swift in Sources */, 7AF1923529A9671800711273 /* VNRectangle.swift in Sources */, - 7A1DD02129F99BFD00CD0321 /* Controler.swift in Sources */, + 7A1DD02129F99BFD00CD0321 /* Mover.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/client/CubePress.xcodeproj/project.xcworkspace/xcuserdata/robertbates.xcuserdatad/UserInterfaceState.xcuserstate b/client/CubePress.xcodeproj/project.xcworkspace/xcuserdata/robertbates.xcuserdatad/UserInterfaceState.xcuserstate index 0827a44..2cc948a 100644 Binary files a/client/CubePress.xcodeproj/project.xcworkspace/xcuserdata/robertbates.xcuserdatad/UserInterfaceState.xcuserstate and b/client/CubePress.xcodeproj/project.xcworkspace/xcuserdata/robertbates.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/client/CubePress/Models/Controler.swift b/client/CubePress/Models/Mover.swift similarity index 100% rename from client/CubePress/Models/Controler.swift rename to client/CubePress/Models/Mover.swift diff --git a/client/CubePress/Models/Solver.swift b/client/CubePress/Models/Solver.swift index b8b4e64..3ba9466 100644 --- a/client/CubePress/Models/Solver.swift +++ b/client/CubePress/Models/Solver.swift @@ -101,8 +101,22 @@ class Solver { } func convert(instruction: String) -> String { - - return "" + switch (instruction) { + case "B" : + return MacroMove[instruction]! + case "L" : + return MacroMove[instruction]! + case "D" : + return MacroMove[instruction]! + case "F" : + return MacroMove[instruction]! + case "R" : + return MacroMove[instruction]! + case "U" : + return MacroMove[instruction]! + default: + return "[Conversion Issue]" + } } func convert(instructions: String) -> String { diff --git a/client/CubePressTests/CubePressTests.swift b/client/CubePressTests/CubePressTests.swift index e50c3ad..d1b411b 100644 --- a/client/CubePressTests/CubePressTests.swift +++ b/client/CubePressTests/CubePressTests.swift @@ -63,6 +63,12 @@ final class CubePressTests: XCTestCase { func testSolver() { testKociembaSolver(map: "UUUUUUUUURRRRRRRRRFFFFFFFFFDDDDDDDDDLLLLLLLLLBBBBBBBBB", expected: "R L U2 R L' B2 U2 R2 F2 L2 D2 L2 F2 ") - XCTAssertEqual(sut.solver.convert(instructions: "R L U2 R L' B2 U2 R2 F2 L2 D2 L2 F2 "), "should not match") + XCTAssertEqual(sut.solver.convert(instructions: "U "), "LTMTMBXCMLTMCTMLTMC") + XCTAssertEqual(sut.solver.convert(instructions: "D "), "LBXCMLTMCTMRTMC") + XCTAssertEqual(sut.solver.convert(instructions: "R "), "LTMBXCMRTMCTMTMTM") + XCTAssertEqual(sut.solver.convert(instructions: "L "), "LTMTMTMBXCMLTMCTM") + XCTAssertEqual(sut.solver.convert(instructions: "F "), "TMLBXCTMRTMCTMTM") + XCTAssertEqual(sut.solver.convert(instructions: "B "), "TMTMTMLBXCTMRTMC") + XCTAssertEqual(sut.solver.convert(instructions: "U D "), "LTMTMBXCMLTMCTMLTMC") } }