Search found 2225 matches

by [-hh]
Tue Feb 18, 2020 3:52 pm
Forum: Converting to LiveCode
Topic: Sudoku Code [was: python code I'm trying to copy over to LC]
Replies: 22
Views: 805

Re: Sudoku Code [was: python code I'm trying to copy over to LC]

Your code do "var g=" & sudoku4JS & ";var r=solve_sudoku(g);liveCode.JSresult(g," & T0 & ");" in widget "Browser" fails, because javascript expects T0 (which is undefined) to be a variable. Just write do "var g=" & sudoku4JS & ";var r=solve_sudoku(g);liveCode.JSresult(g,'" & T0 & "');" in widget "Br...
by [-hh]
Tue Feb 18, 2020 12:16 pm
Forum: Converting to LiveCode
Topic: Sudoku Code [was: python code I'm trying to copy over to LC]
Replies: 22
Views: 805

Re: Python code I'm trying to copy over to LC

This has nothing to do with javascript: Alerts on mobile are different from alerts on desktop. To have a unique code for the platforms you could use (instead of "answer ..."): put tLevel & "-Puzzle solved." into tA do "alert('" &tA& "');" in widget "browser" This javascript dialog works also with a ...
by [-hh]
Thu Feb 13, 2020 3:57 pm
Forum: Converting to LiveCode
Topic: Sudoku Code [was: python code I'm trying to copy over to LC]
Replies: 22
Views: 805

Re: Python code I'm trying to copy over to LC

Here are some more sudokus for testing, see https://attractivechaos.github.io/plb/kudoku.html . "Hardest 20" 000000000000003085001020000000507000004000100090000000500000073002010000000040009 000000012000000003002300400001800005060070800000009000008500000900040500470006000 020050700400100006800003000...
by [-hh]
Tue Feb 11, 2020 3:29 pm
Forum: Converting to LiveCode
Topic: Sudoku Code [was: python code I'm trying to copy over to LC]
Replies: 22
Views: 805

Re: Python code I'm trying to copy over to LC

Thierry, this is a really fine optimization you have worked out for that. On the other hand, the dancing links algorithm X (DLX) by D. Knuth is known to be very fast for solving even difficult puzzles. Find enclosed a stack that does a JS implementation of that algorithm in JavaScript (via a browser...
by [-hh]
Mon Feb 10, 2020 9:00 pm
Forum: Rich Media
Topic: Fast method for counting RGB values of an image
Replies: 18
Views: 1608

Re: Fast method for counting RGB values of an image

Related to images LCB is at least as fast as LCS when drawing rectangular blocks of images and is faster with deliberate affine transforms of images. Moreover LCB has features that you don't have in LCS, e.g. (sub-pixel) drawing of affine transformed pathes, especially SVG Pathes. LCB is still far a...
by [-hh]
Mon Feb 10, 2020 4:19 am
Forum: Rich Media
Topic: Fast method for counting RGB values of an image
Replies: 18
Views: 1608

Re: Fast method for counting RGB values of an image

With accessing single bytes of imageData it is even slower than LC Script...
by [-hh]
Sun Feb 09, 2020 11:04 pm
Forum: Rich Media
Topic: Fast method for counting RGB values of an image
Replies: 18
Views: 1608

Re: Fast method for counting RGB values of an image

LiveCode's byte-version is still 3-5 times slower than the (for that purpose non-optimized) JS version what is nevertheless a "bump" compared to the char-version. Here is the script of a button (pure LCScript) you can use in my imageStatistics-stack for comparison (yields the same output using 256 b...
by [-hh]
Sun Feb 09, 2020 8:25 pm
Forum: Rich Media
Topic: Fast method for counting RGB values of an image
Replies: 18
Views: 1608

Re: Fast method for counting RGB values of an image

The stacks were (nearly) all there, some since years. The problems started after the 'server change' last year. The first limit was for up-/download stacks of size > 2-3 MByte. I reported to support, Robin removed that limit. The limit changed again to (currently) stacks of size > 5-6 MByte. Reporte...
by [-hh]
Sun Feb 09, 2020 7:15 pm
Forum: Rich Media
Topic: Fast method for counting RGB values of an image
Replies: 18
Views: 1608

Re: Fast method for counting RGB values of an image

"Sample Stacks"/livecodeshare/revOnline doesn't work for me any more (impossible to upload/download large stacks) since several months. Thus I removed all my 64 stacks from there.
So: Sorry, but given time, in a few weeks, I'll make an own download page with some of these.
by [-hh]
Sat Feb 08, 2020 10:37 pm
Forum: Talking LiveCode
Topic: Removing a particular text style from a field
Replies: 15
Views: 451

Re: Removing a particular text style from a field

These are the results of tests with severals of my use cases: If you use textstyle only then certainly the array method is faster than using the htmltext (or the ordinary styledText). But if you do also other text styling that textstyle can't do (and have already the htmltext/styledText in a variabl...
by [-hh]
Sat Feb 08, 2020 6:51 pm
Forum: Talking LiveCode
Topic: Weird issue making use of Behaviour Scripts
Replies: 9
Views: 365

Re: Weird issue making use of Behaviour Scripts

Moreover you could try to use "call" instead of "send" (what changes the context).
by [-hh]
Sat Feb 08, 2020 5:54 pm
Forum: Talking LiveCode
Topic: Removing a particular text style from a field
Replies: 15
Views: 451

Re: Removing a particular text style from a field

Now it is clear (for me) what you really want.
The following could be done also with other tags as <b> or <i> instead of <box>.

Code: Select all

-- removes all box-textstyle (and only that) from a field
set htmltext of fld X to replaceText(the htmltext of fld X,"<\/?box>","")
by [-hh]
Sat Feb 08, 2020 2:43 pm
Forum: Talking LiveCode
Topic: Removing a particular text style from a field
Replies: 15
Views: 451

Re: Removing a particular text style from a field

-- ON set the textstyle of char x to y of fld "name" to "box" -- OFF set the textstyle of char x to y of fld "name" to empty To preserve other textstyles when removing, you could also put the effective textstyle of <chunk> into <variable>. Then filter items of <variable> without "box" and then set ...
by [-hh]
Fri Feb 07, 2020 9:25 pm
Forum: Converting to LiveCode
Topic: Sudoku Code [was: python code I'm trying to copy over to LC]
Replies: 22
Views: 805

Re: Python code I'm trying to copy over to LC

Here is for your comparisons a complete "brute-force-solver" for 9x9 sudokus (=the method you tried to code from python) in 65 lines, the essential solver in 25 lines. It is implemented into LC based on https://samirhodzic.github.io/sudoku-solver-js/ (which is more than 100 times faster than Livecod...
by [-hh]
Fri Feb 07, 2020 7:18 pm
Forum: Converting to LiveCode
Topic: Sudoku Code [was: python code I'm trying to copy over to LC]
Replies: 22
Views: 805

Re: Python code I'm trying to copy over to LC

Just for reference: Jim Hurley wrote a Sudoku application using LiveCode http://jamesphurley.com/Sudoku.htm ... but on the website I couldn't see anything relating to it being able to completely solve a sudoku? Can it? It is a fine exercise/learning step to implement one of the many solution tools ...

Go to advanced search