Coding for cubing

CyoobietheCuber

Regular
Joined
Jun 24, 2020
Messages
189
Location
Antarctica
This will be a thread for coding snippets, projects, and other programming things around cubing. As far I know, there isn't a thread for this, at least recently.

So to start of, here is my little, simple scramble generator. This is not perfect though so help is welcome.
Python:
"""This is a free snippet of code
Please use this code as you wish
as long as do do claim ownership of this

I do not know much about copyright so
if some does, I would appreciate if
you could help with this copyright

contributions are welcome

thanks
"""

# Import the random module
import random

# Make some lists
moves = ["R", "L", "F", "B", "U", "D"]
dir_ = [" ", "' ", "2 "]
# "dir_" stands for direction

# Set the number of moves in the scramble
scramble_moves = 18

# Set how many scrambles you want
freq = 3

# The current scramble we are on
scrambles_done = 1

# Set up the last move that was in the scramble
# There curently is none so we set it to None
last_move = None

# A while loop for printing each scramble
while scrambles_done <= freq:
    # Add one to the scrambles that have been done
    scrambles_done += 1

    # The main loop for generating the scramble
    for current_move in range(0, scramble_moves):

        # Pick a random move from the list of moves
        rand_move = random.choice(moves)

        # Pick a random "end notation" symbol
        rand_dir = random.choice(dir_)

        # Make a loop to pick a new move until it does not
        # match the last move in the scramble
        while rand_move == last_move:
            rand_move = random.choice(moves)

        # Print the move with end notation
        print(rand_move, end=rand_dir)

        # Set the last move to the current one
        last_move = rand_move

    # Create a new line once a scramble is finished
    print("\b")
 
You should use dictionaries instead of lists, it will make it easier to assign values and types for the moves. It will also be easier in the long term.
 
You should use dictionaries instead of lists, it will make it easier to assign values and types for the moves. It will also be easier in the long term.
I’m not good at Python so a fuller explanation would be appreciate.
How will it make it easier to assign values? Example?
 
I’m not good at Python so a fuller explanation would be appreciate.
How will it make it easier to assign values? Example?
Sorry, I don't really do python that much. Although awhile back I created a thread about a scramble generator using php and some others responded about using JavaScript and how to do that. I'd you are dead set on using python I don't really know how to help you. If you want to check out the thread about scramble generator with php/JavaScript it's right here:
 
Sorry, I don't really do python that much. Although awhile back I created a thread about a scramble generator using php and some others responded about using JavaScript and how to do that. I'd you are dead set on using python I don't really know how to help you. If you want to check out the thread about scramble generator with php/JavaScript it's right here:
Thanks!
I know a little C# and JavaScript.
 
You should use dictionaries instead of lists, it will make it easier to assign values and types for the moves. It will also be easier in the long term.
For a dictionary, you can write
Moves = {x:y, a:b, movetype:move, inverse:r'}, etc
, ... . This assigns a value for each variable, making it easy to access later and you can call it again when you need a specific type of move, like an inverse move or a double move.
 
I'm trying to make a cubers chat with integrations and timers and virtual cubes etc. stuck on the login system however as the php and HTML code doesn't run unless I put the php at the bottom, in which case the HTML runs, but the php is just written as plain text at the bottom. I'm using repl.it
Any troubleshooting help?
 
I'm trying to make a cubers chat with integrations and timers and virtual cubes etc. stuck on the login system however as the php and HTML code doesn't run unless I put the php at the bottom, in which case the HTML runs, but the php is just written as plain text at the bottom. I'm using repl.it
Any troubleshooting help?
You can just make a separate php file and download a program called xxamp which makes it that you can run a php file by itself. Then just create the login in the new php file and then just link the log in button to the new php file. Just make sure you have xxamp running. Also with xxamp you can run PHPmyadmin which is best for logins. Especially for php
 
You can just make a separate php file and download a program called xxamp which makes it that you can run a php file by itself. Then just create the login in the new php file and then just link the log in button to the new php file. Just make sure you have xxamp running. Also with xxamp you can run PHPmyadmin which is best for logins. Especially for php
is it for
 
I'm trying to make a cubers chat with integrations and timers and virtual cubes etc. stuck on the login system however as the php and HTML code doesn't run unless I put the php at the bottom, in which case the HTML runs, but the php is just written as plain text at the bottom. I'm using repl.it
Any troubleshooting help?
Here you have a chat

Code:
<iframe src="https://kiwiirc.com/client/irc.freenode.net/?nick=apajo|?#rubik" style="border:0; width:100%; height:450px;"></iframe>
 
Code:
<html>
  <head>
  </head>
<body>
   <iframe src="https://kiwiirc.com/client/irc.freenode.net/?nick=apajo|?#rubik" style="border:0; width:100%; height:450px;"></iframe>
</body>
</html>
What I meant was:
how does the website work and what does the writing mean? I don't speak that language
 
the web applet makes connection with an irc server this is a server that you can communicate like a chat.
The url just makes the applet and the last code i send is an example to put it on a html page. The first code with the iframe is you can just place it anywhere in the body of a website and you have a chat on your website like https://apajoooms.wixsite.com/speedcubing
 
Back
Top