Recent Posts

Pages: [1] 2 3 ... 10
1
As proper as the repository is, I’ve already replied to you there.

Since it’s been replicated here, I’ll replicate the reply too:

Quote
For some reason improper coordinates got stored for the second instance. Go to internal/config.ini and delete the section for the second ide window. Please let me know if that fixes it.

And yes, this thread seems to have lasted too long already.
2
I feel like this should have been just a new topic
3
The preferred method for feature requests AND bugs etc is the link below

https://github.com/QB64Team/qb64/issues

This may be only related to Windows 10 x64 high DPI displays (eg my computer QB64 v1.5)...


If already have an instance of QB64 v1.5 Windows 10 x64 running - when attempting to launch a second instance of QB64 v1.5, the opening IDE screen does not appear on the display (it appears as a tiny "pop-up" when "hovering" mouse cursor over TaskBar ICON) - if now AGAIN attempt to launch QB64 v1.5, the IDE opening screen is now visible on main display as NORMAL. So now need to remove the "second" instance and so proceed with the third instance (which now becomes the intended second instance of QB64).
4
Programs / Re: Heron's method of computing square roots
« Last post by STxAxTIC on Yesterday at 09:08:00 PM »
Hi Steve (and all)

I just stumbled onto the forums today and saw this. It made me wonder if I knew a cool method to get square roots that does not involve iterative calculus, graphs, symbols - just good old fashion farm math. I'm happy with what I came up with and will scribble it here before I embed it in a PDF.

To review the problem, we are pretending not to know the square root of 60, but meanwhile we know:

Code: [Select]
7 * 7 = 49
8 * 8 = 64

Using the method Steve describes, we come up with sqrt(60) ~ 7.7333, where squaring this gives some hint at the accuracy:

Code: [Select]
:7.7333^2
:+59.80392889

59.8/60 isn't bad, but I would rather see something much closer to 60.0. So that's the mission now.

I will start with the same starting information. The final answer will be a formula that has fewer side calculations that the Steve method, and I could just blurt that answer out and drop the microphone - but I will derive the answer first, and put a box around it. I insist on explaining why it works though.

Let me rewrite the known information, along with a way to frame the question:

Code: [Select]
7 * 7       = 49
(8-x)*(8-x) = 60
8 * 8       = 64

Like Steve's setup, the first key here is already knowing the square root of the "next" integer. In this case, we need to know 8*8=64, and that our answer is going to be something less than 8. Whatever the answer is, I write it as 8-x, so I know x is a number less than one. Read that twice: The number x is less than one. The number 8-x solves the problem.

To proceed, take that middle equation and FOIL out the left side:

Code: [Select]
(8-x)*(8-x)    = 60
64 - 16x + x^2 = 60

Now, since x<1 as given, it follows that x^2 is much less than all of the other numbers in the equation, and we effectively ignore x^2. At this point, all "equal" signs are really approximations, just to be clear. Anyway, we can solve for x with no quadratic funny business:

Code: [Select]
16x = 64-60 = 4

... And it's evident that x = 1/4 = 0.25. And we're done. The solution is 8-0.25 = 7.75. Testing this number, we get:

Code: [Select]
:7.75^2
:+60.0625

Which is much closer to 60.

And that's it - the whole method is demonstrated. In the general case, instead of 60, suppose want to find the square root of Q^2. If the solution is proposed as N-x, then x is equal to N/2 - Q^2/2N, or N-x = N/2 + Q^2/2N. In summary - here is the box with the answer:

Code: [Select]
Q = N/2 + Q^2/2N

where N is the integer just greater than Q.

To see the sqrt(60) example all over again, just identify Q^2=60 and N=8. Then Q = 4 + 60/16 = 7.75.

For another example, calculate the square root of 1000. So Q^2=1000, and N has to be 32, because 32^2=1024 (but 31^2=961). Plugging these into the formula:

