def front(self, cube): servo = maestro.Controller() mr = MovementRobot.Movement() mc = MovementCube.Movement() mr.front(servo) mc.front(cube) servo.close()
def invDown(self, cube): servo = maestro.Controller() mr = MovementRobot.Movement() mc = MovementCube.Movement() mr.invDown(servo) mc.invDown(cube) servo.close()
# -*- coding: utf-8 -*- import RubiksCube import MovementCube cube = RubiksCube.RubiksCube() mc = MovementCube.Movement() mc.right(cube, 0) mc.up(cube, 4) mc.invDown(cube, 3) print(cube.getTab()) print("######################################################") mc.x(cube) print(cube.getTab()) print("######################################################") mc.x(cube) print(cube.getTab()) print("######################################################") mc.x(cube) print(cube.getTab()) print("######################################################") mc.y(cube) print(cube.getTab()) print("######################################################") mc.y(cube) print(cube.getTab()) print("######################################################") mc.y(cube) print(cube.getTab()) print("######################################################")
def invRight(self, cube): servo = maestro.Controller() mr = MovementRobot.Movement() mc = MovementCube.Movement() id = cube.getValTab(0, 1, 1) #Couleur de la face en face topid = cube.getValTab(4, 1, 1) #Couleur de la face au dessus if (id == 0): if (topid == 1): mc.invDown(cube, id) elif (topid == 3): mc.invUp(cube, id) elif (topid == 4): mc.invRight(cube, id) elif (topid == 5): mc.invLeft(cube, id) elif (id == 1): if (topid == 0): mc.invUp(cube, id) elif (topid == 2): mc.invDown(cube, id) elif (topid == 4): mc.invRight(cube, id) elif (topid == 5): mc.invLeft(cube, id) elif (id == 2): if (topid == 1): mc.invUp(cube, id) elif (topid == 3): mc.invDown(cube, id) elif (topid == 4): mc.invRight(cube, id) elif (topid == 5): mc.invLeft(cube, id) elif (id == 3): if (topid == 0): mc.invDown(cube, id) elif (topid == 2): mc.invUp(cube, id) elif (topid == 4): mc.invRight(cube, id) elif (topid == 5): mc.invLeft(cube, id) elif (id == 4): if (topid == 0): mc.invRight(cube, id) elif (topid == 1): mc.invUp(cube, id) elif (topid == 2): mc.invLeft(cube, id) elif (topid == 3): mc.invDown(cube, id) elif (id == 5): if (topid == 0): mc.invRight(cube, id) elif (topid == 1): mc.invDown(cube, id) elif (topid == 2): mc.invLeft(cube, id) elif (topid == 3): mc.invUp(cube, id) mr.invRight(servo) servo.close()
def right(self, cube): servo = maestro.Controller() mr = MovementRobot.Movement() mc = MovementCube.Movement() id = cube.getValTab(0, 1, 1) #Couleur de la face en face topid = cube.getValTab(4, 1, 1) #Couleur de la face au dessus print("id:", id, "topid:", topid) if (id == 0): if (topid == 1): mc.down(cube, id) elif (topid == 3): mc.up(cube, id) elif (topid == 4): mc.right(cube, id) elif (topid == 5): mc.left(cube, id) elif (id == 1): if (topid == 0): mc.up(cube, id) elif (topid == 2): mc.down(cube, id) elif (topid == 4): mc.right(cube, id) elif (topid == 5): mc.left(cube, id) elif (id == 2): if (topid == 1): mc.up(cube, id) elif (topid == 3): mc.down(cube, id) elif (topid == 4): mc.right(cube, id) elif (topid == 5): mc.left(cube, id) elif (id == 3): if (topid == 0): mc.down(cube, id) elif (topid == 2): mc.up(cube, id) elif (topid == 4): mc.right(cube, id) elif (topid == 5): mc.left(cube, id) elif (id == 4): if (topid == 0): mc.right(cube, id) elif (topid == 1): mc.up(cube, id) elif (topid == 2): mc.left(cube, id) elif (topid == 3): mc.down(cube, id) elif (id == 5): if (topid == 0): mc.right(cube, id) elif (topid == 1): mc.down(cube, id) elif (topid == 2): mc.left(cube, id) elif (topid == 3): mc.up(cube, id) mr.right(servo) servo.close()