Recent Posts

Pages: [1] 2 3 ... 10
1
Scripting Languages / Re: Quick Basic Efficiency Assistance
« Last post by Reyth on February 15, 2017, 07:35:02 AM »
I see this post was read 8 times.  I entered my hydro-powered meditation chamber this morning (the shower) thinking about this problem.  The solution instantly came to me!  Random was no longer my friend!  Why not just dispense with the array and output all combinations directly to a file?  I then reasoned at the computer that I could sort out the "shadows" by simply insuring that at least 1 number remains below 7.

Here is the code that resulted from my hydro meditation:

5 OPEN "6_Output_Test.txt" FOR OUTPUT AS #1
10 FOR i = 1 TO 12: FOR j = 1 TO 12: FOR k = 1 TO 12: FOR l = 1 TO 12: FOR m = 1 TO 12: FOR n = 1 TO 12

      20 IF i = j OR i = k OR i = l OR i = m OR i = n THEN 50
      21 IF j = k OR j = l OR j = m OR j = n THEN 50 'advance loop
      22 IF k = l OR k = m OR k = n THEN 50 'advance loop
      23 IF l = m OR l = n THEN 50 'advance loop
      24 IF m = n THEN 50 'advance loop

      40 PRINT #1, i, j, k, l, m, n: c = c + 1: LOCATE 1, 1: PRINT c

50 NEXT n, m, l, k, j, i: CLOSE #1

60 OPEN "6_output_Test.txt" FOR INPUT AS #1
70 OPEN "6_Output_Sort_Test.txt" FOR OUTPUT AS #2

80 FOR i = 1 TO 12: FOR j = 1 TO 12: FOR k = 1 TO 12: FOR l = 1 TO 12: FOR m = 1 TO 12: FOR n = 1 TO 12
      90 INPUT #1, a, b, c, d, e, f
      100 IF a < 7 OR b < 7 OR c < 7 OR d < 7 OR e < 7 OR f < 7 THEN PRINT #2, a, b, c, d, e, f: cc = cc + 1: LOCATE 1, 1: PRINT cc
110 NEXT n, m, l, k, j, i

WARNING: This code will generate a "read beyond file end" error upon completion.  Just ignore it and close out; all the data is in the file.

664561 duplicate free combinations are now in my possession!  I am ALL POWERFUL!!  MUWAHAHAAHAHAHAAHAHAAH!
2
Scripting Languages / Quick Basic Efficiency Assistance
« Last post by Reyth on February 14, 2017, 09:21:45 PM »
5 DIM trp(18000, 6): PRINT TIME$
10 RANDOMIZE TIMER
20 r = INT(RND * 12) + 1: s = INT(RND * 12) + 1: t = INT(RND * 12) + 1
30 u = INT(RND * 12) + 1: v = INT(RND * 12) + 1: w = INT(RND * 12) + 1

40 IF r = s OR r = t OR r = u OR r = v OR r = w THEN 20
50 IF s = t OR s = u OR s = v OR s = w THEN 20
60 IF t = u OR t = v OR t = w THEN 20
70 IF u = v OR u = w THEN 20
80 IF v = w THEN 20

90 ef = 0: FOR i = 1 TO 18000: IF ef <> 0 THEN GOTO 110 'advance loop _LIMIT (4096000):
 100 IF trp(i, 1) = 0 THEN ef = i
110 NEXT i

120 IF ef = 0 THEN 140 'process existing selections for opposites

130 trp(ef, 1) = r: trp(ef, 2) = s: trp(ef, 3) = t: trp(ef, 4) = u: trp(ef, 5) = v: trp(ef, 6) = w: GOTO 20