Q = N/2 + Q^2/2N = 16 + 1000/64 = 31.625
5
Programs / Re: Heron's method of computing square roots
« Last post by SMcNeill on Yesterday at 06:14:30 PM »
What you guys are doing here reminds me of the method we were taught in school to find approximate square roots:  just use fractional differences (no idea what you call it, or who came up with it).

For example, what’s the square root of 60?

7 * 7 = 49
8 * 8 = 64

There’s a total difference of 15 between 49 and 64, and a difference of 11 between 49 and 60, so the answer is 7 + 11/15 = 7.7333. (Or 8 - 4/15, for the same answer.)

The actual answer is 7.7459, but the estimated solution has always been good enough for work on the farm.  (At least, I can honestly say I never built a round outhouse by calculating estimated squares...)

Of course, nowadays, the easiest solution is just PRINT SQRT(60).  :P
6
QB64 Discussion / Re: i suffer
« Last post by MasterGy on Yesterday at 03:21:16 PM »
here is the TETRIS game written 24 years ago :) looking at the source code is a disaster :)

Code: QB64: [Select]
  1. DECLARE SUB idominfo (id$(), kep$(), xkep$())
  2. DECLARE SUB kepprn (kep$())
  3. varakozas = 1
  4. idomokszama = 19
  5.  
  6. DIM kep$(29), xkep$(29), id$(idomokszama - 1, 4)
  7. idominfo id$(), kep$(), xkep$()
  8. GOTO cimlap
  9.  
  10. jatek:
  11.  
  12. idominfo id$(), kep$(), xkep$(): CLS: kepprn kep$()
  13. LOCATE 24, 32: PRINT "Points   :";
  14. LOCATE 4, 12: PRINT "Next      :"
  15. ujalak:
  16. FOR t = 1 TO VAL(RIGHT$(TIME$, 2)): r = RND(1): NEXT t
  17. aktid = kovetkezo
  18. kovetkezo = INT(idomokszama * RND(1)): elfor = 0: x = 9: y = 0
  19. FOR fug = 0 TO 2: LOCATE 3 + fug, 24: PRINT MID$(id$(kovetkezo, 0), 3 * fug + 1, 3): NEXT fug
  20.  
  21.  
  22.  
  23. FOR fug = 0 TO 2: FOR viz = 0 TO 2
  24.         kepp$ = MID$(kep$(y + fug), x + viz, 1)
  25.         idop$ = MID$(id$(aktid, elfor), fug * 3 + viz + 1, 1)
  26.         IF idop$ = "±" AND (kepp$ <> " ") THEN GOTO jatekv
  27. NEXT viz, fug
  28.  
  29. s_s = .3
  30. sebesseg = s_s
  31. bt = TIMER
  32. ciklus:
  33.  
  34.  
  35.  
  36. leptek = leptek + 1: 'IF leptek <> varakozas THEN GOTO billentyuk
  37. IF ABS(TIMER - bt) < sebesseg THEN GOTO billentyuk
  38. leptek = 0
  39. bt = TIMER
  40. FOR viz = 0 TO 2: FOR fug = 0 TO 2
  41.         kepp$ = MID$(kep$(y + fug + 1), x + viz, 1)
  42.         idop$ = MID$(id$(aktid, elfor), fug * 3 + viz + 1, 1)
  43.         IF idop$ = "±" AND (kepp$ = "°" OR kepp$ = "Ű") THEN GOTO fixalo
  44. NEXT fug, viz
  45. y = y + 1
  46.  
  47. FOR viz = 0 TO 2
  48.  
  49.     kepp$ = MID$(kep$(y - 1), x + viz, 1)
  50.     IF kepp$ <> "Ű" AND kepp$ <> "°" THEN kep$(y - 1) = LEFT$(kep$(y - 1), x + viz - 1) + " " + MID$(kep$(y - 1), x + viz + 1)
  51.  
  52.     FOR fug = 0 TO 2
  53.         idop$ = MID$(id$(aktid, elfor), fug * 3 + viz + 1, 1)
  54.         kepp$ = MID$(kep$(fug + y), x + viz, 1): pr$ = kepp$
  55.         IF idop$ = " " AND kepp$ <> "Ű" AND kepp$ <> "°" THEN pr$ = " "
  56.         IF idop$ = "±" AND kepp$ <> "Ű" AND kepp$ <> "°" THEN pr$ = "˛"
  57.         kep$(y + fug) = LEFT$(kep$(y + fug), x + viz - 1) + pr$ + MID$(kep$(y + fug), x + viz + 1)
  58. NEXT fug, viz
  59. kepprn kep$()
  60. pontszam = pontszam + 1: LOCATE 24, 42: PRINT pontszam;
  61.  
  62. billentyuk:
  63.  
  64. a$ = INKEY$
  65. a$ = " " + a$
  66. ky = ASC(RIGHT$(a$, 1))
  67.  
  68. IF ky <> 75 THEN GOTO jobbra:
  69. REM 'nyil balra'                  ( az idom balra mozgatasa )
  70. FOR viz = 0 TO 2: FOR fug = 0 TO 2
  71.         idop$ = MID$(id$(aktid, elfor), fug * 3 + viz + 1, 1)
  72.         kepp$ = MID$(kep$(fug + y), x + viz - (1), 1)
  73.         IF idop$ = "±" AND (kepp$ = "°" OR kepp$ = "Ű") THEN GOTO ciklus
  74. NEXT fug, viz: x = x - 1
  75. FOR fug = 0 TO 2
  76.  
  77.     kepp$ = MID$(kep$(fug + y), x + 3, 1)
  78.     IF kepp$ <> "Ű" AND kepp$ <> "°" THEN kep$(y + fug) = LEFT$(kep$(y + fug), x + 2) + " " + MID$(kep$(y + fug), x + 4)
  79.  
  80.     FOR viz = 0 TO 2
  81.         idop$ = MID$(id$(aktid, elfor), fug * 3 + viz + 1, 1)
  82.         kepp$ = MID$(kep$(fug + y), x + viz, 1): pr$ = kepp$
  83.         IF idop$ = " " AND kepp$ <> "Ű" AND kepp$ <> "°" THEN pr$ = " "
  84.         IF idop$ = "±" AND kepp$ <> "Ű" AND kepp$ <> "°" THEN pr$ = "˛"
  85.         kep$(y + fug) = LEFT$(kep$(y + fug), x + viz - 1) + pr$ + MID$(kep$(y + fug), x + viz + 1)
  86. NEXT viz, fug
  87.  
  88. jobbra:
  89. IF ky <> 77 THEN GOTO fel
  90. REM 'nyil jobbra'          (az idom jobbra mozgatasa)
  91. FOR viz = 0 TO 2: FOR fug = 0 TO 2
  92.         idop$ = MID$(id$(aktid, elfor), fug * 3 + viz + 1, 1)
  93.         kepp$ = MID$(kep$(fug + y), x + viz + (1), 1)
  94.         IF idop$ = "±" AND (kepp$ = "°" OR kepp$ = "Ű") THEN GOTO ciklus
  95. NEXT fug, viz: x = x + 1
  96. FOR fug = 0 TO 2
  97.  
  98.     kepp$ = MID$(kep$(fug + y), x - 1, 1)
  99.     IF kepp$ <> "Ű" AND kepp$ <> "°" THEN kep$(y + fug) = LEFT$(kep$(y + fug), x - 2) + " " + MID$(kep$(y + fug), x)
  100.  
  101.     FOR viz = 0 TO 2
  102.         idop$ = MID$(id$(aktid, elfor), fug * 3 + viz + 1, 1)
  103.         kepp$ = MID$(kep$(fug + y), x + viz, 1): pr$ = kepp$
  104.         IF idop$ = " " AND kepp$ <> "Ű" AND kepp$ <> "°" THEN pr$ = " "
  105.         IF idop$ = "±" AND kepp$ <> "Ű" AND kepp$ <> "°" THEN pr$ = "˛"
  106.         kep$(y + fug) = LEFT$(kep$(y + fug), x + viz - 1) + pr$ + MID$(kep$(y + fug), x + viz + 1)
  107. NEXT viz, fug
  108.  
  109. fel:
  110. IF ky <> 72 THEN GOTO le
  111. REM 'nyil fel'                               (az idom forgatasa)
  112. xelfor = elfor: elfor = elfor + 1: IF id$(aktid, elfor) = "" THEN elfor = 0
  113. FOR viz = 0 TO 2: FOR fug = 0 TO 2
  114.         idop$ = MID$(id$(aktid, elfor), fug * 3 + viz + 1, 1)
  115.         kepp$ = MID$(kep$(fug + y), x + viz, 1)
  116.         IF idop$ = "±" AND (kepp$ = "°" OR kepp$ = "Ű") THEN elfor = xelfor
  117. NEXT fug, viz
  118. FOR viz = 0 TO 2: FOR fug = 0 TO 2
  119.         idop$ = MID$(id$(aktid, elfor), fug * 3 + viz + 1, 1)
  120.         kepp$ = MID$(kep$(fug + y), x + viz, 1): pr$ = kepp$
  121.         IF idop$ = " " AND kepp$ <> "Ű" AND kepp$ <> "°" THEN pr$ = " "
  122.         IF idop$ = "±" AND kepp$ <> "Ű" AND kepp$ <> "°" THEN pr$ = "˛"
  123.         kep$(y + fug) = LEFT$(kep$(y + fug), x + viz - 1) + pr$ + MID$(kep$(y + fug), x + viz + 1)
  124. NEXT fug, viz
  125.  
  126. le:
  127. IF ky <> 80 THEN GOTO vg
  128. sebesseg = s_s / 5: kepprn kep$(): GOTO ciklus
  129.  
  130. REM 'nyil le'    ( lerakni a megfelelo helyre , billentyuk kizarva)
  131. ckls:
  132. FOR viz = 0 TO 2: FOR fug = 0 TO 2
  133.         kepp$ = MID$(kep$(y + fug + 1), x + viz, 1)
  134.         idop$ = MID$(id$(aktid, elfor), fug * 3 + viz + 1, 1)
  135.         IF idop$ = "±" AND (kepp$ = "°" OR kepp$ = "Ű") THEN GOTO fixalo
  136. NEXT fug, viz
  137. y = y + 1
  138. pontszam = pontszam + 2: LOCATE 24, 42: PRINT pontszam;
  139. FOR viz = 0 TO 2
  140.  
  141.     kepp$ = MID$(kep$(y - 1), x + viz, 1)
  142.     IF kepp$ <> "Ű" AND kepp$ <> "°" THEN kep$(y - 1) = LEFT$(kep$(y - 1), x + viz - 1) + " " + MID$(kep$(y - 1), x + viz + 1)
  143.  
  144.     FOR fug = 0 TO 2
  145.         idop$ = MID$(id$(aktid, elfor), fug * 3 + viz + 1, 1)
  146.         kepp$ = MID$(kep$(fug + y), x + viz, 1): pr$ = kepp$
  147.         IF idop$ = " " AND kepp$ <> "Ű" AND kepp$ <> "°" THEN pr$ = " "
  148.         IF idop$ = "±" AND kepp$ <> "Ű" AND kepp$ <> "°" THEN pr$ = "˛"
  149.         kep$(y + fug) = LEFT$(kep$(y + fug), x + viz - 1) + pr$ + MID$(kep$(y + fug), x + viz + 1)
  150. NEXT fug, viz
  151. kepprn kep$()
  152. GOTO ckls
  153. vg:
  154. sebesseg = s_s
  155. kepprn kep$(): GOTO ciklus
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162. fixalo:
  163. FOR viz = 0 TO 2: FOR fug = 0 TO 2
  164.         idop$ = MID$(id$(aktid, elfor), fug * 3 + viz + 1, 1)
  165.         kepp$ = MID$(kep$(y + fug), x + viz, 1)
  166.         IF idop$ = "±" THEN kep$(y + fug) = LEFT$(kep$(y + fug), x + viz - 1) + "°" + MID$(kep$(y + fug), x + viz + 1)
  167.         IF idop$ = " " AND (kepp$ <> "Ű" AND kepp$ <> "°") THEN kep$(y + fug) = LEFT$(kep$(y + fug), x + viz - 1) + " " + MID$(kep$(y + fug), x + viz + 1)
  168. NEXT fug, viz
  169.  
  170. vizsgalo:
  171. FOR t = 0 TO 21
  172.     IF kep$(t) = " Ű°°°°°°°°°°°°°°°°Ű " THEN GOTO telesor
  173. NEXT t: GOTO ujalak
  174.  
  175. telesor:
  176. pontszam = pontszam + 200: LOCATE 24, 42: PRINT pontszam;
  177. FOR ck = 1 TO 8
  178.     kep$(t) = " Ű°°°°°°°°°°°°°°°°Ű ": kepprn kep$()
  179.     kep$(t) = " Ű                Ű ": kepprn kep$()
  180.     kep$(t) = " ŰŰŰŰŰŰŰŰŰŰŰŰŰŰŰŰŰŰ ": kepprn kep$()
  181. NEXT ck
  182. FOR ck = t TO 1 STEP -1: kep$(ck) = kep$(ck - 1): NEXT ck
  183. kep$(0) = " Ű                Ű "
  184. GOTO vizsgalo
  185.  
  186. cimlap:
  187. FOR fug = 21 TO 0 STEP -1
  188.     kep$(fug) = xkep$(fug)
  189.     kepprn kep$()
  190. NEXT fug
  191.     a$ = INKEY$
  192.     IF a$ = "u" THEN GOTO jatek
  193.     IF a$ = "k" THEN CLS: END
  194.     IF a$ = "i" THEN GOTO bemutato
  195.  
  196. bemutato:
  197. FOR idomok = 1 TO idomokszama
  198.     FOR elford = 0 TO 3: IF id$(idomok - 1, elford) = "" THEN GOTO kv
  199.  
  200.         FOR fug = 0 TO 2: FOR viz = 0 TO 2
  201.                 LOCATE 4 + elford * 4 + fug, (80 - 4 * idomokszama) / 2 + viz + (idomok - 1) * 4
  202.                 idop$ = MID$(id$(idomok - 1, elford), fug * 3 + viz + 1, 1)
  203.                 kepp$ = "°": IF idop$ = "±" THEN kepp$ = "Ű"
  204.                 PRINT kepp$;
  205.         NEXT viz, fug
  206. kv: NEXT elford, idomok
  207. LOCATE 23, 27
  208. PRINT "      Press any key      "
  209.  
  210. jatekv:
  211. LOCATE 24, 42: PRINT pontszam;
  212. FOR fug = 20 TO 0 STEP -1
  213.     kep$(fug) = " Ű°°°°°°°°°°°°°°°°Ű ": kepprn kep$()
  214. NEXT fug
  215.  
  216. SUB idominfo (id$(), kep$(), xkep$())
  217.     id$(0, 0) = "     ±±±±"
  218.     id$(0, 1) = "±±  ±  ± "
  219.     id$(0, 2) = "   ±±±±  "
  220.     id$(0, 3) = " ±  ±  ±±"
  221.  
  222.     id$(1, 0) = "   ±  ±±±"
  223.     id$(1, 1) = " ±  ± ±± "
  224.     id$(1, 2) = "   ±±±  ±"
  225.     id$(1, 3) = " ±± ±  ± "
  226.  
  227.     id$(2, 0) = "   ±± ±  "
  228.     id$(2, 1) = "   ±  ±± "
  229.     id$(2, 2) = "    ± ±± "
  230.     id$(2, 3) = "   ±±  ± "
  231.  
  232.     id$(3, 0) = "    ± ±±±"
  233.     id$(3, 1) = "  ± ±±  ±"
  234.     id$(3, 2) = "   ±±± ± "
  235.     id$(3, 3) = " ±  ±± ± "
  236.  
  237.     id$(4, 0) = "   ±±±   "
  238.     id$(4, 1) = " ±  ±  ± "
  239.  
  240.     id$(5, 0) = "  ±±±±±  "
  241.     id$(5, 1) = "±±  ±  ±±"
  242.  
  243.     id$(6, 0) = " ±  ± ±±±"
  244.     id$(6, 1) = "  ±±±±  ±"
  245.     id$(6, 2) = "±±± ±  ± "
  246.     id$(6, 3) = "±  ±±±±  "
  247.  
  248.     id$(7, 0) = "   ±±±± ±"
  249.     id$(7, 1) = "±± ±  ±± "
  250.     id$(7, 2) = "   ± ±±±±"
  251.     id$(7, 3) = " ±±  ± ±±"
  252.  
  253.     id$(8, 0) = " ±  ±±  ±"
  254.     id$(8, 1) = "    ±±±± "
  255.  
  256.     id$(9, 0) = "  ± ±± ± "
  257.     id$(9, 1) = "   ±±  ±±"
  258.  
  259.     id$(10, 0) = "±±± ± ±±±"
  260.     id$(10, 1) = "± ±±±±± ±"
  261.  
  262.     id$(11, 0) = "  ±  ±±±±"
  263.     id$(11, 1) = "±±±  ±  ±"
  264.     id$(11, 2) = "±±±±  ±  "
  265.     id$(11, 3) = "±  ±  ±±±"
  266.  
  267.     id$(12, 0) = " ± ±±± ± "
  268.  
  269.     id$(13, 0) = "   ±± ±±±"
  270.     id$(13, 1) = "  ± ±± ±±"
  271.     id$(13, 2) = "   ±±± ±±"
  272.     id$(13, 3) = "±± ±± ±  "
  273.  
  274.     id$(14, 0) = "    ±±±±±"
  275.     id$(14, 1) = "±± ±±  ± "
  276.     id$(14, 2) = "   ±±±±± "
  277.     id$(14, 3) = " ±  ±± ±±"
  278.  
  279.     id$(15, 0) = " ± ±±±± ±"
  280.     id$(15, 1) = " ±±±±  ±±"
  281.     id$(15, 2) = "± ±±±± ± "
  282.     id$(15, 3) = "±±  ±±±± "
  283.  
  284.     id$(16, 0) = "   ±± ±± "
  285.  
  286.     id$(17, 0) = "    ±    "
  287.  
  288.     id$(18, 0) = "   ±±    "
  289.     id$(18, 1) = "    ±  ± "
  290.  
  291.  
  292.     FOR t = 0 TO 20: kep$(t) = " Ű                Ű ": NEXT t
  293.     kep$(21) = " " + STRING$(18, "Ű") + " "
  294.  
  295.     xkep$(0) = " ŰŰŰŰŰŰŰŰŰŰŰŰŰŰŰŰŰŰ "
  296.     xkep$(1) = " Ű°°°°°°°°°°°°°°°°Ű "
  297.     xkep$(2) = " Ű°°           °°°Ű "
  298.     xkep$(3) = " Ű°             °°Ű "
  299.     xkep$(4) = " Ű  T E T R I S  °Ű "
  300.     xkep$(5) = " Ű               °Ű "
  301.     xkep$(6) = " Ű    G A M E    °Ű "
  302.     xkep$(7) = " Ű°             °°Ű "
  303.     xkep$(8) = " Ű°°           °°°Ű "
  304.     xkep$(9) = " Ű°°°°°°°°°°°°°°°°Ű "
  305.     xkep$(10) = " Ű°(C)T˘TH GYULA °Ű "
  306.     xkep$(11) = " Ű°  1997-12-30  °Ű "
  307.     xkep$(12) = " Ű°°°°°°°°°°°°°°°°Ű "
  308.     xkep$(13) = " Ű°U - new game°°°Ű "
  309.     xkep$(14) = " Ű°°°°°°°°°°°°°°°°Ű "
  310.     xkep$(15) = " Ű°I - characters°Ű "
  311.     xkep$(16) = " Ű°°°°°°°°view°°°°Ű "
  312.     xkep$(17) = " Ű°°°°°°°°°°°°°°°°Ű "
  313.     xkep$(18) = " Ű°K - exit°°°°°°°Ű "
  314.     xkep$(19) = " Ű°°°from game°°°°Ű "
  315.     xkep$(20) = " Ű°°°°°°°°°°°°°°°°Ű "
  316.     xkep$(21) = " ŰŰŰŰŰŰŰŰŰŰŰŰŰŰŰŰŰŰ "
  317.  
  318.  
  319.  
  320. SUB kepprn (kep$())
  321.     FOR t = 0 TO 21: LOCATE 2 + t, 31: PRINT kep$(t);: NEXT t
  322.  
