Guess My Number - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3) +---- Forum: Programs (https://staging.qb64phoenix.com/forumdisplay.php?fid=7) +---- Thread: Guess My Number (/showthread.php?tid=900) Pages:
1
2
|
Guess My Number - SierraKen - 09-18-2022 This is probably the oldest BASIC game I've ever made back in High School in the 80's. I was bored today so I threw it together again with QB64. Guess the computer's number from 1 to 100. It adds up how many tries you take. Code: (Select All) start: RE: Guess My Number - PhilOfPerth - 09-18-2022 Pretty complex! My first "program" was a horizontal line of about 10 dots at the right of the screen, that slowly moved across the screen and disappeared on the left, then a message underneath that said "Dirty little grub!" It never got published, despite the obvious technical skills involved. RE: Guess My Number - bplus - 09-19-2022 Here is one-liner version (double parking with colons): Code: (Select All) 1 If U = S Then S = Int(Rnd * 98) + 1: GoTo 1 Else If U <> S Then Input "0<Guess<99="; U: If U = S Then Print "=": GoTo 1 Else If U < S Then Print "+": GoTo 1 Else Print "-": GoTo 1 RE: Guess My Number - SierraKen - 09-20-2022 Thanks B+, that's impressive. RE: Guess My Number - DANILIN - 09-25-2022 Guess Number 2019... 2021 https://qb64forum.alephc.xyz/index.php?topic=3999 Computer guessing from Milliard https://qb64forum.alephc.xyz/index.php?topic=3999.msg133452#msg133452 Code: (Select All) t = 0: h1 = 0: h2 = 10^7: RANDOMIZE TIMER ' DANILIN daMilliard.bas Code: (Select All) h1=0: h2=10^7: t=1: f=0: Randomize Timer ' DANILIN daMilliard.bas Code: (Select All) 1 human = 1326126 comp = 1928303 less + C# + Python version OnLine Execute https://jdoodle.com/ia/vY4 RE: Guess My Number - mnrvovrfc - 09-25-2022 One of my first programs, on Radio Shack TRS-80 Color Computer 2, was a cross between Space Invaders and Defender. It put the player's ship on the screen with one enemy. The player could only move forward to the right-hand side of the small green screen and then wrapped around to the left-hand side. Whenever the bad guy was shot at and hit, the program did a ridiculous blink of the whole screen for a few seconds, with sound. The logic for the bad guy to move around was bad. No wait, another one that I did was alike but the bad guy was always at a random location. Not very playable. It was less playable than the contribution in the QB64 Samples by the programmer from Argentina, in which the bad guy was called "Commander Garri". Always updated with "CLS" LOL. I actually did a remake of the "random location bad guy" game with QB64 SDL version. However it chooses ten locations that the enemy keeps shuffling among. I created a MOD tracker music file especially to play in that game too. Also I wanted to go further with a "game" found in the Coco2 manual, which was "text mode" graphics and responded to joystick. It was supposed to be a spaceship plotting through stars to land on a planet. The problem was it always put the planet on a specific corner of the screen and the player only had to set the joystick in like manner so that, "I won." That was with the "cheap" joystick; the "Color Joystick" presented the other problem of having the ability to lock to the center position. "Whoa we're halfway there, oh-ho! Living on a prayer" ROFLMAO. When I tried to change it, it was one of my very first attempts to introduce real animation in an arcade-style game. Another thing was that Coco2 didn't come with Extended BASIC and therefore had to use "PEEK()" to read the joystick button; unlike for reading the positions it didn't have a dedicated command to read the buttons. The manual also had this program called an "inventory storage", which used string arrays. It employed the slow bubble sort too. I was very ignorant at the time to realize it was the beginning of a text editor like "EDLIN" for MS-DOS, however had to change "INPUT" requests into those that could have used "INKEY$". RE: Guess My Number - SierraKen - 09-25-2022 mnrvovrfc, you might like my Tech Invaders 4 game. It's kinda like a mix between Space Invaders and Galaga. It uses the mouse. You can get it on the forum here: https://staging.qb64phoenix.com/showthread.php?tid=576&highlight=Tech+Invaders RE: Guess My Number - SierraKen - 09-25-2022 That's pretty cool Danilin! RE: Guess My Number - mnrvovrfc - 09-26-2022 (09-25-2022, 08:21 PM)SierraKen Wrote: mnrvovrfc, you might like my Tech Invaders 4 game. It's kinda like a mix between Space Invaders and Galaga. It uses the mouse. You can get it on the forum here:I have checked it out and it's very good. Especially I like the "boss" logic. Thank you. RE: Guess My Number - DANILIN - 11-07-2022 Program dafindnum.bas guesses unanswered number less or more by starting from middle of list and comparing odd and even ones separately Visual: Code: (Select All) 123456789 Won if you guessed less than number before attempt or lost if you guessed from beginning faster It is effective if distribution of guesses is normal undulating however how to evaluate result of integral is still unknown However experimental program is not optimal and it is possible to include a step greater than 2 Code: (Select All) n = 55: Randomize Timer: a = Int(Rnd * (n - 1)) + 1 ' dafindnum.bas Checking 1000 or a dozen thousand showed: Draw 25% and Lose 37.5% and Win 37.5% Code: (Select All) n = 3*10^4: start = Int(1 + n / 2) ' dafindnum99.bas So if a draw is considered a win then algorithm it is effective picture: 10 kB |