|
BASIC
Apr 25, 2006 14:39:08 GMT -5
Post by Geekthras (The Gizmo of Yore) on Apr 25, 2006 14:39:08 GMT -5
Somewhere to post your own BASIC programs
Here's a program that finds logarithms in any base: (For TI 84+) Disp "CALCULATES log(B Disp "BASE A WITH Disp "PRECISION P Prompt A Prompt B Prompt P 0->C While A^C<B C+1->C End C-1->C C+1->U C->L While abs(A^C-B)>P (U+L)/2->C If A^C<B Then C->L End If A^C>B Then C->U End End Disp C Disp A^C Disp abs(A^C-B)
-G2-
|
|
|
BASIC
Apr 27, 2006 1:15:37 GMT -5
Post by Slayzie on Apr 27, 2006 1:15:37 GMT -5
A fellow Basic programmer! *is happy* I wrote a simple driving sim in Basic a while back. I'll post it ASAP. It'll only run in the QBasic version though, so if you don't have that...
|
|
|
BASIC
Apr 28, 2006 15:44:38 GMT -5
Post by im_an_alien on Apr 28, 2006 15:44:38 GMT -5
I like to program QBASIC. I'll post a program later as I do not have the code with me right now.
|
|
|
BASIC
Apr 28, 2006 15:55:20 GMT -5
Post by Slayzie on Apr 28, 2006 15:55:20 GMT -5
Maybe we could start a programming league, and call it 'Programmers of Lewasite' or something. Then we could all do BASIC programs on request, and maybe do a colab program. I don't know if that's possible, but it'd be cool as!
|
|
|
BASIC
Apr 28, 2006 15:58:04 GMT -5
Post by -lewa- on Apr 28, 2006 15:58:04 GMT -5
My grandpa gave me his old Commodore64. Yeah yeah..its old, but its actually prety nice to program. WHats nice is that it can communicate with things in the real world. For example, I have this thing with 8 lights on it, and using a value from 0-255 (1 byte=8 bits) I can make the lights light up. Its pretty neat..
|
|
|
BASIC
Apr 28, 2006 16:08:24 GMT -5
Post by Slayzie on Apr 28, 2006 16:08:24 GMT -5
Yeah, that's neat when you can do that. I found a program once that will tell you the temperature using a DIY peripheral thermometer. That was preety sweet!
|
|
|
BASIC
Apr 30, 2006 21:04:51 GMT -5
Post by slippy0 on Apr 30, 2006 21:04:51 GMT -5
I just kinda missed this: 1. lewa, your unbelievebly lucky to have a C64, i've been trying to get one for a while, now their simple soundcard is still used today by my favorite band :-D 2. I made a similar yet much simpler log program (4 lines long, shortes program yet ) Disp "log(X)/log(B)" Disp "log(X) base B" Prompt X,B Disp log(X)/log(B) My longest is about 300 lines, and calculates the zeros, y-intercepts, vertex, directrix, and focus of quadratics in 3 different forms, and the zeros of cubics.
|
|
|
BASIC
May 9, 2006 14:25:14 GMT -5
Post by Geekthras (The Gizmo of Yore) on May 9, 2006 14:25:14 GMT -5
Yeah, found out about the easy way later...
-G2-
EDIT: Shortest ever: For (A,1, 1E100) Disp A End
|
|
|
BASIC
May 9, 2006 15:33:12 GMT -5
Post by im_an_alien on May 9, 2006 15:33:12 GMT -5
10 PRINT "Hello!!!" 20 GOTO 10
ps I made a program that makes random sentances. It has 50 something of nouns, verbs, adjectives, and adverbs stored in arrays. Then it picks a random of each one and puts it in the sentence like this:
[the or a] adjective noun verb adverb
An example of one it made was "The blue telephone pole flew slowly" and another is "the blue dog exploded happily" (just coincidence that they are both blue)
It's made many better ones but I can't remember them.
I'll post the source code as soon as I get a floppy disk.
Oh yeah, it's for QBASIC
edit: oh and also I'll post the one I was going to post a week or two ago
|
|
|
BASIC
May 10, 2006 7:41:03 GMT -5
Post by -lewa- on May 10, 2006 7:41:03 GMT -5
Iv'e been getting better at c64 BASIC. I have this gizmo with 8 lights that plugs into the back of it, and I made them light up in a row...
10 k=1 11 goto 30 20 k=k*2 30 poke 56579,k <-- that make to lights light up 40 for x=0 to 600 <-- 49 and 450 is a delay loop 50 next x 60 if k<127 then goto 20
That will make em' light up in a row.
Cool program idea, alien...that gives me an idea :whistle:
|
|
|
BASIC
May 10, 2006 20:31:27 GMT -5
Post by im_an_alien on May 10, 2006 20:31:27 GMT -5
OK, got the source for programs, will post tommorow, though. Got to go to bed, now...
*sleeps*
|
|
|
BASIC
May 11, 2006 15:14:58 GMT -5
Post by im_an_alien on May 11, 2006 15:14:58 GMT -5
Ok here's new version of "fighting smileys" (the one mentioned a long time ago)
RANDOMIZE TIMER
ON ERROR GOTO errorfound
CLS DIM x1 AS INTEGER DIM y1 AS INTEGER DIM x2 AS INTEGER DIM y2 AS INTEGER DIM p1Health AS INTEGER DIM p2Health AS INTEGER DIM w AS INTEGER DIM prompt AS STRING DIM player AS INTEGER DIM menu AS INTEGER DIM menuChoice AS INTEGER DIM p1name AS STRING DIM p2name AS STRING menu = 1
start:
COLOR 2, 0, 3
DO CLS IF menu = 1 THEN CLS PRINT " FIGHTING SMILIES! v1.0" PRINT PRINT "a) PLAY!" PRINT "b) Instructions" PRINT "c) Exit" PRINT PRINT "Enter menu choice letter" DO z$ = INKEY$ LOOP WHILE z$ = ""
IF z$ = "a" THEN GOTO playgame IF z$ = "b" THEN menu = 2 IF z$ = "c" THEN END END IF IF menu = 2 THEN CLS PRINT " FIGHTING SMILIES! v1.0" PRINT PRINT "Object - To attack the other player and not let them attack you" PRINT PRINT "How to play - Use WASD to move and 'Q' to attack" PRINT INPUT "Press enter to return to main menu...", dummyvar menu = 1 END IF LOOP
playgame: x1 = 25 y1 = 11 x2 = 35 y2 = 11 p1Health = 5 p2Health = 5 player = 1
DO CLS LOCATE 10, 15 PRINT "Player 1 name? (Maximum 10 characters)" LOCATE 11, 15 INPUT ">", p1name LOOP WHILE LEN(p1name) > 10
DO CLS LOCATE 10, 15 PRINT "Player 2 name? (Maximum 10 Characters)" LOCATE 11, 15 INPUT ">", p2name LOOP WHILE LEN(p2name) > 10
DO COLOR 7, 0, 0
CLS
FOR w = 2 TO 79 LOCATE 1, w PRINT CHR$(205) LOCATE 20, w PRINT CHR$(205) NEXT w FOR w2 = 2 TO 19 LOCATE w2, 1 PRINT CHR$(186) LOCATE w2, 60 PRINT CHR$(186) LOCATE w2, 79 PRINT CHR$(186) NEXT w2 LOCATE 1, 1 PRINT CHR$(201) LOCATE 1, 60 PRINT CHR$(203)
LOCATE 1, 79 PRINT CHR$(187)
LOCATE 20, 60 PRINT CHR$(202) LOCATE 20, 79 PRINT CHR$(188) LOCATE 20, 1 PRINT CHR$(200)
IF x1 = x2 AND y1 = y2 THEN COLOR 6, 0, 0 LOCATE y1, x1 PRINT CHR$(1) ELSE COLOR 2, 0, 0 LOCATE y1, x1 PRINT CHR$(1) COLOR 9, 0, 0 LOCATE y2, x2 PRINT CHR$(1) END IF
LOCATE 2, 61 COLOR 2, 0, 0 PRINT "--=="; p1name; "==--"
FOR I = 2 TO 12 LOCATE 3, I + 60 PRINT CHR$(176) NEXT i
FOR I = 2 TO p1Health * 2 + 2 LOCATE 3, I + 60 PRINT CHR$(219) NEXT i COLOR 7, 0, 0 LOCATE 4, 61 PRINT "X = "; x1 LOCATE 5, 61 PRINT "Y = "; y1
LOCATE 7, 61 COLOR 9, 0, 0 PRINT "--=="; p2name; "==--"
FOR I = 2 TO 12 LOCATE 8, I + 60 PRINT CHR$(176) NEXT i
FOR I = 2 TO p2Health * 2 + 2 LOCATE 8, I + 60 PRINT CHR$(219) NEXT i COLOR 7, 0, 0 LOCATE 9, 61 PRINT "X = "; x2 LOCATE 10, 61 PRINT "Y = "; y2
COLOR 2, 0, 0 LOCATE 16, 62 PRINT p1name; "'s turn" COLOR 9, 0, 0 LOCATE 17, 62 PRINT p2name; "'s turn" IF player = 1 THEN LOCATE 16, 61 ELSE LOCATE 17, 61 COLOR 10, 0, 0 PRINT CHR$(16)
5 IF player = 2 AND p2name = "computer" THEN SLEEP 1 SOUND 1000, 1 ELSEIF player = 1 AND p1name = "computer" THEN SLEEP 1 SOUND 1000, 1 ELSE DO z$ = INKEY$ LOOP WHILE z$ = "" END IF
LOCATE 21, 3
IF player = 1 THEN IF p1name = "computer" THEN moved$ = "false" IF x2 = x1 OR x2 = x1 - 1 OR x2 = x1 + 1 THEN IF y2 = y1 OR y2 = y1 - 1 OR y2 = y1 + 1 THEN moved$ = "true" IF NOT INT(RND * 3) + 1 = 1 THEN p2Health = p2Health - 1 LOCATE 21, 5 COLOR 6, 0, 0 PRINT "computer attacked "; p2name; "!" DO z$ = INKEY$ LOOP WHILE z$ = "" ELSE LOCATE 21, 5 PRINT "computer's attack missed!" DO z$ = INKEY$ LOOP WHILE z$ = "" END IF PLAY "mb l16 cdedf" END IF END IF IF moved$ = "false" THEN IF y2 > y1 THEN y1 = y1 + 1 ELSE IF y2 < y1 THEN y1 = y1 - 1 ELSE IF x2 > x1 THEN x1 = x1 + 1 ELSE IF x2 < x1 THEN x1 = x1 - 1 ELSE IF z$ = "q" THEN IF x1 = x2 OR x1 = x2 - 1 OR x1 = x2 + 1 THEN IF y1 = y2 OR y1 = y2 - 1 OR y1 = y2 + 1 THEN IF NOT INT(RND * 3) + 1 = 1 THEN p2Health = p2Health - 1 LOCATE 21, 5 PRINT p1name; " attacked "; p2name; "!" DO z$ = INKEY$ LOOP WHILE z$ = "" ELSE LOCATE 21, 5 COLOR 6, 0, 0 PRINT p1name; "'s attack missed!" DO z$ = INKEY$ LOOP WHILE z$ = "" END IF PLAY "mb l16 cdedf" END IF END IF END IF
IF z$ = "a" THEN x1 = x1 - 1 IF z$ = "d" THEN x1 = x1 + 1 IF z$ = "w" THEN y1 = y1 - 1 IF z$ = "s" THEN y1 = y1 + 1
END IF
IF x1 = 1 THEN x1 = 2 IF x1 = 60 THEN x1 = 59 IF y1 = 1 THEN y1 = 2 IF y1 = 20 THEN y1 = 21 END IF
IF player = 2 THEN IF p2name = "computer" THEN moved$ = "false" IF x1 = x2 OR x1 = x2 - 1 OR x1 = x2 + 1 THEN IF y1 = y2 OR y1 = y2 - 1 OR y1 = y2 + 1 THEN moved$ = "true" IF NOT INT(RND * 3) + 1 = 1 THEN p1Health = p1Health - 1 LOCATE 21, 5 COLOR 6, 0, 0 PRINT p2name; " attacked "; p1name; "!" DO z$ = INKEY$ LOOP WHILE z$ = "" ELSE LOCATE 21, 5 COLOR 6, 0, 0 PRINT p2name; "'s attack missed!" DO z$ = INKEY$ LOOP WHILE z$ = "" END IF PLAY "mb l16 cdedf" END IF END IF IF moved$ = "false" THEN IF y1 > y2 THEN y2 = y2 + 1 ELSE IF y1 < y2 THEN y2 = y2 - 1 ELSE IF x1 > x2 THEN x2 = x2 + 1 ELSE IF x1 < x2 THEN x2 = x2 - 1 ELSE IF z$ = "q" THEN IF x2 = x1 OR x2 = x1 - 1 OR x2 = x1 + 1 THEN IF y2 = y1 OR y2 = y1 - 1 OR y2 = y1 + 1 THEN IF NOT INT(RND * 3) + 1 = 1 THEN p1Health = p1Health - 1 LOCATE 21, 5 PRINT p2name; " attacked "; p1name; "!" DO z$ = INKEY$ LOOP WHILE z$ = "" ELSE LOCATE 21, 5 COLOR 6, 0, 0 PRINT p2name; "'s attack missed!" DO z$ = INKEY$ LOOP WHILE z$ = "" PRINT END IF PLAY "mb l16 cdedf" END IF END IF END IF
IF z$ = "a" THEN x2 = x2 - 1 IF z$ = "d" THEN x2 = x2 + 1 IF z$ = "w" THEN y2 = y2 - 1 IF z$ = "s" THEN y2 = y2 + 1
END IF IF x2 = 1 THEN x2 = 2 IF x2 = 60 THEN x2 = 59 IF y2 = 1 THEN y2 = 2 IF y2 = 20 THEN y2 = 21 END IF
IF player = 1 THEN player = 2 ELSE player = 1
IF p1Health = 0 THEN GOTO p2win IF p2Health = 0 THEN GOTO p1win
LOOP UNTIL z$ = CHR$(27)
END
p1win: CLS PRINT p1name; " wins!" PLAY "L8 GBACDF L4 E" PRINT PRINT "Play again? (Y/N)" DO z$ = INKEY$ LOOP WHILE z$ = "" IF z$ = "y" THEN GOTO start END
p2win: CLS PRINT p2name; " wins!" PLAY "L8 GBACDF L4 E" PRINT PRINT "Play again? (Y/N)" DO z$ = INKEY$ LOOP WHILE z$ = "" IF z$ = "y" THEN GOTO start END
errorfound: CLS COLOR 2, 0, 0 PRINT PRINT "ERROR #"; ERR; "!" COLOR 2, 0, 0 PRINT PRINT "Please report this error to aliens.r.cool@gmail.com using the" PRINT "following form" PRINT PRINT "[subject] Fighting Smilies error" PRINT "Error Number <error number>" PRINT "<what you were doing when it crashed>" PRINT PRINT "Also, include whether or not you want to be credited for" PRINT "Beta-testing / contributing on the official VirtualDice website," PRINT "and if so, what you want to be called." PRINT INPUT "Press <enter> to quit", dummyvar END
and here's my awesome random sentence generator!!!!!
...oops, I saved in QBASIC format, not plain text... oops. I'll just have to re-save and use plain text
|
|
|
BASIC
May 12, 2006 14:13:36 GMT -5
Post by -lewa- on May 12, 2006 14:13:36 GMT -5
Umm...I dont exactly feel like typing all that into my c64. Sorry. (of course I'd haveto translate it first...)
|
|
|
BASIC
May 12, 2006 15:51:00 GMT -5
Post by im_an_alien on May 12, 2006 15:51:00 GMT -5
But you can copy/paste into a .bas file and run with QBASIC
|
|
|
BASIC
May 12, 2006 20:01:54 GMT -5
Post by Slayzie on May 12, 2006 20:01:54 GMT -5
Here's the alpha test version of 2d driving simulator. Don't say you made it, cause you didn't.
DIM car%(1000) SCREEN 9 LINE (10, 10)-(22, 16), , B LINE (11, 8)-(13, 10), , B LINE (11, 16)-(13, 18), , B LINE (18, 7)-(21, 10), , B LINE (18, 16)-(21, 19), , B LINE (22, 11)-(24, 10) LINE (22, 15)-(24, 16) LINE (25, 10)-(27, 16), , B LINE (10, 11)-(8, 11) LINE (10, 16)-(8, 16) LINE (8, 17)-(7, 10), , B GET (6, 6)-(28, 20), car% 1 COLOR 14 CLS SOUND 262, 10 SOUND 330, 10 SOUND 392, 10 SCREEN 1 PRINT "Sontann Studios' 2d driving sim" 10 CLS COLOR 2 LINE (120, 80)-(400, 220), , BF LINE (80, 40)-(440, 260), , B PAINT (1, 1) PUT (411 - x, 61 + y), car%, PSET COLOR 14 PRINT "Press Num.4 to go Forward, press Num.6 to go Backward" PRINT "press Num.8 to go Up and Num.5 to go Down" 200 c$ = INKEY$: IF c$ = "" THEN 200 IF c$ = "4" THEN x = x + 1 IF c$ = "5" THEN y = y + 1 IF c$ = "6" THEN x = x - 1 IF c$ = "8" THEN y = y - 1 IF x <= -3 OR x >= 330 THEN 300 IF y <= -20 OR y >= 189 THEN 300 IF x <= 10 OR x >= 307 THEN 210 IF y >= 7 AND y <= 160 THEN 300
210 PUT (411 - x, 61 + y), car%, PSET PLAY "O1L64c" GOTO 200 300 CLS : PAINT (12, 12), 4 301 SOUND 100, 40: FOR M = 1 TO 100000: NEXT M: CLS 302 PRINT " You crashed!!" PRINT " Would you like to (t)ry again or (q)it? " 500 z$ = INKEY$: IF z$ = "q" THEN END: IF z$ = "t" THEN GOTO 10 GOTO 500 CLS
EDIT: Btw, Fighting Smilies rocks!
|
|
|
BASIC
May 13, 2006 8:57:25 GMT -5
Post by im_an_alien on May 13, 2006 8:57:25 GMT -5
Yay someone likes it btw, I think I forgot to say if you put "computer" for someone's name then the computer will play as that player.
|
|
|
BASIC
May 15, 2006 0:49:23 GMT -5
Post by Blastgirl on May 15, 2006 0:49:23 GMT -5
I love it when you guys make smilies do all kinds of different things. I didn' t know there were so many different kinds of smilies.
|
|
|
BASIC
May 16, 2006 15:38:05 GMT -5
Post by im_an_alien on May 16, 2006 15:38:05 GMT -5
Slayer, I noticed that right after "PRINT "Sontann Studios' 2d driving sim"" you CLS'ed. You should put "sleep" in a new line between the two lines so you can read "Sontann Studios' 2d driving sim" before the screen is cleared
|
|