Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - bplus

Pages: 1 ... 533 534 [535] 536 537
8011
QB64 Discussion / Re: Hi everybody
« on: October 22, 2017, 07:44:01 pm »
Hi TempodiBasic,

I have been researching origins of this code we are trying to improve, mostly from Chess Programs Board at TJP.
http://www.thejoyfulprogrammer.com/qb64/forum/forumdisplay.php?fid=374&rndtime=1508611534653852581

reply #48
http://www.thejoyfulprogrammer.com/qb64/forum/showthread.php?tid=63&page=5&rndtime=1508650499163919983

follow the link
http://www.petesqbsite.com/sections/express/issue23/Tut_QB_Chess.txt

My guess someone had it written in spaghetti and translated it to QBasic. Was Dean the translator and / or the original source ???

I also think because of the temporary nature (I hope the Net is down temporarily) we should continue discussion with screen shots and attachments at TJP.

BTW, (Since NET is down) I found OlDosLover changes at
http://www.teutoburgo.tk/misc/downloadFrame.html
that has code to replay a game. From my first experience it seems flawed. But nice tiny little chess piece graphics!
But OlDosLover's game recorder looks easy to install into what we've been doing.

Speaking of Chess piece graphics, I was very impressed here:
http://www.thejoyfulprogrammer.com/qb64/forum/showthread.php?tid=401&rndtime=1508625987687357559
Code: QB64: [Select]
  1. 'DEFINE PIECES FOR DRAWING
  2. ROOK$ = "R26U5H2L5U7E3R4U10L6D3L4U3L6D3L4U3L6D10R4F3D7L5G2D5"
  3. KNIGHT$ = "R26U5H2U4E2U9H6L9G10D4F2R4E3R4G8L4G2D5"
  4. BISHOP$ = "R26U5H2L8E6U9H2G8H2E8H2L6G6D9F6L8G2D5"
  5. QUEEN$ = "R26U5H2L6E9U11G4H6G4H4G6H4D11F9L6G2D5"
  6. KING$ = "R26U5H2L5E7U6H4L5G3U5R2U2L2U2L2D2L2D2R2D5H3L5G4D6F7L5G2D5"
  7. PAWN$ = "R26U5H2L6U7E3U6H3L10G3D6F3D7L6G2D5"
Just plain old DRAW strings!!! And yet each piece is easy to ID for what it is.

I have also found a different Chess program in SmallBASIC samples files that works with mouse but draw strings need work.
It might be fun to translate back to QB64. I have never seen a sub written inside a Function nor SmallBASIC's use of square brackets, maybe for User Type Arrays without need for complementary User Type Definitions.

Do the 16 QB colors work in Screen 0?


8012
QB64 Discussion / Re: Hi everybody
« on: October 21, 2017, 04:49:03 pm »
Hi TempodiBasic,

Re Basic experience:
Ha, people still think Basic is line numbers and spaghetti code! bad rep... how long ago was this?

Me, I started with GW Basic. When I turned off my "Windows like Interface" on my 1st computer and ran straight from DOS with the help of a File Explorer like program, I discovered GW. Moved onto Quick Basic 4.5 (I think, I had to pay for it before MS added it to DOS for free but I got a compiler plus...) Then VB 2.0 then VB for MS DOS which was my favorite because Windows still quite slow with graphics back in early 90's, I was doing stuff for where I worked for a couple of years. Then big gap until 2014 when I got a hankering for some programming again.


Re: Mouse click methods
OK we are agreed to use Fellippe's method for mouse move? but it was great learning experience trying other methods.

And we can start adapting new changes around this,

but wait...
Oh, now I see what you might be after.

We need to go outside the board to select pieces for things like pawn promotion and maybe setting up positions for mid game study and such... aha! That is where/when that separate sub you were setting up would come into play! and yes, use it with the main thing for getting moves of chess pieces in game.


Re:All those broken samples in QB64 package...
Doesn't it make you want to use (and learn) QB64 to fix those up? better than ever!




8014
QB64 Discussion / Re: Hi everybody
« on: October 21, 2017, 02:24:16 pm »
Well I will try again to post 2_2-2 for comparison

Blah!  " message exceeds the maximum allowed length 20000 characters "

8015
Programs / Fall Foliage
« on: October 21, 2017, 01:57:45 pm »
Where were we? Oh Ashish was doing fractals and his last was a marvelous 3D Tree but I thought it a bit bare so I will show how to do leaves. :) maybe then he can make them 3D too!

