示例#1
0
def FMC_scrambler():
    """ Returns an FMC scramble, which is just a normal WCA scramble with R' U' F padding. """

    scramble = scrambler333.get_WCA_scramble().strip()
    while does_FMC_scramble_have_cancellations(scramble):
        scramble = scrambler333.get_WCA_scramble().strip()
    return "R' U' F {} R' U' F".format(scramble)
示例#2
0
def scrambler_333_relay():
    """ Get a scramble for the 3x3 relay of 3 event. """

    s1 = scrambler333.get_WCA_scramble()
    s2 = scrambler333.get_WCA_scramble()
    s3 = scrambler333.get_WCA_scramble()

    return f'1: {s1}\n2: {s2}\n3: {s3}'
示例#3
0
    def initUI(self):
        self.isCounting = False
        self.timeNow = datetime.now()

        self.group = QActionGroup(self)
        self.menu = QMenu("Background Colors", self)
        self.isBackgroundBlue = self.group.addAction(
            QAction("Blue", self.menu, checkable=True))
        self.isBackgroundTeal = self.group.addAction(
            QAction("Teal", self.menu, checkable=True))
        self.isBackgroundGrey = self.group.addAction(
            QAction("Grey", self.menu, checkable=True))
        self.isBackgroundDefault = self.group.addAction(
            QAction("Off White", self.menu, checkable=True))
        self.isBackgroundDefault.setChecked(True)
        self.menu.addAction(self.isBackgroundBlue)
        self.menu.addAction(self.isBackgroundTeal)
        self.menu.addAction(self.isBackgroundGrey)
        self.menu.addAction(self.isBackgroundDefault)

        # timerlabel
        self.timerLabel = QLabel(self)
        timerFont = QFont("DS-Digital", 30)
        timerGeometry = QRect(320, 400, 260, 70)
        self.timerLabel.setGeometry(timerGeometry)
        self.timerLabel.setAlignment(Qt.AlignCenter)
        # timerLabel.setStyleSheet("border: 1px solid black;")
        self.timerLabel.setFont(timerFont)
        self.timerLabel.setText("00:00")

        # scramble label
        scrambleLabel = QLabel(self)
        scrambleFont = QFont("Open Sans", 20)
        scrambleGeometry = QRect(0, 0, 900, 90)
        scrambleLabel.setGeometry(scrambleGeometry)
        scrambleLabel.setAlignment(Qt.AlignCenter)
        scrambleLabel.setFont(scrambleFont)
        scrambleLabel.setText(pyt.get_WCA_scramble())

        # scramble button
        scrambleButton = QPushButton(self)
        scrambleButtonFont = QFont("Open Sans", 10)
        scrambleButton.setFont(scrambleButtonFont)
        scrambleButton.setText("New Scramble")
        scrambleButtonGeometry = QRect(385, 80, 130, 35)
        scrambleButton.setGeometry(scrambleButtonGeometry)
        scrambleButton.clicked.connect(
            lambda: scrambleLabel.setText(pyt.get_WCA_scramble()))
        listener = Listener(scrambleButton)

        # shortcuts and events
        spaceKey = QShortcut(Qt.Key_Space, self, autoRepeat=False)
        spaceKey.activated.connect(self.processTime)
        # -----------------------------------------------#
        self.menu.triggered.connect(self.backgroundColor)
        self.menuBar().addMenu(self.menu)
        self.show()
示例#4
0
    async def threebythree(self, ctx, *, amount=1):

        if amount > 25:
            return await ctx.send("Use a smaller number!")

        scrambles = []
        scrambles.append(scrambler333.get_WCA_scramble())
        a = 0
        s = 1
        for i in range(amount):
            msg = await ctx.send(str(s) + ") " + str(scrambles[a]) + "\n")
            scrambles.append(scrambler333.get_WCA_scramble())
            a += 1
            s += 1

            await msg.add_reaction("<a:DC_verified2:801699442495062016>")
示例#5
0
def scrambler_234_relay():
    """ Get a scramble for the 2-3-4 relay event. """

    s222 = scrambler222.get_WCA_scramble()
    s333 = scrambler333.get_WCA_scramble()
    s444 = scrambler444.get_random_state_scramble()

    return f'2x2: {s222}\n3x3: {s333}\n4x4: {s444}'
