Python Projects
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Python Projects
A Blue-Bot can be controlled from an Android phone or tablet, although
it only permits 45 degree turns.
https://www.tts-international.com/blue- ... 15269.html
-
The Valiant Roamer 2 allows turns of any amount from 1 degree upwards.
http://www.valiant-technology.com/uk/pa ... p?cat=8id1
- -
although they are both fairly expensive.
Blue-Bot €102, Roamer 2 €127
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Python Projects
ALL the Turtle graphics exercises can be performed with my NLCT stack:
- -
OBVIOUSLY those control buttons can be exchanged for others.
- -
OBVIOUSLY those control buttons can be exchanged for others.
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Python Projects
The second work sheet concerns itself with Turtle graphics (via Python) again.
I am going to skip that and move to: Level three: hangman (activity sheet):
- -
This introduces the concept of RANDOM, although in a way that slightly misses the mark to my mind
as RANDOM in computers involves numbers.
We can easily illustrate this in LiveCode while developing a Hangman program:
- -
I am going to skip that and move to: Level three: hangman (activity sheet):
- -
This introduces the concept of RANDOM, although in a way that slightly misses the mark to my mind
as RANDOM in computers involves numbers.
We can easily illustrate this in LiveCode while developing a Hangman program:
- -
Code: Select all
on mouseUp
put random(5) into RLINE
put line RLINE of fld "fWORDS" into fld "fRWORD"
end mouseUp
- Attachments
-
- Hangman.livecode.zip
- Here's the stack.
- (1.06 KiB) Downloaded 241 times
Last edited by richmond62 on Tue Nov 09, 2021 2:04 pm, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Python Projects
Now we need a "shadow" field:
- -
Obviously we now have to hide the field with the visible word.
- -
Code: Select all
on mouseUp
put empty into fld "fRWORD2"
put random(5) into RLINE
put line RLINE of fld "fWORDS" into fld "fRWORD"
put the number of chars in fld "fRWORD" into LETTERNUM
put 1 into COUNTUP
repeat until COUNTUP > LETTERNUM
put "-" after fld "fRWORD2"
add 1 to COUNTUP
end repeat
end mouseUp
- Attachments
-
- Hangman 2.livecode.zip
- Next step.
- (1.21 KiB) Downloaded 229 times
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Python Projects
It is now time to supply the pictorial element in a way so that each component
can be made visible each time our end-user guesses a letter incorrectly:
- -
Each component is a graphic object sequentially named r1 . . . r3.
can be made visible each time our end-user guesses a letter incorrectly:
- -
Each component is a graphic object sequentially named r1 . . . r3.
- Attachments
-
- Hangman 3.livecode.zip
- Here we go.
- (1.54 KiB) Downloaded 225 times
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Python Projects
We had better hide the 'gallows' graphics, so I have
popped this into the cardScript:
If you feel that set the visible might be a bit "complicated" for children
you could change the script to:
I tend to avoid HIDE as it does NOT indicate that things have a VISIBLE property.
popped this into the cardScript:
Code: Select all
on preOpenCard
put 1 into GALLOWS
repeat until GALLOWS > 13
set the visible of grc ("r" & GALLOWS) to false
add 1 to GALLOWS
end repeat
end preOpenCard
you could change the script to:
Code: Select all
n preOpenCard
put 1 into GALLOWS
repeat until GALLOWS > 13
hide grc ("r" & GALLOWS)
add 1 to GALLOWS
end repeat
end preOpenCard
Last edited by richmond62 on Wed Nov 10, 2021 9:26 am, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Python Projects
Let's run off some alphabetic tiles:
-
-
- Attachments
-
- Button Maker.livecode.zip
- Here it is.
- (1.22 KiB) Downloaded 239 times
Last edited by richmond62 on Wed Nov 10, 2021 9:26 am, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Python Projects
The letter buttons involve ridiculously convoluted logic . . .
. . . if anyone can come up with some simpler code that would be great.
- Attachments
-
- Hangman 4.livecode.zip
- Here's the stack.
- (124.03 KiB) Downloaded 237 times
-
- VIP Livecode Opensource Backer
- Posts: 327
- Joined: Sun Apr 15, 2012 1:17 am
- Location: USA
- Contact:
Re: Python Projects
Without looking at the logic or the code in detail, you could strip out the common code on each button and put it on the card or stack. Then on each button, call that common routine/command with the appropriate letter that is on the button.
Then you could easily play with the code to simplify it.
Then you could easily play with the code to simplify it.
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Python Projects
of course.you could strip out the common code on each button and put it on the card or stack
This would be a lesson for children at a later stage.
What is needed at the moment is some sort of simplfication of this:
Code: Select all
on mouseUp
put empty into fld "ST"
put 1 into CHEQUE
put fld "fRWORD" into LEX
repeat until char CHEQUE of LEX is empty
put (char CHEQUE of LEX) into fld "fVOX"
if fld "fVOX" contains "a" then
put "a" into char CHEQUE of fld "fRWORD2"
put "X" into fld "ST"
end if
add 1 to CHEQUE
end repeat
if fld "fRWORD2" contains "a" then
--do nix
else
put 1 into STICK
repeat until STICK > 13
if the vis of grc ("r" & STICK) is true then
--do nix
else
if fld "ST" is empty then
put "X" into fld "ST"
set the vis of grc ("r" & STICK) to true
end if
end if
add 1 to STICK
end repeat
end if
set the vis of me to false
if the vis of grc "r13" is true then
set the vis of img "dead" to true
end if
if fld "fRWORD2" contains "-" then
--do nix
else
set the vis of img "win" to true
end if
end mouseUp
some sort of key to the workings of my mind, may not best suit children who are trying to understand
what on earth is going on, or a teacher who has to explain it.
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Python Projects
Drawing a grid seems all a bit redundant given LiveCode's WYSIWYG GUI . . .
Given what that document shows why don't we just have a 3 by 3 grid of textFields?
- -
each textField contains this code:
Code: Select all
on mouseUp
if the shiftKey is down then
put "O" into me
else
put "X" into me
end if
end mouseUp
- Attachments
-
- Nowts & Crosses.livecode.zip
- Here we go.
- (7.75 KiB) Downloaded 227 times
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Python Projects
Here is where we see that LiveCode's in-built visual environment should
wins hands down over Python's "create everything from the utmost primitives"
approach:
- - -
wins hands down over Python's "create everything from the utmost primitives"
approach:
- - -
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Python Projects
While LiveCode's in-built visual environment allows us to leapfrog
some pretty tedious stuff, what it just does not do is stop us from
having to deal with the game mechanics of the game.
And that is how things should be, as pupils will learn far more from
the game mechanics than they will ever learn from teaching a computer to
draw a grid on-screen.
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Python Projects
The problem with the Nowts & Crosses stack is that one can replace an X or a O
with another right mouse click: this needs to be prevented:
-
-
The code has been modified in 2 ways:
1. It checks if the field is empty, and if it is NOT a symbol will NOT be entered.
2. It enters a red O or a black X.
- -
Even if nothing else this should prove how quickly in LiveCode, unlike in Python, we can arrive at a mockup/prototype
which can then be used to develop our program.
I can well remember "pissing about" with paper and pencil under the staircase in my house in Al Ain in 1989
trying to work out something because I was NOT able to pull up a quick-and-dirty visual thing on the screen.
-
with another right mouse click: this needs to be prevented:
-
Code: Select all
on mouseUp
if fld "f5" is empty then
if the shiftKey is down then
set the textColor of fld "f5" to red
put "O" into me
else
set the textColor of fld "f5" to black
put "X" into me
end if
end if
end mouseUp
The code has been modified in 2 ways:
1. It checks if the field is empty, and if it is NOT a symbol will NOT be entered.
2. It enters a red O or a black X.
- -
Even if nothing else this should prove how quickly in LiveCode, unlike in Python, we can arrive at a mockup/prototype
which can then be used to develop our program.
I can well remember "pissing about" with paper and pencil under the staircase in my house in Al Ain in 1989
trying to work out something because I was NOT able to pull up a quick-and-dirty visual thing on the screen.
-
- Attachments
-
- Nowts & Crosses 2.livecode.zip
- (7.92 KiB) Downloaded 236 times
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Python Projects
Here's my Master's degree thesis from 18 years ago that explores prototyping in LiveCode
(then called Runtime Revolution) extensively:
https://www.dropbox.com/s/aknlqyovmke61 ... f.zip?dl=0
(then called Runtime Revolution) extensively:
https://www.dropbox.com/s/aknlqyovmke61 ... f.zip?dl=0