Posts: 144
Threads: 8
Joined: Feb 2004
Quote:PlayGGY Wrote:The hard part is making the word random
It is random, on the second line there is a randomize timer statement so that the random numbers are different each time, the word number is n, on the second line there is a n = int(3 * rnd + 1), so n is a random number between 1 and 3.
Quote:Mine is 16 lines, and is a real-time pong sort of game.
Post what you have so far, someone else might be able to help cut the line number down.
No, I was kidding around about making the word random... I meant a random word from the whole dictionary (ie. the word is any word).
About my code... I just shortened it to 15, and I should be able to hack my way around it in a little bit. I need to be able to do this...
Posts: 144
Threads: 8
Joined: Feb 2004
YES!!
I did it!!
I will go ahead and tweak the numbers around to make it more fun. WOW! Once I am done I will post the code. I garauntee it will be the nastiest code you have ever seen.
Posts: 144
Threads: 8
Joined: Feb 2004
Here it is ( I am posting this in the Projects forum, too, where I will explain some what I did):
Code:
1 : SCREEN 13
2 : IF INP(96) = 57 THEN pX = pX - -(pX > 1) ELSE pX = pX + -(pX < 39)
3 : DRAW "c0 bm" + STR$(pX - 1 + 136) + ",130 r7 bm" + STR$(bX + 23 - 1 + 136) + "," + STR$(bY + 2 - 1 + 66) + "f2 bm" + STR$(bX + 23 + 1 + 136) + "," + STR$(bY + 2 - 1 + 66) + "g2 c1 bm136,66 r45 d65 l45 u64 c2 bm" + STR$(pX + 136) + ", 130 r5 c4 bm" + STR$(bX + 23 + 136) + "," + STR$(bY + 2 + 66) + "r0"
4 : bX = bX + ((bS AND 1) * 2) - 1
5 : bY = bY + (bS AND 2) - 1
6 : IF bX <= 1 - 23 OR bX >= 44 - 23 THEN bS = bS + -(((bS AND 1) * 2) - 1)
7 : IF ((bX >= pX - 23) AND (bX <= (pX + 5 - 23)) AND (bY = 63 - 2)) OR (bY = 1 - 2) THEN bS = bS + -((bS AND 2) - 1) * 2
8 : time = TIMER
9 : IF time = TIMER AND ((dummy$ = INKEY$) OR 1) THEN GOTO 9
10 : IF (bY < 65 - 2) THEN GOTO 2 ELSE PRINT " You lose"
'10 line "Wall" pong. Made by Daniel Miller.
'Controls: Hold space bar to move to the left.
' Let go to move to the right.
'Features: No flicker
' No keyboard "clicks"
' Goes the same speed on every computer
Posts: 2,765
Threads: 138
Joined: Nov 2002
DUDE! thats is so cool! im speechless
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Posts: 144
Threads: 8
Joined: Feb 2004
Thanks a alot!
I was up untill 3:30 last night working on it. I think that this is as complicated a game as ca be made in 10 lines... or at least it better be.
Posts: 144
Threads: 8
Joined: Feb 2004
Sorry, I will have the updated collision detection up in a bit... I am having some problems...
Posts: 144
Threads: 8
Joined: Feb 2004
Here:
Code:
1 : SCREEN 13
2 : IF INP(96) = 57 THEN pX = pX - -(pX > 1) ELSE pX = pX + -(pX < 39)
3 : DRAW "c0 bm" + STR$(pX - 1 + 136) + ",130 r7 bm" + STR$(bX + 23 - 1 + 136) + "," + STR$(bY + 2 - 1 + 66) + "f2 bm" + STR$(bX + 23 + 1 + 136) + "," + STR$(bY + 2 - 1 + 66) + "g2 c1 bm136,66 r45 d65 l45 u64 c2 bm" + STR$(pX + 136) + ", 130 r5 c4 bm" + STR$(bX + 23 + 136) + "," + STR$(bY + 2 + 66) + "r0"
4 : bX = bX + ((bS AND 1) * 2) - 1
5 : bY = bY + (bS AND 2) - 1
6 : IF bX <= 1 - 23 OR bX >= 44 - 23 THEN bS = bS + -(((bS AND 1) * 2) - 1)
7 : IF ((bX >= pX - 1 - 23) AND (bX <= (pX + 6 - 23)) AND (bY = 63 - 2)) OR (bY = 1 - 2) THEN bS = bS + -((bS AND 2) - 1) * 2
8 : time = TIMER
9 : IF time = TIMER AND ((dummy$ = INKEY$) OR 1) THEN GOTO 9
10 : IF (bY < 65 - 2) THEN GOTO 2 ELSE PRINT " You lose"
'10 line "Wall" pong. Made by Daniel Miller.
'Controls: Hold space bar to move to the left.
' Let go to move to the right.
'Features: No flicker
' No keyboard "clicks"
' Goes the same speed on every computer
This should work (when I was saving in text format in QB, it was adding an underscore somewhere in my code for some reason. QB doesn't show it when the file is opened, but notepad does. And I was also having problems with their being extra returns in my code after saving in notepad. Now it is ready! Same program, updated collision detection.
Posts: 2,771
Threads: 96
Joined: Oct 2003
Very nice! A good clean pong game in 10 lines. Im impressed!
Posts: 144
Threads: 8
Joined: Feb 2004
Quote:Very nice! A good clean pong game in 10 lines. Im impressed!
Thanks!
It only uses one key, too! Do I get an award?
Not only that, but it is some of the cleanest code I have seen. When you look at it, you don't even have to think about it to understand what is happenning.
In other words, it might be the worst code ever.
Posts: 2,771
Threads: 96
Joined: Oct 2003
heh was that supposed to be a joke?!?!? lol.
but anyways, you could make the code shorter by changing all the double numbers.
ie change (pX - 1 - 23) to (pX - 24)
Quote:Here:
Code:
7 : IF ((bX >= pX - 1 - 23) AND (bX <= (pX + 6 - 23)) AND (bY = 63 - 2)) OR (bY = 1 - 2) THEN bS = bS + -((bS AND 2) - 1) * 2