Skip to main content

Python module that simulates a Square-1 twisty puzzle

Project description

virtual-sq1

Python module that simulates a Square-1 twisty puzzle

Build Coverage Status PyPI - Python Version

Usage

Import and create Square1 object

Solved by default.

from virtual_sq1 import Square1


my_square_1 = Square1()

View Square1's current state

virtual_sq1 uses (almost) the same position notation as Jaap's Square-1 optimiser.

Don't know how to read it? Click here 🔗

my_square_1 = Square1()

print(my_square_1)
# A1B2C3D4-5E6F7G8H

Apply an algorithm to Square1

my_square_1 = Square1()

my_square_1.apply_alg("/ (3,0) / (-3,-3) / (0,3) /")

print(my_square_1)
# A1C3B2D4-5E7G6F8H

Apply a case to Square1

Changes the Square1's state so that the input algorithm brings it to its current state.

my_square_1 = Square1()

my_square_1.apply_alg("/ (3,0) / (1,0) / (0,-3) / (-1,0) / (-3,0) / (1,0) / (0,3) / (-1,0)", True)

print(my_square_1)
# A2B3C1D4-5E6F7G8H

The distinction between a "case" and an "algorithm" was made by Tyson Decker's puzzle-gen

Apply a specific state to Square1

my_square_1 = Square1()

my_square_1.apply_state("ABCDEF GH12345678 /")

print(my_square_1)
# ABCDEF/GH12345678

Apply a individual moves to Square1

Not sure why you'd do this when you could just use apply_alg but... it's an option.

my_square_1 = Square1()

my_square_1.slash()  # a slice/slash move
my_square_1.top.turn(-3)  # turn the top layer -3
my_square_1.bottom.turn(3)  # turn the bottom layer 3
my_square_1.slash()  # a slice/slash move
my_square_1.top.turn(3)  # turn the top layer 3
my_square_1.bottom.turn(-3)  # turn the bottom layer -3
my_square_1.slash()  # a slice/slash move

print(my_square_1)
# C3B2A1D4/5E8H7G6F

Credits

This module was highly inspired by the following:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

virtual_sq1-1.0.0.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

virtual_sq1-1.0.0-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file virtual_sq1-1.0.0.tar.gz.

File metadata

  • Download URL: virtual_sq1-1.0.0.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for virtual_sq1-1.0.0.tar.gz
Algorithm Hash digest
SHA256 97a097368b2aea036cf18a42aac7c5385c211e08374bde747553cc48289aa38b
MD5 d81303afeb44cf7d11e125fbb53c9c15
BLAKE2b-256 c30ecdd734faff52f5a9fdb6346938b770b3df89f253642321b7bfba61548d26

See more details on using hashes here.

File details

Details for the file virtual_sq1-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: virtual_sq1-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for virtual_sq1-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 91255239f74b9b4a2dbe1b069605b0a4a31b89cbc301803f8bd7f47f15a51001
MD5 1b509dc2e44c923bf67e35100203622c
BLAKE2b-256 393f625acc35a2dfa517d3bd29b84c8225288d503e12f15dd295e974c6689c57

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page