示例#6
0
def get_scramble():
    """
    Generates a scramble using euphwes' pyTwistyScrambler module
    """

    scramble = scrambler333.get_WCA_scramble()

    # We can do this because scramble only contains ascii characters
    return str(scramble)
示例#7
0
def get_scramble():
    """
    Generates a scramble using euphwes' pyTwistyScrambler module
    """

    scramble = scrambler333.get_WCA_scramble()

    # We can do this because scramble only contains ascii characters
    return str(scramble)
示例#8
0
def generate():
    # create a random scramble according the the WCA scramble algorithm
    scramble = scrambler333.get_WCA_scramble()
    # scramble = scramble.split(" ")
    # print(scramble, len(scramble))

    # Create a Cube object
    mycube = pc.Cube()
    # Scramble the cube according to the wca scamble
    mycube(scramble)

    # convert cube into a sctring for manipulation
    cube_state = str(mycube)
    # split cube string into a grid list
    grid = [[i] for i in cube_state.split("\n")]
    grid.pop(-1)

    # make sure all rows of grid are the same length
    for i in range(len(grid)):
        if (len(grid[i][0]) < 36):
            grid[i][0] += " " * 18

    # make grid truly 2d
    for i in range(len(grid)):
        temp = []
        for j in range(12):
            temp.append(grid[i][0][1 + j * 3])
        # print(temp)
        grid[i] = temp

    # make scramble as if white is on top (swap orange for red, and yellow for white)
    for r in range(len(grid)):
        for c in range(len(grid[r])):
            if grid[r][c] == 'o':
                grid[r][c] = 'right'
            elif grid[r][c] == 'r':
                grid[r][c] = 'left'
            elif grid[r][c] == 'y':
                grid[r][c] = 'up'
            elif grid[r][c] == 'w':
                grid[r][c] = 'down'
            elif grid[r][c] == 'g':
                grid[r][c] = 'front'
            elif grid[r][c] == 'b':
                grid[r][c] = 'back'

    # print grid (for debugging)
    # for r in grid:
    #     print(r)

    return grid, scramble
示例#9
0
 def generateScramble(cube):
     if (cube == "2x2x2"):
         return scrambler222.get_WCA_scramble()
     elif (cube == "3x3x3"):
         return scrambler333.get_WCA_scramble()
     elif (cube == "4x4x4"):
         return scrambler444.get_WCA_scramble()
     elif (cube == "5x5x5"):
         return scrambler555.get_WCA_scramble()
     elif (cube == "6x6x6"):
         return scrambler555.get_WCA_scramble()
     elif (cube == "7x7x7"):
         return scrambler555.get_WCA_scramble()
     elif (cube == "piraminx"):
         return pyraminxScrambler.get_WCA_scramble()
     elif (cube == "clock"):
         return clockScrambler.get_WCA_scramble()
     elif (cube == "megaminx"):
         return megaminxScrambler.get_WCA_scramble()
     elif (cube == "squareone"):
         return squareOneScrambler.get_WCA_scramble()
     elif (cube == "skewb"):
         return skewbScrambler.get_WCA_scramble()