Code: QB64: [Select]
  1. _TITLE "Fall Foliage 2017-10-21 by bplus"
  2. 'fall foliage.bas SmallBASIC 0.12.9 (B+=MGA) 2017-10-21
  3. 'test landscape and portrait views for Android
  4. 'xmx = min(xmax, 400) : ymx = min(700, ymax) 'portrait
  5. 'OK it's just plain better in landscape view
  6.  
  7. 'now for full viewing enjoyment
  8. 'xmx = xmax : ymx = ymax
  9.  
  10. CONST xmx = 1200
  11. CONST ymx = 700
  12. DEFSNG A-Z
  13.  
  14. rad = _PI(1 / 180)
  15. SCREEN _NEWIMAGE(xmx, ymx, 32)
  16. _SCREENMOVE 100, 20 'adjust as needed _MIDDLE needs a delay .5 or more for me
  17.  
  18.  
  19. n = 3
  20.     IF n < 15 THEN n = n + 3
  21.     horizon = rand%(.8 * ymx, .9 * ymx)
  22.     FOR i = 0 TO horizon
  23.         midInk 0, 0, 128, 10, 120, 128, i / horizon
  24.         lien 0, i, xmx, i
  25.     NEXT
  26.     FOR i = horizon TO ymx
  27.         midInk 70, 108, 30, 60, 10, 5, (i - horizon) / (ymx - horizon)
  28.         lien 0, i, xmx, i
  29.     NEXT
  30.     FOR i = 1 TO xmx * ymx * .00018
  31.         leaf rand%(0, xmx), rand%(horizon * 1.002, ymx)
  32.     NEXT
  33.     IF n < .01 * xmx THEN trees = n ELSE trees = rand%(.002 * xmx, .03 * xmx)
  34.     FOR i = 1 TO trees
  35.         y = horizon + .04 * ymx + i / trees * (ymx - horizon - .1 * ymx)
  36.         r = .01 * y: h = rand%(y * .15, y * .18)
  37.         branch rand%(10, xmx - 10), y, r, 90, h, 0
  38.     NEXT
  39.     fRect xmx, 0, xmax, ymax, 0
  40.     fRect 0, ymx, xmx, ymax, 0
  41.     _DISPLAY
  42.     SLEEP 2
  43.  
  44. SUB branch (xx, yy, startrr, angDD, lengthh, levv)
  45.     x = xx: y = yy
  46.     lev = levv
  47.     length = lengthh
  48.     angD = angDD
  49.     startr = startrr
  50.     x2 = x + COS(rad * (angD)) * length
  51.     y2 = y - SIN(rad * (angD)) * length
  52.     dx = (x2 - x) / length
  53.     dy = (y2 - y) / length
  54.     bc& = _RGB(30 + 6 * lev, 15 + 3 * lev, 5 + 2 * lev)
  55.     FOR i = 0 TO length
  56.         COLOR bc&
  57.         fCirc x + dx * i, y + dy * i, startr
  58.     NEXT
  59.     IF lev > 1 THEN leaf x2, y2
  60.     IF .8 * startr < .1 OR lev > 7 OR length < 3 THEN EXIT SUB
  61.     lev = lev + 1
  62.     branch x2, y2, .8 * startr, angD + 22 + rand%(-10, 19), rand%(.75 * length, .9 * length), lev
  63.     branch x2, y2, .8 * startr, angD - 22 - rand%(-10, 19), rand%(.75 * length, .9 * length), lev
  64.  
  65. 'Steve McNeil's  copied from his forum   note: Radius is too common a name
  66. SUB fCirc (CX AS LONG, CY AS LONG, R AS LONG)
  67.     DIM subRadius AS LONG, RadiusError AS LONG
  68.     DIM X AS LONG, Y AS LONG
  69.  
  70.     subRadius = ABS(R)
  71.     RadiusError = -subRadius
  72.     X = subRadius
  73.     Y = 0
  74.  
  75.     IF subRadius = 0 THEN PSET (CX, CY): EXIT SUB
  76.  
  77.     ' Draw the middle span here so we don't draw it twice in the main loop,
  78.     ' which would be a problem with blending turned on.
  79.     LINE (CX - X, CY)-(CX + X, CY), , BF
  80.  
  81.     WHILE X > Y
  82.         RadiusError = RadiusError + Y * 2 + 1
  83.         IF RadiusError >= 0 THEN
  84.             IF X <> Y + 1 THEN
  85.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), , BF
  86.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), , BF
  87.             END IF
  88.             X = X - 1
  89.             RadiusError = RadiusError - X * 2
  90.         END IF
  91.         Y = Y + 1
  92.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), , BF
  93.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), , BF
  94.     WEND
  95.  
  96. SUB fRect (x1, y1, x2, y2, c&)
  97.     LINE (x1, y1)-(x2, y2), c&, BF
  98.  
  99. SUB fRectStep (x1, y1, x2, y2)
  100.     LINE (x1, y1)-STEP(x2, y2), , BF
  101.  
  102. SUB lien (x1, y1, x2, y2)
  103.     LINE (x1, y1)-(x2, y2)
  104.  
  105. SUB leaf (x, y)
  106.     sp = 15: leafs = rand%(xmx * ymx * .00001, xmx * ymx * .00002)
  107.     FOR n = 1 TO leafs
  108.         COLOR _RGB(rand%(50, 250), rand%(25, 255), rand%(0, 40))
  109.         xoff = x + RND * sp - RND * sp
  110.         yoff = y + RND * sp - RND * sp
  111.         woff = 3 + RND * 3
  112.         hoff = 3 + RND * 3
  113.         fRectStep xoff, yoff, woff, hoff
  114.     NEXT
  115.  
  116. SUB midInk (r1%, g1%, b1%, r2%, g2%, b2%, fr##)
  117.     COLOR _RGB(r1% + (r2% - r1%) * fr##, g1% + (g2% - g1%) * fr##, b1% + (b2% - b1%) * fr##)
  118.  
  119. FUNCTION rand% (lo%, hi%)
  120.     rand% = INT(RND * (hi% - lo% + 1)) + lo%
  121.  
  122.  

Here is alternate code and screen shot:
http://www.thejoyfulprogrammer.com/qb64/forum/showthread.php?tid=1051&pid=4609&rndtime=1508574661435543493#pid4609

8016
QB64 Discussion / Re: Hi everybody
« on: October 21, 2017, 12:23:39 pm »
Oh, now maybe I get my question answered. :)

@ TempodBasic, what was reason you didn't like Fellippes fix to mouse click method to get player's move?

I mean it still works better than anything we've come up with. See how each square is cleared when doing mouse overs after first click.

8017
Options!

Thanks Petr

8018
Programs / Re: Steve's Poker Playhouse
« on: July 27, 2017, 02:02:35 pm »
Just had to change the font file.

I like this game! Steve can you cover this if I cash in?

8019
Programs / Re: File Listing
« on: July 27, 2017, 12:31:05 pm »
I can confirm Fellippe's fix.

I deleted all the grab files in QB64.exe folder, made the change in the .BI  ./ and all worked! :)