7
QB64 Discussion / Re: i suffer
« Last post by MasterGy on Yesterday at 02:35:14 PM »
I found the old programs. i remember my first pc after commodore64 was a 386DX 40mhz machine with hercules monochrome monitor. I loved it !!! DOS folder qbasic.exe !!! not even interested in anything but this! I couldn’t even make rudimentary games in color because that monitor only knew 2 colors. I don’t want to tire you of this, but if you’re not angry, I’ll show you a couple. I still used a lot of goto here, it wasn’t structured. I also did a Tetris game, just loading it into qb64 the characters don't show up because the value of ascii is different here. Here, for example, is a number system conversion program. You specify the number system you enter, you also enter the number, and it converts. I'm trying to revive the tetris to qb64. I translate Hungarian into English

Code: QB64: [Select]
  1. DECLARE SUB atalakito (decimalisszam)
  2. DECLARE SUB bekeres (decimalisszam)
  3.  
  4.  
  5. PRINT "SZŹMRENDSZER ŹTVŹLT˘ program                            (C)T˘th Gyula 1998-03-28"
  6. LOCATE 3, 4
  7. PRINT "  Ez a program b rmely sz mot  t tud sz molni k‚t 2-22 sz mrendszer k”z”tt."
  8. bekeres x
  9.  
  10. atalakito x
  11.  
  12. SUB atalakito (szam)
  13.     k$ = "0123456789ABCDEFGHIJKLMNOP"
  14.     FOR szr = 2 TO 22
  15.         PRINT USING "##"; szr;: PRINT "-number system (0-" + MID$(k$, szr, 1); ") :";
  16.         IF szr ^ 20 < szam THEN PRINT " It does not fit ": GOTO ss
  17.         xszam = szam: s$ = "": FOR h = 30 TO -6 STEP -1
  18.             IF h = -1 THEN s$ = s$ + "."
  19.             a = INT(xszam / (szr ^ h))
  20.             s$ = s$ + MID$(k$, a + 1, 1): xszam = xszam - a * szr ^ h
  21.         NEXT h
  22.         FOR h = 1 TO LEN(s$): IF MID$(s$, h, 1) <> "0" THEN EXIT FOR
  23.         NEXT h: PRINT MID$(s$, h)
  24.     ss: NEXT szr
  25.  
  26. SUB bekeres (x)
  27.     k$ = "0123456789ABCDEFGHIJKLMNOP"
  28.    11 INPUT "in what number system do you enter?(2-22) "; szr
  29.     IF szr <> INT(szr) OR szr > 22 OR szr < 2 THEN 11
  30.  
  31.     12 PRINT "enter the number ! (using characters: 0-" + MID$(k$, szr, 1) + ")"
  32.     INPUT szam$: ertek = 0
  33.     sz$ = "": FOR t = LEN(szam$) TO 1 STEP -1
  34.         x$ = MID$(szam$, t, 1)
  35.         IF x$ = "." THEN ht = LEN(szam$) - t ELSE sz$ = sz$ + x$
  36.     NEXT t
  37.     sz$ = UCASE$(sz$)
  38.     FOR t = LEN(sz$) TO 1 STEP -1
  39.         x$ = MID$(sz$, LEN(sz$) - t + 1, 1)
  40.         FOR y = 1 TO szr: IF MID$(k$, y, 1) = x$ THEN GOTO ok
  41.         NEXT y: PRINT "wrong character"; LEN(sz$) - t + 1; ". character ! (" + x$ + ")": GOTO 12
  42.         ok:
  43.         ertek = ertek + (y - 1) * szr ^ (LEN(sz$) - t)
  44.     NEXT t
  45.     x = ertek / szr ^ ht
  46.  
