Toasted on a grid iron

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9356
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Toasted on a grid iron

Post by richmond62 » Fri Jul 12, 2019 8:28 pm

I was fairly cheesed-off today when someone suggested that to generate a square, random map
would be long and difficult, if not impossible in LiveCode.
-
RobotTest1.png
Attachments
Robot Test1.livecode.zip
Here's the stack.
(3.87 KiB) Downloaded 183 times

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9645
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Toasted on a grid iron

Post by dunbarx » Fri Jul 12, 2019 9:01 pm

Richmond.

I agree, LC eats this for lunch.

But for dinner, you need to make the finished product symmetrical about the diagonals, or you do not get a crossword blank slate.

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9356
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Toasted on a grid iron

Post by richmond62 » Fri Jul 12, 2019 9:13 pm

Why does a crossword blank have to be symmetrical about a diagonal?

The story behind this stack is that, today, as I was leaving my school, having taught 2 classes about LiveCode my intern, who is halfway through her bachelor's degree at Plovdiv University in Computer Programming started making objections when I suggested one of the best ways to get to grips with LiveCode was to duplicate projects given to her by her lecturers at the Uni' for C++, C#, Java and so on in LiveCode.

She then told me about a machine-learning 'thing' where a "robot" has to traverse a square grid where 25% of the squares are 'traps', and the robot should 'learn' by its mistakes . . . and said she didn't think that was possible in LiveCode.

So this grid generator is the start of my attempt to go "nyah, nyah, nyah" to her. 8)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9645
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Toasted on a grid iron

Post by dunbarx » Fri Jul 12, 2019 11:14 pm

Richmond.

Go get 'em.

It is not a law, but at least here crosswords are always so constructed. That is not to say that intentional oddities do not exist.

For your purposes, it is not pertinent.

Craig

kdjanz
Posts: 300
Joined: Fri Dec 09, 2011 12:12 pm
Location: Fort Saskatchewan, AB Canada

Re: Toasted on a grid iron

Post by kdjanz » Wed May 20, 2020 7:03 am

Your mention of the machine learning problem in these old posts sparked my interest so I decided to try it out as a beginners project to stimulate my old brain. So here is what I came up with:
Maze.jpg
The maze can be resized but the mouse always starts at the top left and the cheese is always at the bottom right. The 25% barriers change each time. I decided that the mouse can see 2 squares ahead but could smell that cheese down and to the right, so my decision weightings each move favoured those directions unless the mouse was caught in a dead end and had to back track. The mouse can move on diagonals because it can squeeze through the gaps between the barriers.

You can show your intern that LiveCode isn't entirely a 90 pound weakling even in the machine learning area even in the hands of a beginner!

Kelly

ps The grid took 12 lines of code and the barriers took another 14. Not difficult at all. The stack overall has 340 lines of code - most of it in the search and weighting behaviours.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9356
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Toasted on a grid iron

Post by richmond62 » Wed May 20, 2020 10:24 am

Wow; dunbar, kdjanz's new post made me remember your lovely description of me:
intentional oddities
8)

Outwith the USA we are not quite so worried about symmetry, and, while I'm here I cannot resist a wee jab at the USA:

Frankly, your current President is looking increasingly asymmetrical. :D

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9356
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Toasted on a grid iron

Post by richmond62 » Wed May 20, 2020 10:28 am

Machine learning is perfectly doable in Livecode; after all, ALL that machine learning really is
is pushing a choice decision that has been taken before over one that hasn't.

If the cat prefers "Super Kitten" for breakfast, having offered her the choice of "Fun Cat" & "Super Kitten" yesterday, I probably
will just plonk "Super Kitten" in her bowl and not bother to give her a choice again between that and "Fun Cat" again.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Toasted on a grid iron

Post by FourthWorld » Wed May 20, 2020 2:01 pm

richmond62 wrote:
Wed May 20, 2020 10:28 am
Machine learning is perfectly doable in Livecode; after all, ALL that machine learning really is
is pushing a choice decision that has been taken before over one that hasn't.
Back in the '90s I made a maze learner in SuperCard. It was similar in some respects to what you described: it would keep track of branches it went down, and if it found a dead end it would back up to the nearest juncture and try another path, avoiding known deadends as it went.

You're right: it wasn't much code. Nor very sophisticated. Just text lists of graphic object numbers, updated as it goes. IIRC I even had a window titled "Brain" where you could watch the lists update on real time.

I'm not sure where that project file is, but I'm fairly certain it's in my archives. I could pull the scripts out easily enough, but I'm not sure my copy of SuperCard still runs, so I'd probably have to rebuild it. And that wouldn't be so bad, because there are enough differences between old SC and new LC that it would likely need some revision, and I generally don't like any code I've written more than ten years ago anyway.

All that's a long-winded way is saying I'm not sure if/when I'll have time to post a usable version, and it doesn't really matter; the main point of this reply is just to offer encouragement for the task. When the task isn't exactly climate modeling, your friend is indeed wrong. These things are a snap to build in a high-level GUI like LiveCode.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

kdjanz
Posts: 300
Joined: Fri Dec 09, 2011 12:12 pm
Location: Fort Saskatchewan, AB Canada

Re: Toasted on a grid iron

Post by kdjanz » Wed May 20, 2020 4:21 pm

These things are a snap to build in a high-level GUI like LiveCode.
It was a significant learning experience for me! I ended up re-coding it 3X as I changed the data structure and logic. But the whole goal of LiveCode for me is to stretch the brain and keep it active- success for this project!

Don’t know what is going to be next.

Kelly

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”