![]() |
| If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|||||||
| Tags: androcles, code, tight |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hey Andro,
Try running this little program, far below. If it works I have another better one. Ken PS: maybe this will keep the kids from breaking your windows! +++++++++++++++++++++++++++++++++ Newsgroups: alt.sci.planetary From: (David Williams) - Find messages by this author Date: Sat, 20 Dec 2003 23:16:12 -0600 Local: Sat, Dec 20 2003 10:16 pm Subject: cratering program Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse Ken Tucker (who often posts here) has asked me to post the following little BASIC program that he wrote with his son, Travis, some 15 years ago. It was written in some old dialect of BASIC, with line numbers, but works okay in QBasic, and probably others. What it does is to draw an image of a sphere floating in a starry sky, and then show the sphere being bombarded with meteors, producing craters. After a while, the image does look passably like the moon, or some similar body. If nothing else, it is pretty, and is far more interesting to watch than most screen-savers. Please direct any questions to Ken. I'm just the messenger, as far as this is concerned. dow ------------------------------------------------------- 5 ' Craters. Ken and Travis Tucker. Approx 1988. 10 CLEAR : SCREEN 7, 0, 0, 0: KEY OFF: CLS 12 PCOPY 0, 1: PCOPY 0, 2: PCOPY 0, 3: VIEW PRINT 1 TO 25 21 C = 1: GOSUB 22: C = 9: GOSUB 22: GOTO 25 22 FOR A = 1 TO 100: X = RND * 320: Y = RND * 200 23 PSET (X, Y), C: NEXT A: RETURN 25 DR = 3.141592 / 180: R = 10 30 RANDOMIZE TIMER 35 DIM X(500), Y(500) 40 CIRCLE (160, 100), 90, 8 45 PAINT (160, 100), 4, 8: PAINT (160, 100), 8, 8 100 R = INT(RND * RND * RND * RND * 20) + 1: LO = RND * 170 - 85 105 LA = RND * 140 - 70: C = 8 110 X0 = 90 * SIN(DR * LO) * COS(DR * LA) + 160 112 Y0 = 76 * SIN(LA * DR) + 100 115 GOSUB 300: IF R = 1 THEN PSET (X0, Y0), 14: GOTO 100 120 C = 12: GOSUB 130: PAINT (X0, Y0), 4, 12: GOSUB 600: 125 PAINT (X0, Y0), 7, 12: GOSUB 400: GOSUB 500: GOTO 180 130 N = 0: S = 36 / R: FOR A = 1 TO 360 STEP S: N = N + 1 140 U = R * SIN(A * DR) + LO: V = R * COS(A * DR) + LA 150 X = 90 * SIN(DR * U) * COS(DR * V) + B: Y = 76 * SIN(V * DR) 155 X(N) = X: Y(N) = Y 160 PSET (X + 160, Y + 100), C 170 NEXT A: RETURN 180 PSET (X0, Y0), 15 200 GOTO 100 300 PCOPY 0, 1: DX = X0 - 160: DY = Y0 - 100 305 LINE (DX * 10, DY * 10)-(X0, Y0), 14: GOSUB 600: PCOPY 1, 0 310 FOR A = 1 TO R * 4: X1 = X0 + RND * 4 * R - 2 * R 315 Y1 = Y0 + 4 * RND * R - 2 * R 320 LINE (X0, Y0)-(X1, Y1), 4: NEXT A: GOSUB 600: PCOPY 1, 0: RETURN 400 FOR A = 1 TO N: X = X(A): Y = Y(A) 410 IF X = 0 OR Y = 0 THEN 420 412 PSET (X + 160 + X / ABS(X), Y + 100 + Y / ABS(Y)), 0 420 NEXT A: RETURN 500 FOR A = 1 TO N: X = X(A): Y = Y(A) 510 PSET (X + 160, Y + 100), 14 520 NEXT A: RETURN 600 FOR DE = 1 TO 5: T = TIMER: WHILE TIMER = T: WEND: NEXT: RETURN --------------------------------------------------------- |
| Ads |
|
#2
|
|||
|
|||
|
Ken S. Tucker wrote: Hey Andro, Try running this little program, far below. If it works I have another better one. Ken PS: maybe this will keep the kids from breaking your windows! +++++++++++++++++++++++++++++++++ Newsgroups: alt.sci.planetary From: (David Williams) - Find messages by this author Date: Sat, 20 Dec 2003 23:16:12 -0600 Local: Sat, Dec 20 2003 10:16 pm Subject: cratering program Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse Ken Tucker (who often posts here) has asked me to post the following little BASIC program that he wrote with his son, Travis, some 15 years ago. It was written in some old dialect of BASIC, with line numbers, but works okay in QBasic, and probably others. What it does is to draw an image of a sphere floating in a starry sky, and then show the sphere being bombarded with meteors, producing craters. After a while, the image does look passably like the moon, or some similar body. If nothing else, it is pretty, and is far more interesting to watch than most screen-savers. Please direct any questions to Ken. I'm just the messenger, as far as this is concerned. dow ------------------------------------------------------- 5 ' Craters. Ken and Travis Tucker. Approx 1988. 10 CLEAR : SCREEN 7, 0, 0, 0: KEY OFF: CLS 12 PCOPY 0, 1: PCOPY 0, 2: PCOPY 0, 3: VIEW PRINT 1 TO 25 21 C = 1: GOSUB 22: C = 9: GOSUB 22: GOTO 25 22 FOR A = 1 TO 100: X = RND * 320: Y = RND * 200 23 PSET (X, Y), C: NEXT A: RETURN 25 DR = 3.141592 / 180: R = 10 30 RANDOMIZE TIMER 35 DIM X(500), Y(500) 40 CIRCLE (160, 100), 90, 8 45 PAINT (160, 100), 4, 8: PAINT (160, 100), 8, 8 100 R = INT(RND * RND * RND * RND * 20) + 1: LO = RND * 170 - 85 105 LA = RND * 140 - 70: C = 8 110 X0 = 90 * SIN(DR * LO) * COS(DR * LA) + 160 112 Y0 = 76 * SIN(LA * DR) + 100 115 GOSUB 300: IF R = 1 THEN PSET (X0, Y0), 14: GOTO 100 120 C = 12: GOSUB 130: PAINT (X0, Y0), 4, 12: GOSUB 600: 125 PAINT (X0, Y0), 7, 12: GOSUB 400: GOSUB 500: GOTO 180 130 N = 0: S = 36 / R: FOR A = 1 TO 360 STEP S: N = N + 1 140 U = R * SIN(A * DR) + LO: V = R * COS(A * DR) + LA 150 X = 90 * SIN(DR * U) * COS(DR * V) + B: Y = 76 * SIN(V * DR) 155 X(N) = X: Y(N) = Y 160 PSET (X + 160, Y + 100), C 170 NEXT A: RETURN 180 PSET (X0, Y0), 15 200 GOTO 100 300 PCOPY 0, 1: DX = X0 - 160: DY = Y0 - 100 305 LINE (DX * 10, DY * 10)-(X0, Y0), 14: GOSUB 600: PCOPY 1, 0 310 FOR A = 1 TO R * 4: X1 = X0 + RND * 4 * R - 2 * R 315 Y1 = Y0 + 4 * RND * R - 2 * R 320 LINE (X0, Y0)-(X1, Y1), 4: NEXT A: GOSUB 600: PCOPY 1, 0: RETURN 400 FOR A = 1 TO N: X = X(A): Y = Y(A) 410 IF X = 0 OR Y = 0 THEN 420 412 PSET (X + 160 + X / ABS(X), Y + 100 + Y / ABS(Y)), 0 420 NEXT A: RETURN 500 FOR A = 1 TO N: X = X(A): Y = Y(A) 510 PSET (X + 160, Y + 100), 14 520 NEXT A: RETURN 600 FOR DE = 1 TO 5: T = TIMER: WHILE TIMER = T: WEND: NEXT: RETURN ---------- ++++++++++++++++++++++ Hi again Andro. I doubt there's a mathematician alive who can see how the above equations render a lunar surface. So what I've been tryin to do is create a vision in the thought experiments I demo. I was wondering about putting them into a dynamic graphical program with sub-titles, to explain the thought process. You seem to have an edge on programming, so I was hoping you might...well critisize, TIA Ken |
|
#3
|
|||
|
|||
|
"Ken S. Tucker" wrote in message ups.com... | Hey Andro, | Try running this little program, far below. | If it works I have another better one. | Ken | PS: maybe this will keep the kids from breaking | your windows! My grandson broke his father's shed window, not mine. He has goal posts on the lawn with a net now. :-) [snip intro] Jeez... I haven't seen Beginners All-purpuse Symbolic Instruction Code like that in over 30 years, let alone programmed it. I gave up programming in C++ when I retired. Let's see if I can still read it. | | 5 ' Craters. Ken and Travis Tucker. Approx 1988. | 10 CLEAR : SCREEN 7, 0, 0, 0: KEY OFF: CLS | 12 PCOPY 0, 1: PCOPY 0, 2: PCOPY 0, 3: VIEW PRINT 1 TO 25 | 21 C = 1: GOSUB 22: C = 9: GOSUB 22: GOTO 25 | 22 FOR A = 1 TO 100: X = RND * 320: Y = RND * 200 | 23 PSET (X, Y), C: NEXT A: RETURN That's scatter a hundred dots, colour unspecified, on a 320x200 screen. Dunno what C is, it has values 1 and 9. The routine is called twice. Looks like it may be syntax error... should it be PSET (X, Y, C) perhaps? I'm lost on what C is. | 25 DR = 3.141592 / 180: R = 10 | 30 RANDOMIZE TIMER | 35 DIM X(500), Y(500) | 40 CIRCLE (160, 100), 90, 8 Lost on that, too. Origin, radius perhaps? Maybe an ellipse even. | 45 PAINT (160, 100), 4, 8: PAINT (160, 100), 8, 8 Lost... fill a bounded area with colour? | 100 R = INT(RND * RND * RND * RND * 20) + 1: That's just plain silly. RND returns a real between 0 and 1. LO = RND * 170 - 85 ??? Nope. I can't read it. What is it supposed to do? Androcles. | 105 LA = RND * 140 - 70: C = 8 | 110 X0 = 90 * SIN(DR * LO) * COS(DR * LA) + 160 | 112 Y0 = 76 * SIN(LA * DR) + 100 | 115 GOSUB 300: IF R = 1 THEN PSET (X0, Y0), 14: GOTO 100 | 120 C = 12: GOSUB 130: PAINT (X0, Y0), 4, 12: GOSUB 600: | 125 PAINT (X0, Y0), 7, 12: GOSUB 400: GOSUB 500: GOTO 180 | 130 N = 0: S = 36 / R: FOR A = 1 TO 360 STEP S: N = N + 1 | 140 U = R * SIN(A * DR) + LO: V = R * COS(A * DR) + LA | 150 X = 90 * SIN(DR * U) * COS(DR * V) + B: Y = 76 * SIN(V * DR) | 155 X(N) = X: Y(N) = Y | 160 PSET (X + 160, Y + 100), C | 170 NEXT A: RETURN | 180 PSET (X0, Y0), 15 | 200 GOTO 100 | 300 PCOPY 0, 1: DX = X0 - 160: DY = Y0 - 100 | 305 LINE (DX * 10, DY * 10)-(X0, Y0), 14: GOSUB 600: PCOPY 1, 0 | 310 FOR A = 1 TO R * 4: X1 = X0 + RND * 4 * R - 2 * R | 315 Y1 = Y0 + 4 * RND * R - 2 * R | 320 LINE (X0, Y0)-(X1, Y1), 4: NEXT A: GOSUB 600: PCOPY 1, 0: RETURN | 400 FOR A = 1 TO N: X = X(A): Y = Y(A) | 410 IF X = 0 OR Y = 0 THEN 420 | 412 PSET (X + 160 + X / ABS(X), Y + 100 + Y / ABS(Y)), 0 | 420 NEXT A: RETURN | 500 FOR A = 1 TO N: X = X(A): Y = Y(A) | 510 PSET (X + 160, Y + 100), 14 | 520 NEXT A: RETURN | 600 FOR DE = 1 TO 5: T = TIMER: WHILE TIMER = T: WEND: NEXT: RETURN | | --------------------------------------------------------- | |
|
#4
|
|||
|
|||
|
"Ken S. Tucker" wrote in message oups.com... | | Ken S. Tucker wrote: | Hey Andro, | Try running this little program, far below. | If it works I have another better one. | Ken | PS: maybe this will keep the kids from breaking | your windows! | | +++++++++++++++++++++++++++++++++ | | Newsgroups: alt.sci.planetary | From: (David Williams) - Find messages by | this author | Date: Sat, 20 Dec 2003 23:16:12 -0600 | Local: Sat, Dec 20 2003 10:16 pm | Subject: cratering program | Reply to Author | Forward | Print | Individual Message | Show original | | Report Abuse | | Ken Tucker (who often posts here) has asked me to post the following | little BASIC program that he wrote with his son, Travis, some 15 years | ago. It was written in some old dialect of BASIC, with line numbers, | but works okay in QBasic, and probably others. What it does is to draw | an image of a sphere floating in a starry sky, and then show the sphere | being bombarded with meteors, producing craters. After a while, the | image does look passably like the moon, or some similar body. | | If nothing else, it is pretty, and is far more interesting to watch | than most screen-savers. | | Please direct any questions to Ken. I'm just the messenger, as far as | this is concerned. | | dow | | ------------------------------------------------------- | | 5 ' Craters. Ken and Travis Tucker. Approx 1988. | 10 CLEAR : SCREEN 7, 0, 0, 0: KEY OFF: CLS | 12 PCOPY 0, 1: PCOPY 0, 2: PCOPY 0, 3: VIEW PRINT 1 TO 25 | 21 C = 1: GOSUB 22: C = 9: GOSUB 22: GOTO 25 | 22 FOR A = 1 TO 100: X = RND * 320: Y = RND * 200 | 23 PSET (X, Y), C: NEXT A: RETURN | 25 DR = 3.141592 / 180: R = 10 | 30 RANDOMIZE TIMER | 35 DIM X(500), Y(500) | 40 CIRCLE (160, 100), 90, 8 | 45 PAINT (160, 100), 4, 8: PAINT (160, 100), 8, 8 | 100 R = INT(RND * RND * RND * RND * 20) + 1: LO = RND * 170 - 85 | 105 LA = RND * 140 - 70: C = 8 | 110 X0 = 90 * SIN(DR * LO) * COS(DR * LA) + 160 | 112 Y0 = 76 * SIN(LA * DR) + 100 | 115 GOSUB 300: IF R = 1 THEN PSET (X0, Y0), 14: GOTO 100 | 120 C = 12: GOSUB 130: PAINT (X0, Y0), 4, 12: GOSUB 600: | 125 PAINT (X0, Y0), 7, 12: GOSUB 400: GOSUB 500: GOTO 180 | 130 N = 0: S = 36 / R: FOR A = 1 TO 360 STEP S: N = N + 1 | 140 U = R * SIN(A * DR) + LO: V = R * COS(A * DR) + LA | 150 X = 90 * SIN(DR * U) * COS(DR * V) + B: Y = 76 * SIN(V * DR) | 155 X(N) = X: Y(N) = Y | 160 PSET (X + 160, Y + 100), C | 170 NEXT A: RETURN | 180 PSET (X0, Y0), 15 | 200 GOTO 100 | 300 PCOPY 0, 1: DX = X0 - 160: DY = Y0 - 100 | 305 LINE (DX * 10, DY * 10)-(X0, Y0), 14: GOSUB 600: PCOPY 1, 0 | 310 FOR A = 1 TO R * 4: X1 = X0 + RND * 4 * R - 2 * R | 315 Y1 = Y0 + 4 * RND * R - 2 * R | 320 LINE (X0, Y0)-(X1, Y1), 4: NEXT A: GOSUB 600: PCOPY 1, 0: RETURN | 400 FOR A = 1 TO N: X = X(A): Y = Y(A) | 410 IF X = 0 OR Y = 0 THEN 420 | 412 PSET (X + 160 + X / ABS(X), Y + 100 + Y / ABS(Y)), 0 | 420 NEXT A: RETURN | 500 FOR A = 1 TO N: X = X(A): Y = Y(A) | 510 PSET (X + 160, Y + 100), 14 | 520 NEXT A: RETURN | 600 FOR DE = 1 TO 5: T = TIMER: WHILE TIMER = T: WEND: NEXT: RETURN | | ---------- | | ++++++++++++++++++++++ | | Hi again Andro. | I doubt there's a mathematician alive who can | see how the above equations render a lunar | surface. So what I've been tryin to do is | create a vision in the thought experiments I | demo. I was wondering about putting them into a | dynamic graphical program with sub-titles, to | explain the thought process. | | You seem to have an edge on programming, so I | was hoping you might...well critisize, | | TIA | Ken I'd be glad to, but the program is devoid of comment. I double even the originator could understand it after a few years. Henri Wilson is more familiar with BASIC than I, he may be able to help. At a glance it seems to distribute random circles on a small screen, maybe with simulated shadows. There is a line at subroutine 300. Certainly R = INT(RND * RND * RND * RND * 20) + 1 will not produce a different result to R = INT(RND*20) + 1, a random integer between 1 and 20. What the timer is for in subroutine 600 I have no idea. Slow the program down? It is pretty horrible if it is. Androcles |
|
#5
|
|||
|
|||
|
Androcles wrote: "Ken S. Tucker" wrote in message Hey I didn't expect a complete analysis, just something to run on qBasic. At a glance it seems to distribute random circles on a small screen, maybe with simulated shadows. There is a line at subroutine 300. Certainly R = INT(RND * RND * RND * RND * 20) + 1 will not produce a different result to R = INT(RND*20) + 1, a random integer between 1 and 20. Sure it's different. I needed to make many small craters compared to big craters. Let's change the numbers to INT(RND*256) then the average is 128, then INT(RND*RND*256) gives an average of 64, and then INT(RND*RND*RND*256) creates an average of 32...etc, this offsets the random to lower numbers, cool eh, but still permits with lesser and lesser probability large craters. The RND^n is widely known as the Tucker Randomizing Function. What the timer is for in subroutine 600 I have no idea. Slow the program down? It is pretty horrible if it is. Of course it does, it's the time base for the famous TRF. It is established by the rate of impacts. Ken |
|
#6
|
|||
|
|||
|
"Ken S. Tucker" wrote in message oups.com... | | Androcles wrote: | "Ken S. Tucker" wrote in message | | Hey I didn't expect a complete analysis, just | something to run on qBasic. | | At a glance it seems to distribute random circles on a small screen, | maybe with simulated shadows. There is a line at subroutine 300. | | Certainly R = INT(RND * RND * RND * RND * 20) + 1 | will not produce a different result to R = INT(RND*20) + 1, a random | integer between 1 and 20. | | Sure it's different. I needed to make many small | craters compared to big craters. Let's change | the numbers to INT(RND*256) then the average | is 128, then INT(RND*RND*256) gives an average | of 64, and then INT(RND*RND*RND*256) creates an | average of 32...etc, this offsets the random to | lower numbers, cool eh, but still permits with | lesser and lesser probability large craters. Oh, ok. It's YOUR code; I should have been diplomatic, I thought it was something the cat dragged in amd you wanted a critique :-) Whatever floats your whistle, but it seems to me that for a crater simulator, the big impact would throw up a lot of debris which would then fall back and make the small craters on top of the big crater, whereas in your model the big crater would obliterate the small craters you previously created. | The RND^n is widely known as the Tucker Randomizing | Function. | | What the timer is for in subroutine 600 I have no idea. Slow the program | down? | It is pretty horrible if it is. | | Of course it does, it's the time base for the famous | TRF. It is established by the rate of impacts. | Ken Whatever toots your boat, Ken. I think the craters left on Jupiter by Levy-Shoemaker have vanished. :-) Androcles |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Code of Universe vs Genetic Code 6: Commutative vs Noncommutative 2 | OsherD | Physics - General Discussion | 1 | July 6th 05 02:35 PM |
| Code of Universe vs Genetic Code 5: Commutative or Noncommutative? | OsherD | Physics - General Discussion | 2 | July 6th 05 07:57 AM |
| Code of Universe vs Genetic Code 4: Randall, Wesson, Weak Equivalence | OsherD | Physics - General Discussion | 0 | July 6th 05 06:30 AM |
| Code of Universe vs Genetic Code 3: Paul S. Wesson U. Waterloo | OsherD | Physics - General Discussion | 0 | July 5th 05 11:20 PM |
| Tight binding & density of states (DoS) | Gernot Pfanner | Physics - General Discussion | 2 | May 24th 05 05:02 AM |