8
QB64 Discussion / Re: i suffer
« Last post by MasterGy on Yesterday at 01:56:37 PM »
SMcNeill huh! very good idea! it also coincides with what I’ve been thinking for a long time, but I don’t even know how to get started. "rigid body physics". I'm thinking of an off-road game. If I could solve this, I could help in the dice as well.
I want something like that, but I feel like I’m very short of that. (the interesting thing is that this is a special solution, 95 DOS program, at that time this little primitive game had the most lifelike physics) If I could solve this, I would help in the dice game!

9
Programs / Re: Heron's method of computing square roots
« Last post by bplus on Yesterday at 12:03:09 PM »
Thanks bplus.
Yes that's nice. There are many methods to calculate the square root of a natural numbers, and also better ones and methods which approximates faster.
But your "optimization" is not the Herons' method, which I tried to demonstrate.

Really, that makes yours not Heron's Method either because I just changed names of the variables and wrote to handle negative numbers ie
t = otherFactor
b = (next) guess

And therefore is same algo as yours, I just used more descriptive variable names to make it clear we are just taking the average of a guess and N/guess = your t variable = the otherFactor of N when the first factor is guess.

guess * otherFactor = N

next guess = (guess + otherFactor) /2 (average of the 2 numbers)

What am I missing? I was not giving a demo of Newton-Raphson.

