-
2
5 PRINT "Bite MY Lucky Seven" 6 PRINT "Most games want you to guess from 1 to 100, but I'm smarter than them." 7 PRINT "Choose any whole number from 0 to 127, and give me 7 guesses." 8 PRINT "I bet after that time, I can tell you what the number is." 9 PRINT CHR$(13);
"Choose your number and press any key to begin" 11 guess = 64
14 guess
= guess
+ (2 AND a
) * 2 ^ (i
) - (1 AND a
) * 2 ^ (i
+ 1) 15 PRINT "For Guess #";
(6 - i
);
", my guess is"; guess
16 PRINT CHR$(13);
"Am I: (0) Correct (1) High (2) Low";
CHR$(13) 17 PRINT "PRESS 0, 1, or 2 please for your answer =>";
20 i
= i
- ((a
- 1) AND 2) / 2 * i
'answer 0, and we win 22 guess
= guess
+ (2 AND a
) * 2 ^ (i
) - (1 AND a
) * 2 ^ (i
+1) 23 PRINT "Your number is "; guess
25 PRINT "Would you like to: (1) Try again" 26 PRINT " (2) Run away crying, unable to stop my awesome power"
Digging around one of my old drives, and I found this old gem, which was something I came up with for a 30 line game challenge...
If you look close, you'll be able to see what made this program a real challenge to write: It has no conditional statements in it, at all! No IF. No SELECT CASE.... No WHILE-WEND cheatery...
The challenge was:
30 Lines maximum, without cheating with :
No use of standard conditional operators.
It has to be a playable "game" of some approximation.
And a time limit of some sort which it had to be finished by...
Anyone else want to give it a go? You have to get creative to follow the rules and make something work, and I'd love to see what other folks come up with to meet the challenge. It definitely made my brain think out of the box, and out of my usual comfort zone. ;)
-
Well right off the bat I'm wondering why you just didn't make your print statements one line, as you can add line break characters using the plus sign?
Pete
-
Well right off the bat I'm wondering why you just didn't make your print statements one line, as you can add line break characters using the plus sign?
Pete
Just so I could "pad" the program to 30 lines. (Same reason for the END statement.). ;)
-
Ah, you were under 30. My mind went to 30 or less, less being better. Most of these types of challenges I got involved in at N54 involved the least amount of code to accomplish something; you know, like make a list of all of the valuable accomplishments made by Democrats. The winner is the one who just leaves the IDE blank... which really upset the guy who coded CLS, and thought he had it in the bag.
Pete
-
Hi
So Steve , TOSHIBA, but I must do these two questions for a better understanding the challenge rules
1.
is void line good for this 30 o less Line Game Challenge?
for example your line of code 2
2.
is good the game also if it is not effective ?
3.
Are REM or ' lines not valid for counting lines of the game?
4.
are tricky '$include:'filename' forbidden?
again TOSHIBA I have made a wrong computation of the number of questions.
Thanks
PS
it seems clear to me that NO standard conditional operators(>=,<=,==), if-then-else, select case end select, while-wend and I suppose no do-until
-
OK, I had to add some padding crap at the end like Steve did to get it to 30-lines, and I used variables when I could have cut them out and used VAL() but again, the challenge was 30-lines, not less.
This is a boring little guess higher or lower card game that keeps track of your score. It randomizes a deck of 52 cards and displays them in, you guessed it, SCREEN 0, the only screen mode anyone needs. Anyway, try not to fall asleep while trying it out; however, It might be fun for some to explore, because it really uses the hell out of one of my favorite QB keywords, INSTR.
Pete
IF INT(VAL(a$
)) > 10 THEN b$
= MID$("JQKA", VAL(a$
) - 10, 1) + MID$(CHR$(3) + CHR$(4) + CHR$(5) + CHR$(6), VAL(MID$(a$
, INSTR(a$
, ".") + 1)), 1) ELSE b$
= LTRIM$(STR$(INT(VAL(a$
)))) + MID$(CHR$(3) + CHR$(4) + CHR$(5) + CHR$(6), VAL(MID$(a$
, INSTR(a$
, ".") + 1)), 1) IF INSTR(mystring$
, b$
) = 0 THEN mystring$
= b$
+ "=" + MID$(a$
, 1, INSTR(a$
, ".") - 1) + "|" + mystring$
msg$
= MID$(mystring$
, 1, INSTR(mystring$
, "=") - 1) + " " LINE INPUT "Will the next card be [h]igher or [l]ower? "; hl$
mystring$
= MID$(mystring$
, INSTR(mystring$
, "|") + 1) score
= score
+ VAL(msg$
)PRINT "Press Esc to end or any key to play again!"
-
Well beyond my skills (I only write multi-thousand line train wrecks), but I found a bit of a bug in "Bite My Lucky Seven". When I choose the number 1 it came up with 1.5, twice. Still, that is pretty innovative coding.
I put an INT around the argument in line 22 and it seemed to work.
P.S. I shouldn't muck about with things I know nothing about. The INT fragged it for catching higher numbers. Fascinating work.
-
BZZZZZZT!!
Pete's been hanging around with the democrats in his state so long, he's forgotten to follow the main challenge of the rules: No use of IF, SELECT CASE, and other common conditional keywords.
You're fired! :P
************************
Hi
So Steve , TOSHIBA, but I must do these two questions for a better understanding the challenge rules
1.
is void line good for this 30 o less Line Game Challenge?
for example your line of code 2
2.
is good the game also if it is not effective ?
3.
Are REM or ' lines not valid for counting lines of the game?
4.
are tricky '$include:'filename' forbidden?
Users are limited to 30 lines, so a blank line is perfectly fine. Count it -- don't count it -- you'd still come in under that 30 line limit. Same way with a line of solid comment with REM or '. Just don't use OVER 30 lines -- and use of $INCLUDE would be a violation of the rules just as a colon would be.
X = 2: Y = 3 <-- this would count as 2 lines, so why wouldn't $INCLUDE:'XYset.bas'??
As for it being "effective", that's entirely subjective. The main challenge was to write a program/game WITHOUT using IF, SELECT, and such, which requires some outside the box thinking. ;)
-
Well beyond my skills (I only write multi-thousand line train wrecks), but I found a bit of a bug in "Bite My Lucky Seven". When I choose the number 1 it came up with 1.5, twice. Still, that is pretty innovative coding.
I put an INT around the argument in line 22 and it seemed to work.
Now how the BEEP did it do that?? It should move along in powers of 2... 64, 32, 16, 8, 4, 2, 1...
I'm gonna have to dig around and see if it's my math that's wrong, or just some quirk of single precision routines that's off, or what the heck is happening. All answers should be integer values, which change by the power of 2.
-
Now how the BEEP did it do that?? It should move along in powers of 2... 64, 32, 16, 8, 4, 2, 1...
I'm gonna have to dig around and see if it's my math that's wrong, or just some quirk of single precision routines that's off, or what the heck is happening. All answers should be integer values, which change by the power of 2.
It was doing that until I tried to fix it. It really didn't like that. I should have known it wouldn't be that easy...
-
Yeah. I chose 21, it proudly declared my answer was 21.5! I played around 10 times and it got it right on the nose 8 out of the 10, and was 0.5 off the other 2. Not bad. 4 in 5 is better than I could have done! Lol
-
Oh, you assumed I read the instructions. I didn't, just the 30-lines and make a game. It's a 30-line game. :D
Writing a program without conditional statements would be like having sex without a partner.
Oh well, it was so much fun, I'll just post it as a new challenge. In other words, take matters into my own hand. Oh wait, why do I suddenly feel guilty of hypocrisy?
Pete
-
Yeah. I chose 21, it proudly declared my answer was 21.5! I played around 10 times and it got it right on the nose 8 out of the 10, and was 0.5 off the other 2. Not bad. 4 in 5 is better than I could have done! Lol
And somehow, this just totally astounds me...
guess + (2 AND a) * 2 ^ (i) - (1 AND a) * 2 ^ (i + 1)
guess starts at 64. a starts at 0. i starts at 5....
First guess: 64 + (2 AND 0... which is 0) - (1 AND 0... Which is 0).... Gives 64 in the end.
Second guess: guess starts at 64. a would be 1 (guessed high). i is now 4.
64 + 0 - 1 * 2 ^ 5.... 64-32 = 32
Third guess: 32 + 0 - 1 * 2 ^ 4 = 16
Fourth guess: 8
Fifth guess: 4
Sixth guess: 2
Seventh guess: 1
2 + 0 - 1 * 2 ^ (-1 + 1) = 1
How can the math generate half digit values?? I'm completely baffled by the reports you guys are giving.
We start with 64, then +/- 32, then +/- 16... 8.. 4... 2.... 1... How do we EVER get a half point in there??
-
I made a simple addition program to add up some rental improvement tax crap a couple of weeks ago, and ran into the same problem. Now for my office software, I made a function to fix these screwy mistakes computers make, apparently because they count in binary instead of base 10. So I'm not sure if this is what your guessing game is encountering, but I am saying you can't trust binary counting systems to do simple math without applying correctional methods to ensure the proper outcome.
Pete
-
Yeah. I chose 21, it proudly declared my answer was 21.5! I played around 10 times and it got it right on the nose 8 out of the 10, and was 0.5 off the other 2. Not bad. 4 in 5 is better than I could have done! Lol
And somehow, this just totally astounds me...
guess + (2 AND a) * 2 ^ (i) - (1 AND a) * 2 ^ (i + 1)
guess starts at 64. a starts at 0. i starts at 5....
First guess: 64 + (2 AND 0... which is 0) - (1 AND 0... Which is 0).... Gives 64 in the end.
Second guess: guess starts at 64. a would be 1 (guessed high). i is now 4.
64 + 0 - 1 * 2 ^ 5.... 64-32 = 32
Third guess: 32 + 0 - 1 * 2 ^ 4 = 16
Fourth guess: 8
Fifth guess: 4
Sixth guess: 2
Seventh guess: 1
2 + 0 - 1 * 2 ^ (-1 + 1) = 1
How can the math generate half digit values?? I'm completely baffled by the reports you guys are giving.
We start with 64, then +/- 32, then +/- 16... 8.. 4... 2.... 1... How do we EVER get a half point in there??
Did you try 21?
-
PRINT "i="; i
22 guess = guess + (2 AND a) * 2 ^ (i) - (1 AND a) * 2 ^ (i)
for 21, i = -1 and 2 ^ -1 = .5
typo on line 22 to match line 14
22 guess = guess + (2 AND a) * 2 ^ (i) - (1 AND a) * 2 ^ (i +1) ' i + 1 fixes
-
here is my entry, less than 30 lines, no IF\THEN or SELECT\CASE.
'Card Guessing Game, Kobolt 9/17/2018-12:15pm Ver 1.0, 22 lines!
PRINT "(S)pade, (C)lubs, (H)earts, (D)iamonds, Ace-1, Jack-11, Queen-12, King-13", SPACE$(80) INPUT "What card is it (ex-D8=8 of Diamonds)"; a$
Try~% = Try~% + 1
Good~% = Good~% + 1
PRINT "Total trys:"; Try~%;
" for "; Good~%;
" Correct!" DATA "a garden tool","used when somebody is bad","gotta love with this","Ladies best friend","S","C","H","D"
-
I don't know why the math is acting the way it is, but as a game designer, I follow the "first fix wins now, best fix wins later" principle.
Putting INT() around the final guess at least undoes the whole .5 thing and makes the guess correct:
You're right, Steve, how does binary math produce decimals? Without division, there should be no .5's in there. Do we actually have an instance of binary math producing fractional numbers?
You know what that'll do to society? Girls playing with trucks. Boys playing with dolls. Horses eating each other. Yes, horses eating each other! It's in the Bible, Fracine!
I tried to DIM guess as _byte, and it would guess 22 for 21, 6 for 5, 2 for 1. I tried to DIM guess, a, i, j as _byte, it brought back the .5's! I'm going to look more into this.
-
PRINT "i="; i
22 guess = guess + (2 AND a) * 2 ^ (i) - (1 AND a) * 2 ^ (i)
for 21, i = -1 and 2 ^ -1 = .5
typo on line 22 to match line 14
22 guess = guess + (2 AND a) * 2 ^ (i) - (1 AND a) * 2 ^ (i +1) ' i + 1 fixes
That's what it is! The formula is correct, which is why I couldn't sort out what the heck was wrong with it!! ;D
Typos are hell to find. Your brain knows what *should* be there, and it just overlooks the issue completely. NOW, the guessing game actually guesses like it's supposed to.
One good thing about the glitch: It probably helped everyone understand how it actually works now -- Binary search up/down in powers of 2 until it finds the solution. :D
****************
Post corrected with the proper formula.
-
Dang, I didn't read on to page two... B+ beat me by two posts making me both the later AND worst fix... Foot in mouth. Lol.
-
Have you tried putting peanut butter between your toes? I find it it helps take the edge off.
Dammit Steve, I remember when that typo crap started with me. It's just a sign of aging. Pretty soon you'll be wondering where you put your keys, and then discovering it doesn't matter, because you can't remember where you parked your car. After that, well, just hang on to that URL I posted for those "PEP" pills.
Kidding aside, thanks for posting this challenge. It got me off my duff from endless organizing, which I hate to do anyway, and got me back to doing something fun, even though I didn't read the directions. That card suit technique I came up with was new, and new stuff makes me happy. I seldom pull code from my repository, which sounds strangely akin to pulling something out of something else, but I digress. If I can code something fresh, it's more fun but I have to admit, aging hasn't helped when it comes to the occasional goofs.
Pete
- I'm thinking of skipping my birthday this year, whenever the hell that is.
-
Hey I got it! Here is Digit Thief Level 2:
You have only 3 digits 0, 1, 2 because you live in a world where everyone has 1 finger on the upper hand and 2 digits on their lower hand... but I guess that's a different story... ;-))
BTW this could just as easily been 10 digits but I wanted a real threat of loosing all your digits before you are done guessing. Still there is one sure strategy to never loose, boring though... Come to think, could have a rule to prevent that but that would be more lines and IF's, anyway... ;-))
So using only FOR loops to substitute for IF's and all other flow control mechanisms except GOTO, here is Digit Thief Level 2 at 24 lines (no colons except for line labels and no externals) plus 1 code debugger line I left in:
jumpStart:
gCount% = 0
digits$ = "012"
loopAgain:
'PRINT "(debug thief is here:"; thief%; ")" '<<<<< I used this line to check my code
INPUT "Enter Guess (0 to 2) where the digit thief is now "; guess%
gCount% = gCount% + 1
kstart = -1 * (guess% <> thief%)
PRINT "You caught the thief in" + STR$(gCount%
) + " guesses." MID$(digits$
, thief%
+ 1, 1) = " " PRINT "Digits Left Update: " + digits$
lstart
= -1 * (digits$
<> STRING$(3, " ")) PRINT "Dang! too late! Gone in" + STR$(gCount%
) + " guesses."
BTW there is no escape from Level 2. ha, ha, ha....
EDIT: one less FOR loop, one less line 23 lines plus a debugger commented out.
-
Oh I just made 30 Line limit, Digit Thief 3 minus IF.bas now prevents digit guarding.
RANDOMIZE TIMER ' Digit Thief 3 minus IF.bas for QB64 2018-09-18 B+ prevent "digit guarding" jumpStart:
gCount% = 0
digits$ = "012"
lastGuess% = -999
loopAgain:
INPUT "Enter Guess (0 to 2) where the digit thief is now "; guess%
jstart = -1 * (guess% <> lastGuess%)
PRINT "Give Digit Thief a 50/50 chance! No digit guarding, make a different choice." gCount% = gCount% + 1
lastGuess% = guess%
kstart = -1 * (guess% <> thief%)
PRINT "You caught the thief in" + STR$(gCount%
) + " guesses." MID$(digits$
, thief%
+ 1, 1) = " " PRINT "Digits Left Update: " + digits$
lstart
= -1 * (digits$
<> STRING$(3, " ")) PRINT "Dang! too late! Gone in" + STR$(gCount%
) + " guesses."
-
Wait jus ah dad-burn minute thar Varmint! You stole that thar name from me! Oops, sorry, err, my version was called Idgit Thief.
- Sam
-
And here is: 21 minus IF.bas
DATA 2,3,4,5,6,7,8,9,10,10,10,10,11,2,3,4,5,6,7,8,9,10,10,10,10,11,2,3,4,5,6,7,8,9,10,10,10,10,11,2,3,4,5,6,7,8,9,10,10,10,10,11 'DO 'to run in loop uncomment, commented lines == Way more fun!!!
'CLS: di% = 0: playerT% = 0: dealerT% = 0
SWAP deck%
(r%
), deck%
(i%
) di% = di% + 1
playerT% = playerT% + deck%(di%)
i% = (playerT% < 15)
istart% = -1 * (playerT% > 21)
di% = di% + 1
dealerT% = dealerT% + deck%(di%)
i% = (dealerT% < playerT%)
istart%
= -1 * (playerT%
> 21 OR (dealerT%
< 22 AND dealerT%
>= playerT%
)) PRINT "Hey Player, you Won!" PRINT "Sorry Player, Dealer Won!" skip:
'_DELAY 4
'LOOP 'this is line 34 minus 4 commented lines = 30 !
-
Here is my entry. Started it last night. Finished it about an 30mins ago, then played it a little.
It's a simple dice game. No IFs, WHILEs, DOs, SELECTs, and all logic is math based. Please tell me if the instructions are clear enough. It's quite a complex little game for 30 lines! Which made it kind of hard to sum up. Lol.
4 keep(die%%) = 0
5 tally(die%%) = 0
6 dice
(die%%
) = INT(RND * 6 + 1) 8 kept%% = 0
11 this%% = kept%%
12 FOR die%%
= kept%%
+ 1 TO 6 PRINT "Welcome to DICE!";
CHR$(13);
CHR$(13);
"Choose your selections carefully, as after you have made decisions on all dice,";
"the game rerolls. You MUST keep at least 1 die each roll, and once you have kept";
"6 dice, you will receive your score for the round.";
CHR$(13);
"REMEMBER: When you do not keep a die, it is rerolled.";
CHR$(13);
CHR$(13);
"Your goal is to reach 20000pts! Have Fun!";
CHR$(13);
CHR$(13);
"SCORE HELP";
CHR$(13);
"----------";
CHR$(13);
"1=100 2=0 3=0 4=0 5=50 6=0";
CHR$(13);
"Triple 1's=1000 Triple 4's=400";
CHR$(13);
"Triple 2's=200 Triple 5's=500";
CHR$(13);
"Triple 3's=300 Triple 6's=600";
CHR$(13);
"A straight of 1-6=2000";
STRING$(4, 13);
"Current score is:"; score%;
"/ 20000";
CHR$(13);
"Dice rolled in this hand: "; dice
(1); dice
(2); dice
(3); dice
(4); dice
(5); dice
(6);
CHR$(13);
"Dice you have kept this round: "; keep
(1); keep
(2); keep
(3); keep
(4); keep
(5); keep
(6);
CHR$(13);
CHR$(13);
"Keep die";
RTRIM$(STR$(die%%
));
"? [It's a";
RTRIM$(STR$(dice
(die%%
)));
"] (1=y 0=n)";
15 keep(kept%% + 1) = in * dice(die%%)
16 kept%% = kept%% + in
17 tally(keep(kept%%)) = tally(keep(kept%%)) + in
19 hold%% = 2 * (kept%% - this%%)
22 dice
(die%%
) = (ABS(keep
(die%%
) <> 0) * 0) + (ABS(keep
(die%%
) = 0) * INT(RND * 6 + 1)) 24 hand%% = kept%%
score%
= score%
+ (tally
(1) * 100) + (INT(tally
(1) / 3) * 700) + (INT(tally
(2) / 3) * 200) + (INT(tally
(3) / 3) * 300) + (INT(tally
(4) / 3) * 400) + (tally
(5) * 50) + (INT(tally
(5) / 3) * 350) + (INT(tally
(6) / 3) * 600) + (INT(ABS((tally
(1) = 1) + (tally
(2) = 1) + (tally
(3) = 1) + (tally
(4) = 1) + (tally
(5) = 1) + (tally
(6) = 1)) / 6) * 2000) 27 a% = score%
30 PRINT "Congratulations! You beat 20000pts! Your score was:"; score%
[EDIT]Fixed code in code box.
-
Ah nice, as I understand it, all the choices are prearranged and it is matter of choosing combination with yes = * 1 or no * 0 questions. Completely different approach from what I had done.
My tests seem to be getting stuck on choice for selecting 6th die, I keep choosing no and it keeps showing me the same number. I don't fully understand game like how many times you are allowed to reject a die.
-
Ahh... I knew I was forgetting to explain some things. That was my bad. It should explain it better now in the above code.
In case it doesn't(Oh, I broke the challenge rules and used a CASE XD), here is a breakdown of DICE.
You roll a hand of 6 dice.
You get 6 6 4 1 1 5
You decide to take 1 1 5 and keep them.
You now have 1 1 5, and you reroll the 6 6 4 and get 1 3 2.
You decide to take the 1.
You now have 1 1 5 1, and you reroll the 3 2 and get 5 5.
You decide to take both fives.
You end this round with 1 1 5 1 5 5 and earn 1500pts. 1000 for the triple 1's and 500 for the triple 5's.
That ends that round, and then the game rerolls all 6 dice for the next round.
You roll 6 3 1 2 4 5.
You decide to keep all six dice, because you have a straight 1-2-3-4-5-6.
You end the round with 6 3 1 2 4 5 and earn 2000pts. for the straight. You now have a score of 3500pts.
You ALWAYS have to keep at least one(1) die, whether it scores points or not, and you can keep between 1-6 dice from each hand.
-
I needed a distraction, this challenge was perfect.
Here is my entry - Yellow GOOD ... Red BAD
LINE (VAL(LEFT$(m$
, 3)) - 10, VAL(RIGHT$(m$
, 3)) - 10)-(VAL(LEFT$(m$
, 3)) + 10, VAL(RIGHT$(m$
, 3)) + 10), _RGB32(255, 255, 255), BF
' white box LINE (VAL(LEFT$(box
(x
), 3)) - 20, VAL(MID$(box
(x
), 4, 3)) - 20)-(VAL(LEFT$(box
(x
), 3)) + 20, VAL(MID$(box
(x
), 4, 3)) + 20), _RGB32(255, VAL(RIGHT$(box
(x
), 1)) * 255, 0), BF
IF VAL(LEFT$(m$
, 3)) - 10 <= VAL(LEFT$(box
(x
), 3)) + 20 AND VAL(LEFT$(m$
, 3)) + 10 >= VAL(LEFT$(box
(x
), 3)) - 20 AND VAL(RIGHT$(m$
, 3)) - 10 <= VAL(MID$(box
(x
), 4, 3)) + 20 AND VAL(RIGHT$(m$
, 3)) - 10 >= VAL(MID$(box
(x
), 4, 3)) - 20 THEN score = score + 1
box(x) = ""
-
Hi Omerta,
Ahhh, you must accept at least 1 die, got it! Thanks
Omerta: "In case it doesn't(Oh, I broke the challenge rules and used a CASE XD), here is a breakdown of DICE."
LOL that one case might be forgiven :)
Now, how many hands are there? If you have answered this question already, I apologize for my poor reading skills.
Append" OK "For hands = 0 to 6" so seven hands OK
-
Hi Terry,
Damn fine game! but I am seeing some IF's.
It's like those bull riding games, if you last 10 secs you did good the heck with the points!
-
I needed a distraction, this challenge was perfect.
Here is my entry - Yellow GOOD ... Red BAD
LINE (VAL(LEFT$(m$
, 3)) - 10, VAL(RIGHT$(m$
, 3)) - 10)-(VAL(LEFT$(m$
, 3)) + 10, VAL(RIGHT$(m$
, 3)) + 10), _RGB32(255, 255, 255), BF
' white box LINE (VAL(LEFT$(box
(x
), 3)) - 20, VAL(MID$(box
(x
), 4, 3)) - 20)-(VAL(LEFT$(box
(x
), 3)) + 20, VAL(MID$(box
(x
), 4, 3)) + 20), _RGB32(255, VAL(RIGHT$(box
(x
), 1)) * 255, 0), BF
IF VAL(LEFT$(m$
, 3)) - 10 <= VAL(LEFT$(box
(x
), 3)) + 20 AND VAL(LEFT$(m$
, 3)) + 10 >= VAL(LEFT$(box
(x
), 3)) - 20 AND VAL(RIGHT$(m$
, 3)) - 10 <= VAL(MID$(box
(x
), 4, 3)) + 20 AND VAL(RIGHT$(m$
, 3)) - 10 >= VAL(MID$(box
(x
), 4, 3)) - 20 THEN score = score + 1
box(x) = ""
OK, me not willing to read / follow instructions is pretty much a given but a United States Marine doing the same? Oh the horror!
Hey Terry, Steve put the nix on the use of conditional statements for this challenge, so you and I are disqualified. I mean it doesn't effect me either way, because I'm fully stocked up on tissues...oh shut up Bill!, but I'm really worried this could cost you your pension.
Of course, there's always my challenge... https://www.qb64.org/forum/index.php?topic=596.0
Pete :D
-
I count 3 IF's in Terry's program. Each will cost 2 more lines but I see some padding eg sounds...
hmm... might be doable?
WHILE _MOUSEINPUT
that's a tough one.
I would let that pass for mouse and graphics game! :)
-
Hey, Terry. That's a pretty neat little game there. I think you're the only one that got fancy with sounds and graphics! Although, not the only one that used conditionals apparently. XD But, still probably the most addictive game here(Must be the colors and the sounds. Haha).
Hey, B+, I imagine with Digit Thief that he has me blindfolded and he's pinning my hand to a table, and making me guess which finger he'll take next. Kind of dark and sadistic! Lol. Oh, yeah, and we're in the seedy underbelly of a Hong Kong restaurant backroom. XD
Hey, Pete. Neat game, it took me a second to figure out the next card was the card that was higher or lower than the last. But, I like it. I've always liked high or low, because it's simple, clean, and with few rules.
Anyway, here's an updated smoother version of my game. Better explanation, and now you can see your score AND how many turns it took you as well!
4 keep(die%%) = 0
5 tally(die%%) = 0
6 dice
(die%%
) = INT(RND * 6 + 1) 8 kept%% = 0
11 this%% = kept%%
12 FOR die%%
= kept%%
+ 1 TO 6 13 PRINT "Welcome to DICE!";
CHR$(13);
CHR$(13);
"Choose your dice carefully, as after you have made all of your decisions, the game rerolls the dice you did not keep. You MUST keep at least 1 die each hand, and once you have kept 6 dice, you will receive your score for that round.";
CHR$(13);
CHR$(13);
"Your goal is to reach 20000pts! Have Fun!";
CHR$(13);
CHR$(13);
CHR$(13);
"SCORE HELP";
CHR$(13);
"----------";
CHR$(13);
"1=100 2=0 3=0 4=0 5=50 6=0";
CHR$(13);
"Triple 1's=1000 Triple 4's=400";
CHR$(13);
"Triple 2's=200 Triple 5's=500";
CHR$(13);
"Triple 3's=300 Triple 6's=600";
CHR$(13);
"A straight of 1-6=2000";
STRING$(4, 13);
"Current score is:"; score%;
"/ 20000";
CHR$(13);
"Dice rolled in this hand: "; dice
(1); dice
(2); dice
(3); dice
(4); dice
(5); dice
(6);
CHR$(13);
"Dice you have kept this round: "; keep
(1); keep
(2); keep
(3); keep
(4); keep
(5); keep
(6);
CHR$(13);
CHR$(13);
"Keep die";
RTRIM$(STR$(die%%
));
"? [It's a";
RTRIM$(STR$(dice
(die%%
)));
"] (1=y 0=n)";
15 keep
(kept%%
+ 1) = _CEIL(in~%%
/ 255) * dice
(die%%
) 16 kept%%
= kept%%
+ _CEIL(in~%%
/ 255) 17 tally
(keep
(kept%%
)) = tally
(keep
(kept%%
)) + _CEIL(in~%%
/ 255) 19 hold%% = 2 * (kept%% - this%%)
22 dice
(die%%
) = (ABS(keep
(die%%
) <> 0) * 0) + (ABS(keep
(die%%
) = 0) * INT(RND * 6 + 1)) 24 hand%% = kept%%
26 score%
= score%
+ (tally
(1) * 100) + (INT(tally
(1) / 3) * 700) + (INT(tally
(2) / 3) * 200) + (INT(tally
(3) / 3) * 300) + (INT(tally
(4) / 3) * 400) + (tally
(5) * 50) + (INT(tally
(5) / 3) * 350) + (INT(tally
(6) / 3) * 600) + (INT(ABS((tally
(1) = 1) + (tally
(2) = 1) + (tally
(3) = 1) + (tally
(4) = 1) + (tally
(5) = 1) + (tally
(6) = 1)) / 6) * 1850) 27 turn% = turn% + 1
28 a% = score%
30 PRINT STRING$(22, 13);
"Congratulations! You beat 20000pts! You scored"; score%;
"in"; turn%;
"turns!"
-
Yeah, I forgot about not being able to use conditionals. I read the post a week ago when it first came out. Should have read it again.
Oh well, was still a hoot to write
-
Yep. It's amazing what you can stuff into 30 lines when you put your mind to it, right?
-
Are we voting yet? Terry's Atari-like little game was amazing!
-
Are we voting yet? Terry's Atari-like little game was amazing!
Well if the Challenge was for best game 30 lines of less Terry's game is definitely a strong start but the point of this thread was to do this without IF's.
I don't know what Steve thinks of WHILE _MOUSEINPUT, it seems the only way to get mouse but it's one of those WHILE's....
Here is Terry's Game without the IF's and without sound in attempts to get line count back down to 30. I got it to 32 removing a LOCATE and replacing with _PrintString, I also deducted points when struck by red box instead of ending game.
SCREEN _NEWIMAGE(640, 480, 32) ' *** YELLOW GOOD ... RED BAD *** MOD B+ 2018-09-19 remove IF's and sound LINE (VAL(LEFT$(m$
, 3)) - 10, VAL(RIGHT$(m$
, 3)) - 10)-(VAL(LEFT$(m$
, 3)) + 10, VAL(RIGHT$(m$
, 3)) + 10), _RGB32(255, 255, 255), BF
' white box istart
= -1 * ((box
(x
) <> "") AND (VAL(MID$(box
(x
), 4, 3)) <= 500)) LINE (VAL(LEFT$(box
(x
), 3)) - 20, VAL(MID$(box
(x
), 4, 3)) - 20)-(VAL(LEFT$(box
(x
), 3)) + 20, VAL(MID$(box
(x
), 4, 3)) + 20), _RGB32(255, VAL(RIGHT$(box
(x
), 1)) * 255, 0), BF
istart
= -1 * (VAL(LEFT$(m$
, 3)) - 10 > VAL(LEFT$(box
(x
), 3)) + 20 OR VAL(LEFT$(m$
, 3)) + 10 < VAL(LEFT$(box
(x
), 3)) - 20 OR VAL(RIGHT$(m$
, 3)) - 10 > VAL(MID$(box
(x
), 4, 3)) + 20 OR VAL(RIGHT$(m$
, 3)) - 10 < VAL(MID$(box
(x
), 4, 3)) - 20) box(x) = ""
score = score + 1
score = score - 2
skip:
Maybe someone can get two more lines out? Yes, but the sound really added to game...
Or maybe someone can start a 30 lines or less challenge without the IF condition, so all of us can compete under same rules.
-
A few tricks I could see for maybe avoiding WHILE with _MOUSEINPUT :
FOR I = ABS(_MOUSEINPUT) TO 0 STEP -1
I = - _MOUSEINPUT
NEXT
****************
Label:
ON ABS(_MOUSEINPUT) GOTO Label
****************
Neither is tested, but I'd think both should work instead of the WHILE...WEND -- which is really the whole point of these style contests: To have fun and force one to alter their way of thinking to perform otherwise mundane tasks. ;)
-
Here's my entry. Capture the letter being shown by pressing it on your keyboard to score; type a wrong key and lose a point.
Twenty points and you win.
Speed increases as you progress.
difficulty! = 1.5
checkKey:
LINE (x
- (300 * (k$
= letter$
)), y
- (300 * (k$
= letter$
)))-STEP(30, 30), _RGBA32(0, 0, 0, 200), BF
LINE (x
- (300 * (k$
<> letter$
)), y
- (300 * (k$
<> letter$
)))-STEP(30, 30), _RGB32(255, 255, 0), B
score&
= score&
+ ABS(k$
= letter$
) - (ABS(k$
<> letter$
) * ABS(LEN(k$
) > 0)) difficulty!
= difficulty!
- (ABS(k$
= letter$
) / 100)
Edit: changed the location of the _LIMIT line so it's more processor efficient.
[ This attachment cannot be displayed inline in 'Print Page' view ]
-
Steve: "To have fun and force one to alter their way of thinking to perform otherwise mundane tasks." ;)
Yep! I was lost for awhile without my favorite IF but FOR does have a condition branching built-in that can be used.
Another way might be throwing an error? Like when reading data.
-
Or maybe someone can start a 30 lines or less challenge without the IF condition, so all of us can compete under same rules.
We all can compete under the same rules. No conditionals. Lol. It wouldn't be much of a challenge otherwise.
-
Here's my entry. Capture the letter being shown by pressing it on your keyboard to score; type a wrong key and lose a point.
Twenty points and you win.
Fun and fast! It's just random letters, so it's different every time. Steve made one just like it once, but it kept spelling out "Steve is awesome" Now that gets old fast.
Pete :D
-
Hy guys
I am more asleep than how usually I am (at this time ...) :-)
but is it real that the challange was about NO conventional flow instructions?
No WHILE WEND, IF THEN ELSE END IF, DO WHILE LOOP, DO LOOP WHILE, DO UNTIL LOOP, DO LOOP UNTIL, >, < , >=, <=,
No trick like '$include:'Megafile.BI', or more instructions on the same linecode with :
but while I was thinking how to make an IF without an IF , I have had so many ideas but so poor productive time to code and I have forgotten the instructions ON KEY GOSUB and ON x GOSUB /facepalm a simple way to control event/variable without IF .
In the while I've stucked into my first attempt to make an ASCII game and this is the result:
mH% = mH% - 1
mH% = 33000
_PRINTSTRING (1, 1), "Be Cupid! Let meet he and she and gain their loves ! you arrive upon her and leftclick to meet her" _PRINTSTRING (15, 25), "TO PLAY AGAIN PRESS ENTER, ANY OTHER KEY TO QUIT " NEXT match%
, fakeBtn1%
, fakeInput%
2 HerX
= INT(RND * (24 - 2)) + 2 HerY
= INT(RND * (80 - 2)) + 2
Have a fun to search to catch the woman :-)
Thanks to try
PS you guys have posted very good demo
-
Dang! TempodiBasic nice, very nice! You did the mouse without a WHILE AND no <, >, <=, >= but I am not sure how to play game? I try to move mouse He to She but mouse does not obey.
I just suddenly realized how to bring Terry's game back down to 30 lines AND keep the sound AND I am keeping the play going after being hit by red square, just deduct points, still has While for _MOUSEINPUT and now a little mouse arrow and a little flicker on slower machine, I am not getting much flicker:
SCREEN _NEWIMAGE(640, 480, 32) ' *** YELLOW GOOD ... RED BAD *** MOD 2 B+ 2018-09-21 remove IF's Sound is Back! 30 lines!!! LINE (VAL(LEFT$(m$
, 3)) - 10, VAL(RIGHT$(m$
, 3)) - 10)-(VAL(LEFT$(m$
, 3)) + 10, VAL(RIGHT$(m$
, 3)) + 10), _RGB32(255, 255, 255), BF
' white box LINE (VAL(LEFT$(box
(x
), 3)) - 20, VAL(MID$(box
(x
), 4, 3)) - 20)-(VAL(LEFT$(box
(x
), 3)) + 20, VAL(MID$(box
(x
), 4, 3)) + 20), _RGB32(255, VAL(RIGHT$(box
(x
), 1)) * 255, 0), BF
FOR i
= -1 * (VAL(LEFT$(m$
, 3)) - 10 > VAL(LEFT$(box
(x
), 3)) + 20 OR VAL(LEFT$(m$
, 3)) + 10 < VAL(LEFT$(box
(x
), 3)) - 20 OR VAL(RIGHT$(m$
, 3)) - 10 > VAL(MID$(box
(x
), 4, 3)) + 20 OR VAL(RIGHT$(m$
, 3)) - 10 < VAL(MID$(box
(x
), 4, 3)) - 20) TO 0 score = score + 1
score = score - 2
skip:
box(x) = ""
PS for some reason the FOR statement is not allowing me to substitute jstart into the starting slot like I did do with the other FOR starters, I wonder why? too complex an expression for FOR to handle? Can't be! just look at the iStarter!
If we could make that substitution that would give us another line to bring back _DISPLAY or _MOUSEHIDE.
-
Great mods on the game. :)
-
Hi Bplus
thanks to try
the difficult to drive He is a feature coded and not a glitch!
the game is like a Mensa test... or like my IQ test posted on [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there] some year ago, always in ASCII.
The user must find the way to arrive to She. (There are two ways to do this performance)
About the difficult to move He is like in a game that my children have showed me some time ago Octodad https://www.google.it/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&cad=rja&uact=8&ved=2ahUKEwjN6Z-ghM3dAhVHzRoKHSKFD7gQjRx6BAgBEAU&url=https%3A%2F%2Fstore.steampowered.com%2Fapp%2F224480%2FOctodad_Dadliest_Catch%2F&psig=AOvVaw3Ei8raW8ItVh_arct6j3cG&ust=1537651468324172 (https://www.google.it/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&cad=rja&uact=8&ved=2ahUKEwjN6Z-ghM3dAhVHzRoKHSKFD7gQjRx6BAgBEAU&url=https%3A%2F%2Fstore.steampowered.com%2Fapp%2F224480%2FOctodad_Dadliest_Catch%2F&psig=AOvVaw3Ei8raW8ItVh_arct6j3cG&ust=1537651468324172) here website https://en.wikipedia.org/wiki/Octodad:_Dadliest_Catch (https://en.wikipedia.org/wiki/Octodad:_Dadliest_Catch).
Sorry I'm not able to catch a screenshot of the program when you catch She using Print key and pasting in MsPaint. I get a white square into a greater black square. ???
Please someone can suggest me another way to get screenshot of an ASCII game fullscreen?
Thanks
-
http://qb64.freeforums.net/thread/55/save-image-library
SaveImage will save you a BMP or PNG image, regardless of screen mode. Just call it when you want to grab a screenshot.
-
Hi Steve
Thans so much for your fantastic utility!
Now I'm posting screenshot of my ASCIIgame