Append:

hmm... ./ or .\   ?? in Windows I don't think it matters, but I see ./ in Windows paths.

8020
Programs / Re: File Listing
« on: July 27, 2017, 12:21:08 pm »
Thanks all,

Yep! I copied everything to QB64.exe folder and the demo .bas runs fine from there AND it now runs fine from the grabfile Folder as well.

Maybe just the .h file? I will try combos and learn a lesson! :) of where what is needed.

8021
Programs / Re: File Listing
« on: July 27, 2017, 12:09:27 pm »
Hi Fellippe and all,

Nope, ./ actually messes up the pathed filename that QB64 says it can't find in the error message.

Does QB64 have any problems with spaces in pathed filename or length of the pathed filename?


Append:

"In the declare library bi" oh, in the BI file...

8022
Programs / Re: File Listing
« on: July 27, 2017, 11:49:03 am »
Thanks Steve and Fellippe, this is very helpful for me getting up to speed. So that is why the other (BM) is below! nice mnemonic ;)

OK I am trying to test the demo and have error about finding the .BI but, as I show, it is in the expected directory/folder, I think.

Any ideas the problem?

see screen shot

8023
Programs / Re: File Listing
« on: July 27, 2017, 11:17:53 am »
May I ask a maybe dumb question? ...well I can ask ;-))

What is an .h and .BM file?

I do remember .BI files.

8024
Programs / Re: Steve's Poker Playhouse
« on: July 27, 2017, 11:06:33 am »
Thanks Steve!

8025
Programs / Re: QB64-interpreter
« on: July 27, 2017, 09:30:13 am »
Hi,

I just tested a drag and drop of a bas file onto the exe, it works! :)

Pages: 1 ... 533 534 [535] 536 537