示例#10
0
def freeze(args=0):
    global b, timed, count, times_list, p, avg5, avg5_flo, times_list_5_flo, times_list_5, min_5, max_5, min_c, max_c, avg12, avg12_flo, times_list_12_flo, times_list_12, min_12, max_12, min_c12, max_c12, k, mean, fast, time_fast
    # To stop the timer
    b = b + 1
    if (float(timed) < 13.26):
        messagebox.showinfo(
            "Congratulations!",
            "You just beat the Developer's Best Time of 13.26 seconds!")
    # Re-Enable Start button and Disable Stop button
    start.config(state=NORMAL)
    stop.config(state=DISABLED)
    # To get new scramble
    scramble.config(text=scrambler333.get_WCA_scramble())
    # Save new time to file
    times_file = open('times.txt', 'a+')
    times_file.write(timed + '\n')
    times_file.close()
    # Re-read the file to update stats
    times_file = open('times.txt', 'r+')
    times_list = times_file.readlines()
    count = len(times_list)
    times_file.close()
    # Updates No. of Solves and Last 12 Solves after new solve
    i = 1
    saved_times_str = ''
    if (count < 12):
        while (i <= count):
            if (i == count):
                saved_times_str = saved_times_str + times_list[count -
                                                               i].strip()
                break
            saved_times_str = saved_times_str + times_list[count -
                                                           i].strip() + ', '
            i = i + 1
    else:
        while (i < 13):
            if (i == 12):
                saved_times_str = saved_times_str + times_list[count -
                                                               i].strip()
                break
            saved_times_str = saved_times_str + times_list[count -
                                                           i].strip() + ', '
            i = i + 1
    times_count.config(text='No. of Solves: ' + str(count))
    saved_times.config(text='Last 12 Solves: ' + saved_times_str)
    # Updates Average of 5 after new solve
    avg5 = ''
    avg5_flo = 0
    min_c = 0
    max_c = 0
    if (count >= 5):
        times_list_5 = times_list[count - 5:count]
        times_list_5_flo = [0, 1, 2, 3, 4]
        p = 0
        while (p < 5):
            times_list_5_flo[p] = float(times_list_5[p].strip())
            p = p + 1
        min_5 = min(times_list_5_flo)
        max_5 = max(times_list_5_flo)
        p = 0
        while (p < 5):
            if (times_list_5_flo[p] == max_5 and max_c == 0):
                p = p + 1
                max_c = 1
                continue
            if (times_list_5_flo[p] == min_5 and min_c == 0):
                p = p + 1
                min_c = 1
                continue
            avg5_flo = avg5_flo + (times_list_5_flo[p] / 3)
            p = p + 1
        avg5 = '%.2f' % (avg5_flo)
    ao5.config(text='Average of 5: ' + avg5)
    # Updates Average of 12 after new solve
    avg12 = ''
    avg12_flo = 0
    max_c12 = 0
    min_c12 = 0
    if (count >= 12):
        times_list_12 = times_list[count - 12:count]
        times_list_12_flo = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
        p = 0
        while (p < 12):
            times_list_12_flo[p] = float(times_list_12[p].strip())
            p = p + 1
        min_12 = min(times_list_12_flo)
        max_12 = max(times_list_12_flo)
        p = 0
        while (p < 12):
            if (times_list_12_flo[p] == max_12 and max_c12 == 0):
                p = p + 1
                max_c12 = 1
                continue
            if (times_list_12_flo[p] == min_12 and min_c12 == 0):
                p = p + 1
                min_c12 = 1
                continue
            avg12_flo = avg12_flo + (times_list_12_flo[p] / 10)
            p = p + 1
        avg12 = '%.2f' % (avg12_flo)
    ao12.config(text='Average of 12: ' + avg12)
    # Updates Total Mean after new solve
    k = 0
    mean = 0
    while (k < count):
        mean = mean + (float(times_list[k].strip()) / count)
        k = k + 1
    mean = '%.2f' % (mean)
    meantotal.config(text='Total Mean: ' + mean)
    #Updating Best Time
    fast = times_list[0]
    for time_fast in times_list:
        if float(time_fast) < float(fast):
            fast = time_fast
    fast_time.config(text='Your Best Time: ' + fast)
    root.update()
    # Sets focus on start button so it can be run through space-bar
    start.focus_set()
示例#11
0
def change_scramble():
    scramble.config(text=scrambler333.get_WCA_scramble())
示例#12
0
else:
    while (i < 13):
        if (i == 12):
            saved_times_str = saved_times_str + times_list[count - i].strip()
            break
        saved_times_str = saved_times_str + times_list[count -
                                                       i].strip() + ', '
        i = i + 1

saved_times = Label(root,
                    text='Last 12 Solves: ' + saved_times_str,
                    font=20,
                    background='#f6e58d',
                    fg='black')
scramble = Label(root,
                 text=scrambler333.get_WCA_scramble(),
                 font=20,
                 background='#f6e58d',
                 fg='black')
chng_scramble = Button(root,
                       image=chng_image,
                       relief=FLAT,
                       background="#f6e58d",
                       command=change_scramble)
# Pack the elements
timer.grid(row=1, columnspan=4, padx=20, pady=20)
start.grid(row=2, pady=15, padx=10)
stop.grid(row=2, column=3, pady=15, padx=10)
times_count.grid(row=3, column=0, columnspan=2, pady=10, padx=5)
saved_times.grid(row=4, columnspan=4, pady=10, padx=10)
scramble.grid(row=0, columnspan=4, pady=15, padx=5)
 def getScramble():
     return CubeSimulator.toFormat(scrambler333.get_WCA_scramble())