140 'process selections for duplicates
150 c = 0: dup = 0: LOCATE 2, 1: PRINT "A"; TIME$: FOR i = cl TO 17999: FOR j = 1 TO 18000: ' _LIMIT (16384000)
  155 IF i = j OR c <> 0 THEN 235
  160 IF trp(i, 1) = trp(j, 1) OR trp(i, 1) = trp(j, 2) OR trp(i, 1) = trp(j, 3) OR trp(i, 1) = trp(j, 4) OR trp(i, 1) = trp(j, 5) OR trp(i, 1) = trp(j, 6) THEN dup = dup + 1
  170 IF trp(i, 2) = trp(j, 1) OR trp(i, 2) = trp(j, 2) OR trp(i, 2) = trp(j, 3) OR trp(i, 2) = trp(j, 4) OR trp(i, 2) = trp(j, 5) OR trp(i, 2) = trp(j, 6) THEN dup = dup + 1
  180 IF trp(i, 3) = trp(j, 1) OR trp(i, 3) = trp(j, 2) OR trp(i, 3) = trp(j, 3) OR trp(i, 3) = trp(j, 4) OR trp(i, 3) = trp(j, 5) OR trp(i, 3) = trp(j, 6) THEN dup = dup + 1
  190 IF trp(i, 4) = trp(j, 1) OR trp(i, 4) = trp(j, 2) OR trp(i, 4) = trp(j, 3) OR trp(i, 4) = trp(j, 4) OR trp(i, 4) = trp(j, 5) OR trp(i, 4) = trp(j, 6) THEN dup = dup + 1
  200 IF trp(i, 5) = trp(j, 1) OR trp(i, 5) = trp(j, 2) OR trp(i, 5) = trp(j, 3) OR trp(i, 5) = trp(j, 4) OR trp(i, 5) = trp(j, 5) OR trp(i, 5) = trp(j, 6) THEN dup = dup + 1
  210 IF trp(i, 6) = trp(j, 1) OR trp(i, 6) = trp(j, 2) OR trp(i, 6) = trp(j, 3) OR trp(i, 6) = trp(j, 4) OR trp(i, 6) = trp(j, 5) OR trp(i, 6) = trp(j, 6) THEN dup = dup + 1
  230 IF dup = 6 THEN trp(j, 1) = 0: c = i: cl = i - 1: IF cl < 1 THEN cl = 1
235 dup = 0: NEXT j, i: IF c <> 0 THEN LOCATE 3, 1: PRINT "                  ": LOCATE 3, 1: PRINT c; TIME$: GOTO 20
237 cl = 1


240 'process selections for opposites
250 sf = 0: LOCATE 3, 1: PRINT "B"; TIME$: FOR i = cl TO 17999: FOR j = i TO 18000: ' _LIMIT (16384000)
  255 IF c <> 0 THEN 330
  260 IF trp(i, 1) = trp(j, 1) OR trp(i, 1) = trp(j, 2) OR trp(i, 1) = trp(j, 3) OR trp(i, 1) = trp(j, 4) OR trp(i, 1) = trp(j, 5) OR trp(i, 1) = trp(j, 6) THEN 330 'advance loop
  270 IF trp(i, 2) = trp(j, 1) OR trp(i, 2) = trp(j, 2) OR trp(i, 2) = trp(j, 3) OR trp(i, 2) = trp(j, 4) OR trp(i, 2) = trp(j, 5) OR trp(i, 2) = trp(j, 6) THEN 330 'advance loop
  280 IF trp(i, 3) = trp(j, 1) OR trp(i, 3) = trp(j, 2) OR trp(i, 3) = trp(j, 3) OR trp(i, 3) = trp(j, 4) OR trp(i, 3) = trp(j, 5) OR trp(i, 3) = trp(j, 6) THEN 230 'advance loop
  290 IF trp(i, 4) = trp(j, 1) OR trp(i, 4) = trp(j, 2) OR trp(i, 4) = trp(j, 3) OR trp(i, 4) = trp(j, 4) OR trp(i, 4) = trp(j, 5) OR trp(i, 4) = trp(j, 6) THEN 330 'advance loop
  300 IF trp(i, 5) = trp(j, 1) OR trp(i, 5) = trp(j, 2) OR trp(i, 5) = trp(j, 3) OR trp(i, 5) = trp(j, 4) OR trp(i, 5) = trp(j, 5) OR trp(i, 5) = trp(j, 6) THEN 330 'advance loop
  310 IF trp(i, 6) = trp(j, 1) OR trp(i, 6) = trp(j, 2) OR trp(i, 6) = trp(j, 3) OR trp(i, 6) = trp(j, 4) OR trp(i, 6) = trp(j, 5) OR trp(i, 6) = trp(j, 6) THEN 330 'advance loop
  320 trp(j, 1) = 0: sf = 1: c = j: cl = i
330 NEXT j, i
340 IF sf = 1 OR c > 0 THEN LOCATE 4, 1: PRINT c; TIME$: GOTO 20

350 'ouptut selections
355 OPEN "Random_Streets.txt" FOR OUTPUT AS #1
360 FOR i = 1 TO 18000
 370 PRINT #1, trp(i, 1); trp(i, 2); trp(i, 3); trp(i, 4); trp(i, 5); trp(i, 6)
380 NEXT i: PRINT TIME$: CLOSE #1
INPUT a$


The above code will randomize 180000 sets of 6 digits ranging from 1 to 12, removing all duplicates and complete opposites from the list.  I have gotten to the point where I would like more of these combinations and it is taking over 8 hours for the "de-duplicating" process to complete.

This is where I need help in simply making this code as efficient as possible so as to cut the time down to the maximum for its completion.

I am willing to accept a complete rewrite if the following is maintained:

