Skip to main content

Orbitmagic

The "orbitmagic" library helps magicians model mathematical orbits. It is designed for magicians who know Python and lists. [Warning] Only defined mixes have an orbit!

Installation

To install the library, you can use pip:

pip install orbitmagic

Exposed Functions

Here is the list of functions exposed by the library:

is_pack(pack: list[int]) -> bool

Verifies whether a list of integers represents a valid deck of cards.

Arguments:

  • pack: a list of integers representing a deck of cards.

Returns:

  • True if the deck is valid, False otherwise.

is_init(pack: list[int]) -> bool

Verifies whether a list of integers represents the initial deck.

Arguments:

  • pack: a list of integers representing a deck of cards.

Returns:

  • True if the deck is the initial deck, False otherwise.

orbit(mix:list[int]) -> int

Calculates the number of orbits of a mix from a deck of cards.

Arguments:

  • mix: a list that represents a way of shuffling the cards.

Returns:

  • an integer representing the number of orbits of the mix.

mix(pack: list[int], mix_method: list[int]) -> list[int]

Shuffles a deck of cards according to a given shuffling method.

Arguments:

  • pack: a list of integers representing a deck of cards.
  • mix_method: a list representing a way of shuffling the cards.

Returns:

  • a list of integers representing the shuffled deck of cards.

reverse(mix_method: list[int]) -> list[int]

Reverses the mixing of a deck of cards according to a given mixing method.

Arguments:

  • mix_method: a list that represents a way to mix the cards.

Returns:

  • a list of integers representing a mixing that is the reverse of the given mixing.

cycle(mix_method: list[int], k: int) -> list[int]

Calculates the condition of the starting deck of cards mixed k times by the given mixing. (Also equivalent to mixing k times by the given mixing.)

Arguments:

  • mix_method: a list that represents a way to mix the cards.
  • k: number of iterations (can be negative).

Returns:

  • a list of integers representing the equivalent mixing.

rev_cycle(mix_method: list[int], k: int) -> list[int]

Similar to the cycle function, but instead of using mix_method, it cycles using reverse(mix_method).

Arguments:

  • mix_method: a list that represents a way to mix the cards.
  • k: number of iterations (can be negative).

Returns:

  • a list of integers representing the equivalent mixing.

all_cases(mix_method: list[int]) -> list[list[int]]

Calculates all iterations of the given mixing until the deck returns to the starting deck.

Arguments:

  • mix_method: a list that represents a way to mix the cards.

Returns:

  • a list of lists, with each element (a list of integers) representing an iteration of the given mixing.

find_mix(pack0: list[int], pack1: list[int]) -> list[int]

Computes a mix according to the conditions of the deck before and after the mix.

Arguments:

  • pack0:a list of integers representing a deck of cards before a mix.
  • pack1:a list of integers representing the deck of cards after the mix.

Returns:

  • a list of integers representing the mix.

pack_init(n: int) -> list[int]

Creates the initial deck of n cards.

Arguments:

  • n:an integer representing the total number of cards in the deck.

Returns:

  • a list of integers representing the initial deck of cards.

help()

Helps users to view all functions

Author

This library was created by JeongHan-Bae.

License

This project is licensed under the terms of the MIT license. See the LICENSE file for more details.

Contact Us

If you have any questions or feedback, feel free to contact us.

Download files

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

Source Distribution

orbitmagic-1.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

orbitmagic-1.0-cp311-cp311-win_amd64.whl (15.0 kB view details)

Uploaded CPython 3.11Windows x86-64

File details

Details for the file orbitmagic-1.0.tar.gz.

File metadata

  • Download URL: orbitmagic-1.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for orbitmagic-1.0.tar.gz
Algorithm Hash digest
SHA256 04dbe4a08c71cb63aa1bb3311b05338129680b133a4a000534adba770266af10
MD5 bb51802df72868da2f4fb4701b1c2cbf
BLAKE2b-256 05999cd1f42be9164b3c50027ebad2dc43829b5a155d05b2c1517addf97a5d7c

See more details on using hashes here.

File details

Details for the file orbitmagic-1.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: orbitmagic-1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for orbitmagic-1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 dbc87f8325e32c457e66f0b2944389ee79da3cf7ab94fd417dec2265e5555de2
MD5 7a8390352c5929a20b7704dea3deaba7
BLAKE2b-256 3c059c35b1a77bc1d496fe8f4f80974453bb17eff7f74458f7fe8b454cb6523e

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 Sentry Error logging StatusPage Status page