a script for simulating a object with a direction that can move in said direction
Project description
https://github.com/XKMR/PythonMovingBot
PythonMovingBot
this is a script for simulating a object with a direction that can move in said direction
demo:
#this is a demo program
try:
while(True):
smturn("right")
print(displayCurrentPlace(currentX, currentY, currentDirection))
sleep(0.5)
for i in range(11):
smforward(1)
print(displayCurrentPlace(currentX, currentY, currentDirection))
sleep(0.1)
except KeyboardInterrupt:
print("X: ",currentX," Y: ",currentY)
print("pointing at ", currentDirection)
functions:
turn(): turnes the object by 90 degrees clockwise or counterclockwise arguments should be: "CC/CW", the current direction returns: the new direction ("up" , "down" , "left" , "right")
forward():
adds or subtracts an amount based on the inputed steps to/from X and Y (moving the object in the direction that is's looking in) arguments: the current X, the current Y, the current direction, a number of steps returns: the new x,y
smturn():
simplifies the turn command by removing the need for inputing the current direction requires the turn() function to work, requires a variable named "currentDirection" to work arguments: "left"/"right" variables required to work: currentDirction functions required to work: turn() returns: 0
smforward():
simplifies the turn command by removing the need for inputing anything other than the amount of steps that is going to be taken. arguments: int variables required to work: currentX, currentX, currentDirection functions required to work: forward() returns: 0
displayCurrentPlace():
makes a 20x20 "screen" that will display the place and direction of the object. note that this needs some improvements arguments: variables needed to work: currentX, currentX, currentDirection returns: 0
variables: currentX: the current position of the object on the X axis currentY: the current position of the object on the Y axis currentDirection: the current direction of the object ("up","down","left","right")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file MovingBot-0.0.1.tar.gz
.
File metadata
- Download URL: MovingBot-0.0.1.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60ac0e351e3391b446fe7fc29ec8e873d2c08cef6dde2c7747df8fd4e991dc4e |
|
MD5 | e25fecc70d0b9a189cc132d0c67ecfba |
|
BLAKE2b-256 | 14aab95e81cb77b3829a7d64c15ffbe37b4ef1e5fd0fe2b9367dff8633aa779f |
Provenance
File details
Details for the file MovingBot-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: MovingBot-0.0.1-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9cef92ecb70f671bb0860626c62a0476abfe827063c66a22a216a9a18fbe5c1 |
|
MD5 | 5793fc628676bca73125197d14ce49e9 |
|
BLAKE2b-256 | 69e759b875f01445587905d734ee6eae16384026d9e5be32225358a6e6ad869f |