Re: Python Projects
Posted: Wed Nov 10, 2021 8:33 am
Yes, we have to find a winner, but with LiveCode we can do that in a way that
more closely resembles real life to the way it is done in Python.
Questions and answers about the LiveCode platform.
https://forums.livecode.com/
Code: Select all
on mouseUp
if fld "f1" is empty then
if the shiftKey is down then
set the textColor of fld "f1" to red
put "O" into me
else
set the textColor of fld "f1" to black
put "X" into me
end if
add 1 to fld "fFILLED"
--
if fld "fFILLED" contains "9" then
send "mouseUp" to button "WIN"
end if
--
end if
end mouseUp
Code: Select all
add 1 to fld "fFILLED"
Code: Select all
if fld "fFILLED" contains "9" then
send "mouseUp" to button "WIN"
end if
Code: Select all
on mouseUp
--the winner will be worked out here
end mouseUp
Code: Select all
on mouseUp
wait 30 ticks
--X--
if fld "f5" contains "X" then
if fld "f4" contains "X" and fld "f6" contains "X" then
set the vis of img "XWIN" to true
end if
if fld "f2" contains "X" and fld "f8" contains "X" then
set the vis of img "XWIN" to true
end if
if fld "f1" contains "X" and fld "f9" contains "X" then
set the vis of img "XWIN" to true
end if
if fld "f3" contains "X" and fld "f3" contains "X" then
set the vis of img "XWIN" to true
end if
end if
---
if fld "f1" contains "X" then
if fld "f2" contains "X" and fld "f3" contains "X" then
set the vis of img "XWIN" to true
end if
if fld "f4" contains "X" and fld "f7" contains "X" then
set the vis of img "XWIN" to true
end if
end if
---
if fld "f9" contains "X" then
if fld "f3" contains "X" and fld "f6" contains "X" then
set the vis of img "XWIN" to true
end if
if fld "f7" contains "X" and fld "f8" contains "X" then
set the vis of img "XWIN" to true
end if
end if
--O--
if fld "f5" contains "O" then
if fld "f4" contains "O" and fld "f6" contains "O" then
set the vis of img "OWIN" to true
end if
if fld "f2" contains "O" and fld "f8" contains "O" then
set the vis of img "OWIN" to true
end if
if fld "f1" contains "O" and fld "f9" contains "O" then
set the vis of img "OWIN" to true
end if
if fld "f3" contains "O" and fld "f3" contains "O" then
set the vis of img "OWIN" to true
end if
end if
---
if fld "f1" contains "O" then
if fld "f2" contains "O" and fld "f3" contains "O" then
set the vis of img "OWIN" to true
end if
if fld "f4" contains "O" and fld "f7" contains "O" then
set the vis of img "OWIN" to true
end if
end if
---
if fld "f9" contains "O" then
if fld "f3" contains "O" and fld "f6" contains "O" then
set the vis of img "OWIN" to true
end if
if fld "f7" contains "O" and fld "f8" contains "O" then
set the vis of img "OWIN" to true
end if
end if
end mouseUp
Code: Select all
on mouseUp
put 1 into CELL
put 0 into STOPPER
repeat until CELL > 9
put random(9) into RANDY
if STOPPER contains 0 then
if fld ("f" & RANDY) is empty then
set the textColor of fld ("f" & RANDY) to red
put "O" into fld ("f" & RANDY)
put 256 into STOPPER
end if
end if
add 1 to CELL
end repeat
end mouseUp
Code: Select all
on mouseUp
if fld "f3" is empty then
set the textColor of fld "f3" to black
put "X" into me
end if
--
send "mouseUp" to button "MACHINE PLAY"
--
send "mouseUp" to button "WIN"
--
end mouseUp
NOT, frankly, that that should stop us.Add the Rudolph sprite to the project (use the resources/Rudolph.png
file)
Code: Select all
on mouseDown
grab me
end mouseDown
Indeed, but you have to start somewhere, and preferably somewhere that has a shallower learning curveAnd outside of our little corner of the world, most programmers are polyglots.
I have found that children (9-12) have no obvious problems moving from BBC BASIC to LiveCode or the otherthe commonalities of C-style OOP languages
It would seem the more useful question for addressing LC as a bridge from Scratch to anything else is:richmond62 wrote: ↑Wed Nov 10, 2021 8:14 pmI have found that children (9-12) have no obvious problems moving from BBC BASIC to LiveCode or the other
way around, yet they are not that similar.