April 28, 2024, 11:58:20 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Pyramid Solitaire - Coming Soon!

Started by Tony, November 20, 2008, 11:45:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Tony

November 20, 2008, 11:45:44 PM Last Edit: November 20, 2008, 11:48:47 PM by Tony
I've been busy converting my Pyramid Solitaire game I wrote back in 2002 with IBasic Standard over to Emergence Basic. I have it compiling clean now and only need to iron out a few wrinkles and add some new features I've been wanting. I designed the playing cards myself and wrote my own card handling and drawing routines for the game so it doesn't depend on a 3rd part library for that. The routines support building a deck of cards, shuffling, drawing the cards, getting the card suit and value and dragging and dropping cards. Once the game itself is finished I'll probably compile the card routines as a static lib and/or dll for others to use in their own card programs.

Anyway, just wanted to give a sneak peek of things to come. :)

techmail

Tony,
I'm curious to know if your shufling method is basically a randomization, or if you are trying to emulate the way a human shuffles cards. Many people don't seem to understand there is a big difference between randomizing and shuffling.

pistol350

Your project seems quite interesting.
You said that you wrote your own handling and drawing routines which makes the game not depending on any 3rd party library.
Could you shed more light on this as i'm not sure to fully understand it.
Thanks.
Regards,

Peter B.

Tony

Quote from: techmail on November 21, 2008, 01:37:06 AM
Tony,
I'm curious to know if your shufling method is basically a randomization, or if you are trying to emulate the way a human shuffles cards. Many people don't seem to understand there is a big difference between randomizing and shuffling.


I'm just using a simple randomizing method for now as shown in the code below, but I understand where you are coming from in your post. :)

   FOR COUNTER=0 TO 9
      FOR COUNTER2=0 TO 51
         RandNum=RAND (51)
         Temp=Deck[Counter2]
         Deck[Counter2]=Deck[RandNum]
         Deck[RandNum]=Temp
      NEXT Counter2
   NEXT Counter

Tony

Quote from: pistol350 on November 21, 2008, 05:23:23 AM
Your project seems quite interesting.
You said that you wrote your own handling and drawing routines which makes the game not depending on any 3rd party library.
Could you shed more light on this as i'm not sure to fully understand it.
Thanks.


Hey pistol,

  What I meant is that I'm not using any of the dll libraries such as Cards32.dll (included with Windows) or QCard32.dll. I wrote my own routines using Windows API calls such as BitBlt, etc. I hope that makes sense. Feel free to ask more questions should you have any.

Tony

Hello all,

  I've finished my Pyramid Solitaire card game...finally! It was originally written in IB back in 2002 and is now converted to EBasic (thanks again for your help Paul). I'm releasing the game itself as shareware, because I need some source of income since I have leukemia and am thus homebound. In any case, just to show the power of EBasic I'm posting a link to my site where you may download it. Should someone want to buy it(that would be nice  ;) ), please be aware that the purchase option through ShareIt! isn't available yet, as it takes a couple of days for that to get going. The trial version is fully functional, except it doesn't save your win/loss stats when you exit.

  I will more than likely release the card game routines I developed for it as a shareware lib/dll for use with EBasic and other languages. I'll keep you guys posted on that.

  Anyway, hope you have fun and please let me know if there are any issues with it either here or emailing me (through the link in the game help file).

  Here's the link: http://www.tinyfrogware.com/

  Enjoy!

  Tony.

Tony

Just a quick note. The purchase system for Pyramid Solitaire is now fully functional and available. That was quick! :)

hugh

Hi Techmail,
I for one dont know about shuffle.
In my bingo program i have the following code  to select a random number.


rnum = rand 1,number:            /* if U.S.A. bingo then number = 75 else number = 90*/
    until picked[rnum]=0
picked[rnum]=1


can i elaborate on that random number code ?

Regards

Hugh

techmail

Quote from: hugh on November 27, 2008, 06:37:35 PM
Hi Techmail,
I for one dont know about shuffle.
In my bingo program i have the following code  to select a random number.


rnum = rand 1,number:            /* if U.S.A. bingo then number = 75 else number = 90*/
    until picked[rnum]=0
picked[rnum]=1


can i elaborate on that random number code ?

Regards

Hugh


Hugh,
I suspect you don't really mean "elaborate" here, but yes, fell free to elaborate as much as you wish. I suspect you mean something along the lines of "improve" or "optimize". For this kind of randomization, as you use up more and more values, it takes longer and longer to hit on an unused value. So when you have selected all but the last two values, it takes a long time (relative to the time it takes to select the first 5 values) to finally select betwen those last two values. In real time, for such a small series of numbers, I doubt you'll notice a delay. In any case,  what you  really end up creating is a non-repeating list of numbers that has been randomized. So, a long time ago, I attacked the problem from the desired end result by simply creating an array of numbers (N.B. in general, the array does not have to be something like 1,2 3, ..., 99, 100 but can be ANY set of numbers, characters, words, etc. that needs to be randomized.) Now you will be swapping two values by generating a single random number. If you have 50 elements in your array, then you need the first number to be anything from 1 through 50. This random number is the location in the array to swap with location 50, thereby making a random selection for the value at location 50. On the second pass, you already used locatiion 50, so now you need your random numbers to cover only 1 though 49. So whatever the second pass number is, swap that location with location 49. Third pass you just use 1 through 48. I think you can see this is easily done in a count down loop. Then to use your randomized array, just step thorugh it incrementing by 1 to seelct the next random number,

For fun, try timing how long it takes to loop 10 or 100 times generating non-repeating random numbers from 1 through 100,000 using your current method compared to my swapping method.

As for the shuffling,  I'm sure you know about shuffling cards. For a typical bridge-style shuffle, a person holds about half the deck in each hand. He allows anywhere from 1 to about 10 cards to drop from one hand, then from 1 to about 10 cards drop from the other hand. This alternation between hands continues until all cards from both hands are dropped to form the shuffled deck. The whole process is then repeated for 0 to about 6 times.

Probably the most used implementation is to use a random number generator with weighted results so that reasonable probablilities are used for the number of cards to be dropped each time.  For example, if using 52 cards with say 20 held in one had, do you expect to EVER see all 20 dropped? POSSIBLE to happen, but not PROBABLE, so you need to weight getting the result 20 to some probablity that approaches 0. On the other hand, I think you would agree that 3 or 4 cards dropped are HIGHLY likely to occur, and maybe even with the same probability. So, you need to weight the results for 3 and 4 to  high probability values.

Now, as for the BINGO system, in theory, you should be dealing with randomly selected values, not with shuffled numbers. I'm not a bingo player, so I don't know if you have a single simple series of numbers from which to draw, or if you have duplicates or any wild values. If it is a simple series, a simple random number generator is all that is needed.


hugh

Yes i know about shuffling cards, I used to be a good poker player.
I just thought you ment , "SHUFFLE" as a random number tool.
Sorry about the confussion.
Yes i will stick with my rand code for 75 , or , 90 numbers.

Regards

Hugh

Tony

Just a quick note. Pyramid Solitaire will be available for $4.99 on Game Du Jour starting tonight at Midnight CT/1AM ET. The special will run for 24 hours. Once the clock strikes Midnight, just visit http://www.gamedujour.com to make your purchase.  :) A similar deal will be available for Baroness Solitaire within the week.

Thanks.

Tony

As mentioned in my last post, Baroness Solitaire is now available on http://www.gamedujour.com/ for just $3.99.

Thanks,

  Tony.