Skip to main content

Python implementation of the JavaScript package 'tetris-fumen'

Project description

py-fumen-py

More Python-ish Python implementation of Knewjade's tetris-fumen

Original project: hsohliyt105's py-fumen

Installation

python3 -m pip install py-fumen-py

Usage

from py_fumen_py import *

Module

  • bold names are automatically imported with from py_fumen_py import *
Name Description Importable Names
action Codec for action in a fumen string Action, ActionCodec
comment Codec for comment in a fumen string CommentCodec
constant Constants used in the project FieldConstants, FieldConstants110, FumenStringConstants
field Playing field object Field
fumen_buffer Buffer objects for saved data FumenBuffer, FumenBufferReader, FumenBufferWriter
fumen_codec The Fumen codec decode, encode
js_escape escape() ported from JavaScript escape, unescape, escaped_compare
operation Tetrimino placement object Mino, Rotation, Operation
page Page object Flags, Refs, Page
quiz Quiz object Quiz

Example

  • Decoding
from py_fumen_py import *

pages = decode('v115@9gQ4EeAtBewhR4CeBtBewhg0Q4CeAtglRpwhi0Aeil?RpwhJeAgWSANxiSASowNE1oo2AzyBUAT5AAA')

for i, page in enumerate(pages):
	print(i)
	print(page.field)
  • Encoding
from py_fumen_py import *

field = Field(
	field='\n'.join([
		'S_____Z__I',
		'SS___ZZ__I',
		'JS___ZLOOI',
		'JJJ_LLLOOI',
	]),
	garbage='__________'
)
pages = [Page(
	field=field,
	operation=None,
	comment='MKO you say?',
	flags=Flags(),
	refs=Refs())
]
print(encode(pages))

Difference Compared with tetris-fumen and py-fumen

  • Action encoding and decoding are moved to action
  • Comment encoding and decoding are moved to comment
  • Added FieldConstants110 to constant to accomodate for Fumen version 110
  • decoder and encoder are combined into one fumen-codec module
  • field and inner_field are combined into one field module
  • Action, comment and field reading/writing are moved to fumen_buffer
  • Placement tetrimino enum objects are moved to operation
  • quiz works completely differently (based on this editor instead of tetris-fumen)

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

py_fumen_py-0.0.10.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

py_fumen_py-0.0.10-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file py_fumen_py-0.0.10.tar.gz.

File metadata

  • Download URL: py_fumen_py-0.0.10.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for py_fumen_py-0.0.10.tar.gz
Algorithm Hash digest
SHA256 102cf380ddb325aa98f271a0c5f8112844c1fbfeb49660de9f024dbaf1f85307
MD5 5b03aa3709009095aa01e86acc0d1ce2
BLAKE2b-256 2226b572d26ee0798ebeffe52aeab6adda42200089b458e37c323baf320fe8b9

See more details on using hashes here.

File details

Details for the file py_fumen_py-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: py_fumen_py-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for py_fumen_py-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 440b99d7dd9ae38a73c4cd7ce0e321080c7d6aa8f2a48cd4f3b18f980e04bb13
MD5 83af920a31b9b2e8ef92639f410e96c7
BLAKE2b-256 2a29d0f66311053988f3d257f4f10c10fba87b3007031b9c51f97b8ca58c111e

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