This release is a pre-release and may not be stable for production use.
LightLogo: A lightweight Logo-based agent-based simulation toolkit
LightLogo (LLogo) aims to provide a simple, lightweight, and powerful 3D agent-based simulation toolkit for educational and scientific research.
Installation
pip install LightLogo
Features
-
Redesigned turtle and more agent types that support 3D contexts;
-
Easy integration with Python and its massive Python libraries to enhance experience;
-
Following the basic principles of Logo language but with significant improvement.
Usage
Example 1: Playground
from lightlogo.play3D import *
clearscreen()
reset()
setxyz(5,-5,0)
pendown()
repeat(8,[
left(45),
fd(5)
])
penup()
repeat_play()
Example 2: Full-scale agent-based simulation
from lightlogo.world3D import *
if __name__=="__main__":
# Step 1: Create a 3D world in LightLogo
w3d=world3D(x_range=[-10,10],y_range=[-10,10],z_range=[-10,10],title="Demo 2",)
w3d.create(style="seaborn-ticks")
# Step 2: Define an initialization function
def setup(world):
# create turtles
N=1
list_turtles=[
turtle3D(xyz=[0,0,0],color='red',shape='.',size=10) for _ in range(N)
]
list_turtles[0].left(45)
world.turtles(list_turtles)
# Step 3: Define a step function for each frame to update
def go(frame,world):
list_turtles=world.turtles()
print(f"Step {frame}\tTurtles Count: {len(list_turtles)}")
# turtle 1
turtle1=list_turtles[0]
if frame==0:
turtle1.pendown()
turtle1.forward(3)
# turtle1.setxrotate(45)
# turtle1.right(60)
# turtle1.up(45)
# turtle1.rollback(30)
# turtle1.setxrotate(45)
# turtle1.setxrotate(90)
if frame!=0 and frame % 1 == 0 and frame < 40:
turtle1.left(30)
t1=text3D(xyz=turtle1.pos(),color='green',text=f"p{frame}")
world.texts().append(t1)
if frame >=40:
turtle1.penup()
if frame>=10:
turtle1.hide()
if frame>=20:
turtle1.show()
list_turtles[0]=turtle1
world.turtles(list_turtles)
# Step 4 (final step): Run the simulation
w3d.run(go=go,setup=setup,interval=500,frames=1000,repeat=True)
Simulation screenshot
License
The LightLogo project uses BSD 3-Clause License.
Metadata
Release files for LightLogo 0.0.1a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| LightLogo-0.0.1a1.tar.gz | 80.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| LightLogo-0.0.1a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 163.8 kB
Release files / LightLogo-0.0.1a1.tar.gz
| Download URL | LightLogo-0.0.1a1.tar.gz |
|---|---|
| Size | 80.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d15a2bf1ffa32e7e16ee09a2a6c886f7568744c1619d5e9e7088772228d147a
|
|
BLAKE2b-256 checksum How to use checksums |
5059299e3743496ca319953a17718ecfc176fc29a85e9ed0518706171e47881c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11
|
Release files / LightLogo-0.0.1a1-py3-none-any.whl
| Download URL | LightLogo-0.0.1a1-py3-none-any.whl |
|---|---|
| Size | 83.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d63d3340f4f63eab9cf92b13f4d82db47e71b70d7dc0226c4c9ded513715d256
|
|
BLAKE2b-256 checksum How to use checksums |
99b0dbbae7394ee47a58dc09e44c9ed80fec71b151190498243cd264b8f87b95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11
|