Update: OK our exit loop conditions are different, I am comparing the difference of the two factors of N, and you are comparing difference of last guess with next guess.

10
InForm / Re: Problem wirh InForrm 1.2 and QB64 1.5 (dev build) on Mint 20.1
« Last post by Fifi on Yesterday at 11:20:55 AM »
Hi Fellippe,

Thanks, Fifi. I’ll have a look.

I've just modified your installation script like below (as I did in my own script) and that solves the problem for any Linux platform.

Code: QB64: [Select]
  1. #!/bin/bash
  2. # InForm for QB64 - Setup script
  3. if [ -e "./qb64" ]; then
  4.   echo "Compiling InForm..."
  5.   ./qb64 -x ./InForm/UiEditor.bas -o ./UiEditor
  6.   ./qb64 -x ./InForm/UiEditorPreview.bas -o ./InForm/UiEditorPreview
  7.   if [ -e "./UiEditor" ] && [ -e "./InForm/UiEditorPreview" ]; then
  8.       echo "Running InForm Designer..."
  9.       ./UiEditor &
  10.   else
  11.       echo "Compilation failed."
  12.       echo "Make sure you unpacked all files in QB64's folder, preserving the directory structure and also that you have version 1.2 or later of QB64 to use InForm."
  13.   fi  
  14.       echo "Compilation failed."
  15.       echo "Make sure you have version 1.2 or later of QB64 to use InForm."
  16. fi
  17. echo
  18. echo "Thank you for choosing InForm for QB64."

Simple and efficient.

Cheers.
Fifi
Pages: [1] 2 3 ... 10