Jump to content
  • entries
    4,951
  • comments
    2,718
  • views
    1,809,017

Red and green


atari2600land

398 views

So I made a new title screen for Chris's Casino for Virtual Boy. It wasn't fun trying to fix the text in Roulette. Playing this, it becomes clear I need to figure out a better way to make the cards more random in Video Poker. Hmm.

I got a new X-Box game at the used video game store: Tecmo Classic Arcade. It works! Played a few minutes of Pinball Action. It kept my high score. Great! Looking through the other games, Swimmer looks a little like my White Water Madness only the character goes under the stuff instead of avoiding them.

5 Comments


Recommended Comments

Does the programming environment you're using to make Virtual Boy games really lack a RNG or PRNG? It sounds like an omission one would've made in the late 1970's. Anyway, I think you got some hints previously about various PRNGs and how to implement them. See also a programming thread in the Intellivision forum, I think it was First Spear. It turned a bit into theoretics about PRNGs as explained by intvnut. The principles for those should be possible to implement even in your environment if you don't have anything decent naively in terms of random calls.

Link to comment

You also perhaps need to come up with a good shuffling algorithm. A very good one is the Fisher-Yates Algorithm, also known as the Knuth Algorithm, or the Fisher-Yates-Knuth Algorithm.

 

https://www.i-programmer.info/programming/theory/2744-how-not-to-shuffle-the-kunth-fisher-yates-algorithm.html

 

It's as simple as:

 

 
for (int i = 0; i < data.Length; i++)
{
 swap(ref data[i], ref data[i+R.Next(data.Length-i)]);
}

 

Where "data[]" is your card array and "R.Next(n)" is the next random number generator from 0 to n.

 

-dZ.

Link to comment

I posted a fully working Galois implementation of PRNG on the Intellivision forums. It's in Assembly Language but it was based on this code:

 

 

 
#include <stdint.h>
uint32_t lfsr = 1;
unsigned period = 0;
 
do {
  /* taps: 32 31 29 1; feedback polynomial: x^32 + x^31 + x^29 + x + 1 */
  lfsr = (lfsr >> 1) ^ (-(lfsr & 1u) & 0xD0000001u);
  ++period;
} while(lfsr != 1u);
Link to comment

There are several things wrong with the code you provided. First off, I don't have a random number generator because there isn't one. Second, the assembler does not like swap. I am so confused by it right now. You'd need to look at the entire section I made about it to understand what I did and you seem so nice that I don't want to punish you by making you trudge through my code for it.

Link to comment

Chris, the LFSR you were looking for is within DZ-Jay's second reply above. You probably want to encapsulate it as a function call in order to use it muitiple times. My C is a bit rusty but I believe if you define local variables static (???) they will retain their value over multiple calls.

Link to comment
Guest
Add a comment...

×   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...