Jump to content
IGNORED

# Arlington Horse Racing

## Recommended Posts

Arlington Horse Racing requires Extended Basic.

Use the arrow keys (E and X) to select horse, and confirm with space bar.

Enter you're bet, any win gets 3 x bet - there are no odds or such complexities, it's just a simple game.

Let me know if you think there's more it needs.

ARLINGTON.zip

Edited by TEXAS_JOE
##### Share on other sites

Beautifully done!

##### Share on other sites

Beautifully done!

Thankingyou!

##### Share on other sites

Very nice. I was surprised you can have the shadow sprites follow the main sprites so accurately. Did you design the horses yourself ?

I don't know if you know these little tricks ...

CALL COLOR(11,7,9) :: CALL COLOR(12,11,12)
>>>
CALL COLOR(11,7,9,12,11,12)

CALL CHAR(128,"0000005555FF5555")
CALL CHAR(112,"FFE7FEFFEBF77FFF")
>>>
CALL CHAR(128,"0000005555FF5555",112,"FFE7FEFFEBF77FFF")

And I suppose you only need one call to RANDOMIZE in start of your program.

160 RANDOMIZE :: R=INT(4*RND)+1

Regena writes about randomness on the 99/4 in her column in the February issue. I would like to share some discoveries I have made on this subject with your readers.

First of all, there seems to be some confusion about how the RANDOMIZE statement works in TI BASIC and TI Extended BASIC. As Regena pointed out, if you do not use this statement in your program prior to using the RND function, you will receive the same sequence of numbers each time you run the program. All your friends around the country with 99/4's will get the same numbers as you do, too. When the computer encounters the RANDOMIZE statement, it puts you back at the beginning of a new list of pseudo-random numbers.

That term "pseudo-random" is important. The 99/4A User's Reference Guide makes a point to mention that the RND function "gives you the next pseudo-random number in the current sequence of pseudo-random numbers." If you use the RANDOMIZE statement once, then, you may or may not get the same sequence of numbers. However, using the RANDOMIZE statement over and over again in the program just puts you back at the beginning of another list. In reality, there seem to be certain numbers that the computer prefers to put at the top of its lists, so in games there may be some numbers that are never generated because you never make it far enough up into the current list to get that number. The point is, repeating the RANDOMIZE statement does NOT make your program more random.

I have found that the only way to make the computer generate a totally unpredictable set of numbers is to use the RANDOMIZE statement once at the start of the program, then when you need to wait for the user to press a key, do this:

100 CALL KEY(0, K, S)

110 Z = RND

120 IF S = 0 THEN 100

Since the time it takes a human to press a key will not be exactly the same each time the program is used, the computer will read down the list of pseudo-random numbers an unpredictable number of places.

Steve Davis

##### Share on other sites

Very nice. I was surprised you can have the shadow sprites follow the main sprites so accurately. Did you design the horses yourself ?

I don't know if you know these little tricks ...

CALL COLOR(11,7,9) :: CALL COLOR(12,11,12)
>>>
CALL COLOR(11,7,9,12,11,12)

CALL CHAR(128,"0000005555FF5555")
CALL CHAR(112,"FFE7FEFFEBF77FFF")
>>>
CALL CHAR(128,"0000005555FF5555",112,"FFE7FEFFEBF77FFF")

And I suppose you only need one call to RANDOMIZE in start of your program.

160 RANDOMIZE :: R=INT(4*RND)+1

Regena writes about randomness on the 99/4 in her column in the February issue. I would like to share some discoveries I have made on this subject with your readers.

First of all, there seems to be some confusion about how the RANDOMIZE statement works in TI BASIC and TI Extended BASIC. As Regena pointed out, if you do not use this statement in your program prior to using the RND function, you will receive the same sequence of numbers each time you run the program. All your friends around the country with 99/4's will get the same numbers as you do, too. When the computer encounters the RANDOMIZE statement, it puts you back at the beginning of a new list of pseudo-random numbers.

That term "pseudo-random" is important. The 99/4A User's Reference Guide makes a point to mention that the RND function "gives you the next pseudo-random number in the current sequence of pseudo-random numbers." If you use the RANDOMIZE statement once, then, you may or may not get the same sequence of numbers. However, using the RANDOMIZE statement over and over again in the program just puts you back at the beginning of another list. In reality, there seem to be certain numbers that the computer prefers to put at the top of its lists, so in games there may be some numbers that are never generated because you never make it far enough up into the current list to get that number. The point is, repeating the RANDOMIZE statement does NOT make your program more random.

I have found that the only way to make the computer generate a totally unpredictable set of numbers is to use the RANDOMIZE statement once at the start of the program, then when you need to wait for the user to press a key, do this:

100 CALL KEY(0, K, S)

110 Z = RND

120 IF S = 0 THEN 100