1) The resulting sets of 6 numbers contain no duplicates: a) within themselves (AABCDE, BBACDE etc.), b) in any other element (AAAAAB and BAAAAA cannot both exist in the final list), c) no exact opposite duplication (1 2 3 4 5 6 and 7 8 9 10 11 12 are exact opposites and cannot exist together in the final list)

2) A simple notepad text file (.txt) is generated with all 180000 sets of numbers 6 to a line with no special characters at all

3) Compatibility with the QB64 (Windows Quick Basic) is maintained in the code

Of course I am able to accept workarounds with my existing code as well.

Thanks in advance for your help!

PS My apologies for using multiple IF...THEN statements instead of an additional FOR...NEXT loop but I wanted to make the logic as clear to myself as possible. :shrug:
3
Scripting Languages / Re: Script BASIC Windows 32 bit - Download Available
« Last post by John on February 14, 2017, 02:40:28 PM »
I have finally assembled an Inno install for Script BASIC for Windows 32 bit with extension modules and their dependencies included. This is my first public release in this format and would appreciate any feedback you're willing to offer to make Script BASIC even better for everyone.

If you plan on using the MySQL extension module or use the SBHTTPD proxy web server, I highly recommend installing the 32 bit version of the XAMPP package (and any of the other free packages they offer) for your local  database and Apache web server environment.

Script BASIC Examples and Source


Download Attached
4
Scripting Languages / Re: Script BASIC Windows 32 bit
« Last post by John on February 10, 2017, 01:04:35 AM »
All I have to do now is create the README file and I should be ready to post a public beta of Script BASIC Windows 32 bit packaged  with the Inno installer. (SBWin32_Setup.exe)



5
Scripting Languages / Re: Script BASIC Windows 32 bit
« Last post by AlyssonR on February 09, 2017, 03:15:57 AM »
*big Thumbsup*
6
Scripting Languages / Re: Script BASIC Windows 32 bit
« Last post by John on February 08, 2017, 05:43:30 PM »
The next release of the Script BASIC IDE/Debugger will be done with IUP so it's cross platform. I can't see anything special to VB6. It was just what Dave was comfortable writting his UI code in. I will also be including the IUP dialog editor integrated into the new IDE.
7
Scripting Languages / Re: Script BASIC Windows 32 bit
« Last post by AlyssonR on February 08, 2017, 02:23:29 PM »
I haven't used FBSL, but that sounds very much like the story with many IDEs by the time they reach full maturity.

Like you, Mike, my programs tend to be composed of lots of reusable chunks of code that are arranged by purpose.

With some big, multi purpose code, I will even use #IF NOT([variable]) to exclude sub-functions that don't need to be included.

I do like the idea of mutiple windows into a large file, but I have never used it (and don't know wheter I ever would, now that my habits are pretty set).
8
Scripting Languages / Re: Script BASIC Windows 32 bit
« Last post by Mike Lobanovsky on February 08, 2017, 11:41:33 AM »
I didn't want anyone to assume an Arduino-type interface.

In fact, a multi-tabbed MDI or SDI editing interface is very handy. I tend to split all my scripts in Eclecta (FBSL's stock IDE) into the main project file -- typically the one with the Main() function or the Events loop -- and a number of includes that would group the other functions logically according to their purpose in the application, pretty much like a Visual Studio would. That's what UltraEdit is designed to do too. UE is a great tool but it being a powerful all-purpose text editor seems a little bit of an overkill for a BASIC IDE.

Alternatively, a usable IDE might have splitters to divide the viewport into 2 or 4 distinct areas scrollable to their own portions within a long script, which would minimize time and effort to scroll the script back and forth while editing its portions. The most advanced setups would even allow the user to load different files into the different sub-windows of the split viewport. But still I find the multi-tabbed IDEs to be the most intuitive and easy to handle of all.
9
Scripting Languages / Re: Script BASIC Windows 32 bit
« Last post by AlyssonR on February 08, 2017, 05:25:30 AM »
Which is fair enough.

My comment about one-file-one-window was aimed more toward the folks who are used to having several files open at the same time (such as the main program and several #INCLUDEs).

I normally edit my source code in ConText, but when working with Arduino code, the IDE is an MDI container, allowing tab-switching between main program code and #INCLUDEs. I didn't want anyone to assume an Arduino-type interface.

I do prefer this interface.
10
Scripting Languages / Re: Script BASIC Windows 32 bit
« Last post by John on February 07, 2017, 07:32:15 PM »
Quote
It is currently a one file-one-window interface.

When Script BASIC runs a script, any IMPORT (only add once)  or INCLUDE files are combined into one file to run or debug. The debugger will point to the first executable line in the main script.

I use UltraEdit for all my Script BASIC coding and use the Script BASIC IDE for debugging or testing concepts.
Pages: [1] 2 3 ... 10