Skip to content

Commit

Permalink
working on issue #32
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbates1995 committed Apr 26, 2023
1 parent 6dba4af commit d3cc707
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
8 changes: 4 additions & 4 deletions client/CubePress.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -64,7 +64,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
7A1DD02029F99BFD00CD0321 /* Controler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Controler.swift; sourceTree = "<group>"; };
7A1DD02029F99BFD00CD0321 /* Mover.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Mover.swift; sourceTree = "<group>"; };
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 = "<group>"; };
7A2E13A32953D5D70048628D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand Down Expand Up @@ -224,7 +224,7 @@
7AF1922629A00BDE00711273 /* SettingsModel.swift */,
7AF1924829B15F1E00711273 /* ColorFinder.swift */,
7A430F6E29C4CEB700E6A684 /* Solver.swift */,
7A1DD02029F99BFD00CD0321 /* Controler.swift */,
7A1DD02029F99BFD00CD0321 /* Mover.swift */,
);
path = Models;
sourceTree = "<group>";
Expand Down Expand Up @@ -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;
};
Expand Down
Binary file not shown.
File renamed without changes.
18 changes: 16 additions & 2 deletions client/CubePress/Models/Solver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 7 additions & 1 deletion client/CubePressTests/CubePressTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

0 comments on commit d3cc707

Please sign in to comment.