Since the time it takes a human to press a key will not be exactly the same each time the program is used, the computer will read down the list of pseudo-random numbers an unpredictable number of places.

Steve Davis

Yeah, RANDOMIZE isn't perfect by any stretch. You can provide a seed to it, but if you read the user's reference manual, it explicitly states the following:

"If you use the RANDOMIZE statement with a seed specified, then the sequence of random numbers generated by the random number function depends upon the value of the seed ... The seed may be any numeric expression. The number actually used for the seed is the first two bytes of the internal representation of the number ... For example, RANDOMIZE 1000 and RANDOMIZE 1099 produce the same first two bytes internally and thus the same sequence of numbers ..."

So you have to be very careful about the values you provide to it, if any.

As any good programmer knows, though, how random it is depends on your needs. Sometimes TOO much randomness can be bad for a program, especially a game. So a bit of a pattern to events is not, in fact, so bad a thing...

Adamantyr

##### Share on other sites

Hi Sometimes

Thanks for the Basic routines .... I'll try those, if anything it'll make execution quicker on the whole ....

The horses and the shadows, at first, did not follow each other accurately at all. It was the first case , in my life, I had seen where someone's shadow overtakes them to the finish line.

The only way around it was to slow down the horses spurts of speed. All four horses are in motion, patterned, at a constant numeric value of 3 (i think) ... and by way of randomness, it is down to rnd*4 which one gets the value 6 boost (originally my boost value was 15, and that's why the horses left they're shadows.)

I tried also for six horses and with each seperate odds, but then I was getting bogged down into the variables and just wanted to get the game finished. Maybe next time for seperate odds/randomizers. Thanks for playing

P.S. Yep, I designed the horses , actually I did them on you're Patterns program. It rocks!

Edited by TEXAS_JOE
##### Share on other sites

Yeah, RANDOMIZE isn't perfect by any stretch. You can provide a seed to it, but if you read the user's reference manual, it explicitly states the following:

"If you use the RANDOMIZE statement with a seed specified, then the sequence of random numbers generated by the random number function depends upon the value of the seed ... The seed may be any numeric expression. The number actually used for the seed is the first two bytes of the internal representation of the number ... For example, RANDOMIZE 1000 and RANDOMIZE 1099 produce the same first two bytes internally and thus the same sequence of numbers ..."

So you have to be very careful about the values you provide to it, if any.

As any good programmer knows, though, how random it is depends on your needs. Sometimes TOO much randomness can be bad for a program, especially a game. So a bit of a pattern to events is not, in fact, so bad a thing...

Adamantyr

Eh, as a programmer you control the limits of random numbers, so how could it be too random ? I'd be more worried if it wasn't random. And then again it's a bit predictable (on the standard TI - didn't A800 and C64 have some noise register or something for true random numbers). In the Short and Sweet contest (30 lines +) I had a different seed for each level. Drawing a "random" level with a specific seed made sure it would turn out the same every time.

##### Share on other sites

Just to be sure, if I were to type any number immediately after the RANDOMIZE command, ie ; RANDOMIZE 1000, it would or would not affect the 'seed' generated?

##### Share on other sites

Just to be sure, if I were to type any number immediately after the RANDOMIZE command, ie ; RANDOMIZE 1000, it would or would not affect the 'seed' generated?

It would. Just that 1000 and 1099 produce the same values.

To get it to work, you'd have to have the first two bytes be different. This is a bit tricky in BASIC; the first byte in a RADIX numeral is the exponent and sign, the second bytes is the first two digits. So 0-99 definitely work, but then you have to multiply/divide by 10 to make them different, or change to negative values.

Adamantyr

##### Share on other sites

Thanks for the info.

It was the first case, in my life, I had seen where someone's shadow overtakes them to the finish line.

I guess if you made an animation of the sun and a snail or turtle, and sped things up. Or if the sun is setting and I come jogging and make the right turns right before the finish line. Wouldn't my shadow be able to overtake me ? Sorry, I got carried away.

P.S. Yep, I designed the horses , actually I did them on you're Patterns program. It rocks!

Hmmm ... Well, you can have two (or more) Patterns up at the same time. Then paste from both (Patterns) in XB, animate, stop, and redo whatever needs retouching. I think I've seen a handful of other sprite editors with animation built-in (don't know how much you can fine-tune the frame rates etc.).

I use Paint Shop Pro 6 for manipulating pixels on a larger scale, and Animation 2 for editing frames etc. These are 1999 products and starts up extremely fast (in the blink of an eye) on my Win7 compared to PhotoShop CS5.

##### Share on other sites

Just to be sure, if I were to type any number immediately after the RANDOMIZE command, ie ; RANDOMIZE 1000, it would or would not affect the 'seed' generated?

It would. Just that 1000 and 1099 produce the same values.

To get it to work, you'd have to have the first two bytes be different. This is a bit tricky in BASIC; the first byte in a RADIX numeral is the exponent and sign, the second bytes is the first two digits. So 0-99 definitely work, but then you have to multiply/divide by 10 to make them different, or change to negative values.

Adamantyr

Thanks, I'll bare that in mind when I'm doing RANDOMIZE commands in the future, depending upon which sort of game it is ( I think Texas Jackpot will benefit from better randomizers)

##### Share on other sites

RXB has this code to help Randomize the Random number seed better.

0093> 6AAC 86,79 CLR @TIMER blink

<0094> * RXB PATCH CODE FOR USER *****

<0095> * G6AAE SCAN Scan for a character

<0096> * RAND 99 Force randomize to be random

<0097> 6AAE 06,7D,3F G6AAE CALL DUSER USER from EDIT mode

<0098> 6AB1 6A,CC BS READZ2 Found one!!!!

By the way the seed is only a Byte value not a word value same as the timer is only >00 to >FF value. >8378 = RND >8379=TIMER

I tried to fix it so it would use values from a program loaded but the User but just pressing a key with TIMER seemed best way.

##### Share on other sites

RXB has this code to help Randomize the Random number seed better.

0093> 6AAC 86,79 CLR @TIMER blink

<0094> * RXB PATCH CODE FOR USER *****

<0095> * G6AAE SCAN Scan for a character

<0096> * RAND 99 Force randomize to be random

<0097> 6AAE 06,7D,3F G6AAE CALL DUSER USER from EDIT mode

<0098> 6AB1 6A,CC BS READZ2 Found one!!!!

By the way the seed is only a Byte value not a word value same as the timer is only >00 to >FF value. >8378 = RND >8379=TIMER

I tried to fix it so it would use values from a program loaded but the User but just pressing a key with TIMER seemed best way.

Aaahhh Rich Extended Basic ..... You've just reminded me, I wanted to try writing a game on that, I have downloaded a PDF manual for it to see where the significant differences are and where I can apply them.

That said, I also want to start learning TurboForth as soon as I see a manual for that, and all this on top of a desire to learn Assembly code in order to produce more effecient speed in games. Gaahhhhh !!!!!

##### Share on other sites

wwo great game ! you're really prolific why not submits your games to Rainy Day contest ?

##### Share on other sites

wwo great game ! you're really prolific why not submits your games to Rainy Day contest ?

Great idea, Rocky!

Adamantyr

##### Share on other sites

Arlington Horse Racing requires Extended Basic.

Use the arrow keys (E and X) to select horse, and confirm with space bar.

Enter you're bet, any win gets 3 x bet - there are no odds or such complexities, it's just a simple game.

Let me know if you think there's more it needs.

ARLINGTON.zip

Nicely done

There is a somewhat similar game called A Day at the Races by John Morris which you can find in the XB section of the tigameshelf.net site.

##### Share on other sites

Thanks guys! There is more to come. It's an excellent hobby, and one that has a point to it now that people can have fun playing my games. It's brilliant, this forum, all you guys, I love it. More to come!!!

##### Share on other sites

100 RANDOMIZE :: R=INT(3000*RND)+100 :: RANDOMIZE R

110 A=INT(100*RND)+1 :: PRINT A

Theoretically, this routine * should * give off genuine random randomness.

##### Share on other sites

100 RANDOMIZE :: R=INT(3000*RND)+100 :: RANDOMIZE R

110 A=INT(100*RND)+1 :: PRINT A

Theoretically, this routine * should * give off genuine random randomness.

As I understand it, you just have to have one RANDOMIZE somewhere in the start. That's all that's needed.

##### Share on other sites

100 RANDOMIZE :: R=INT(3000*RND)+100 :: RANDOMIZE R

110 A=INT(100*RND)+1 :: PRINT A

Theoretically, this routine * should * give off genuine random randomness.

As I understand it, you just have to have one RANDOMIZE somewhere in the start. That's all that's needed.

Well, yes, that's correct as I know .... (as iv'e learnt from you guys )

What I'm attempting to do here, is really randomize the actual randomizer. If you know what I mean?

To try (perhaps in vain) to get the 'psuedo' to NOT be so 'psuedo' and to be proper.

##### Share on other sites

Well, you can do whatever you want. Even have RANDOMIZE within a loop. What you can do is then test the randomness/the results. Find out how well it is distributed over time. Like generating random numbers between 1 and 100 and counting the results in an array. Loop like 10,000 times, and print/inspect the array. Did every number in the range come up circa 100 times ? I think you will realize, that just one RANDOMIZE in the start of your program is all you need. Did you otherwise experience any problems ? I think it will be pseudo whatever you do in a standard XB environment, but the "press a key to continue" trick is good seeder.

Edited by sometimes99er
##### Share on other sites

Thanks for the information , i appreciate that ...

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
• ### Recently Browsing   0 members

• No registered users viewing this page.
×
×
• Create New...