The MASM Forum

General => The Campus => Topic started by: minor28 on September 20, 2016, 04:15:22 AM

Title: Try patience solitaire
Post by: minor28 on September 20, 2016, 04:15:22 AM
Nowadays, I have trouble excogitate new projects. I have played solitaire on my iPad
so I figured I would code my own patience. It was more complicated than I initially
thought. But now it works fairly and whoever wants to, can try it.
Title: Re: Try patience solitaire
Post by: raymond on September 20, 2016, 08:38:32 AM
I also coded my own some 30 years ago, initially in 16-bit DOS. I rewrote in many years later for 32-bit Windows, and added several features over the years.

I was thus very curious to see your version, but the downloaded zip file does not contain the executable. I tried to run the .bat file but to no avail. What must I do to try your program?
Title: Re: Try patience solitaire
Post by: anta40 on September 20, 2016, 12:04:06 PM
Quote
C:\Users\CSL-NB-064\Desktop\Patience>c:/masm32/bin/ml.exe /c /coff /Cp Patience.asm
Microsoft (R) Macro Assembler Version 14.00.23506.0
Copyright (C) Microsoft Corporation.  All rights reserved.

Assembling: Patience.asm
Patience.asm(1) : fatal error A1000:cannot open file : Patience.inc

Patience.inc is missing...
Title: Re: Try patience solitaire
Post by: minor28 on September 20, 2016, 03:37:11 PM
Executable and inc files now included. Rbuttonclick moves a card to foundation pile if in sequence.
Title: Re: Try patience solitaire
Post by: avcaballero on September 20, 2016, 10:30:28 PM
seems to be working ok :t
Title: Re: Try patience solitaire
Post by: raymond on September 21, 2016, 03:20:23 AM
Just tried it.

Sorry to say but I think I would go mad playing that game for more than another 10 minutes. Sometimes, the transfers (table-to-table or table-to-foundation) work, other times it simply refuses to work.

Furthermore, your .exe is 1578 kb as compared to a mere 35 kb for mine (no external library) which seems to have many more options and be a lot less frustrating. The user has the option of playing random deals, or preselected deals known to have a solution; over the years, I've built a 219 kb file containing 2000 deals (complete with a solution) divided into four categories of difficulty. When playing random deals, you can replay the same deal over and over again until you give up or solve it. Statistics are kept of the quantity attempted and the number of successes, a rate exceeding 30% probably achievable.
Title: Re: Try patience solitaire
Post by: minor28 on September 21, 2016, 04:49:41 AM
Sorry to hear, raymond. I have not experienced the game fails, as it seems to do for you. The cards.bmp is a 1347 kb resouce which affects the size of the exe. It would be interesting to take a look at your version.

Best regards
Title: Re: Try patience solitaire
Post by: raymond on September 21, 2016, 09:20:49 AM
QuoteIt would be interesting to take a look at your version.

The help file in the attached zip is still in the old HLP format. It doesn't seem that MS is interested in supplying a crutch to read such files under Win10 such as supplied with Win8.1 and earlier.

That help file has not been updated to reflect the inclusion of the latest improvements, i.e.
- The original size was based on filling the old 640x480 monitor standard size. The Option menu allows modifying the window size from 50 to 100% of the vertical resolution used for the screen. You can also move the 4/3 ratio window where you prefer and its position (and size) will be remembered in the created .his file (the registry is NOT used)
- Whenever you play random deals, any success solution is retained in a file and can be replayed anytime later to try and find a smaller solution or for whatever other reason.

The rules of my game are a lot more rigid than most games of that nature: three cards at a time from the stack without showing the bottom two, and no UNDO allowed. However, being allowed to replay a random deal as often as you like (i.e. until you give up on that deal), you can try numerous variations of attack and any solution is more gratifying.

The bulk of the zip file is the file of the 2000 deals with their solutions. Have fun.
Title: Re: Try patience solitaire
Post by: minor28 on September 21, 2016, 11:31:28 PM
Hi raymond,
I cannot open your help file. It took a while to know how to move cards. Left click on the card to move and and then right click on destination.

I have no help file but to move cards in my version you press left mouse button and drag the card to it´s destination. If a card is in sequence to a foundation pile you can right click the card and it will move to the foundation pile in question. I have tested and tested and have not had any problems with transfers.

Considering the differences between our versions, you might use wrong method to move the cards. I do not know.
Title: Re: Try patience solitaire
Post by: FORTRANS on September 22, 2016, 02:51:18 AM
Hi,

   @minor28, tested on Windows 2000 and XP, just got an empty
green window with both tests.

   @Raymond,  seems to work okay with XP.  Cards seem to be
mishandled on 2000.  Screenshot attached.  Windows 98 gets a
blank window that captures the background.

HTH,

Steve
Title: Re: Try patience solitaire
Post by: raymond on September 22, 2016, 05:38:51 AM
I did not rely on what I had on my computer. I therefore downloaded the file posted here, unzipped it and tried it. I'm currently running with Win10 and had no problem whatsoever. I had been running it on Win7, Win8.1 and Win8.2 previously without problem; however, I've never had Win2000 and can't vouch for it. I'm thus at a total loss to explain that screen shot.

I still have a working XP and I will try it later today.
Title: Re: Try patience solitaire
Post by: raymond on September 22, 2016, 01:12:40 PM
Works fine also on my old computer running XP.

I took the opportunity to recover the original .rtf file used to compile the HLP file and attaching it here. It is NOT updated for the latest improvements.

Eventually, I will try to use it to prepare a CHM file compatible with the latest WinOS.
Title: Re: Try patience solitaire
Post by: minor28 on September 27, 2016, 09:39:05 PM
I have adjusted the pictures thus the exe-file size has been halved. I have also changed the grabbing point on the card to the cursor when moving cards.

I have only tested on win 7-32 byte and win 10-64 byte.

Press left mousebutton down to grab a card and then drag the card to the target pile. Right mousebutton click moves the card directly to the foundation pile.
Title: Re: Try patience solitaire
Post by: jj2007 on September 27, 2016, 09:46:45 PM
Works fine with Windows 10, but with XP and Win7-64, I just see an empty green screen :(
Title: Re: Try patience solitaire
Post by: TWell on September 27, 2016, 11:30:34 PM
Thanks :t
Works with Windows 10 Anniversary version :t
Title: Re: Try patience solitaire
Post by: minor28 on September 28, 2016, 01:25:14 AM
Thank you for testing.

I think I know what is causing the error. I will try to solve this, but it takes a while when I have lots of other things to do the next few weeks.

Title: Re: Try patience solitaire
Post by: rrr314159 on September 28, 2016, 01:35:58 AM
Quote from: raymond on September 21, 2016, 03:20:23 AM... your .exe is 1578 kb as compared to a mere 35 kb for mine (no external library) ...

in another thread http://masm32.com/board/index.php?topic=5684 jj2007 mentions Cards.dll from Windows. Just curious, are either of you (Raymond and minor28) using it? Raymond says "no external library" so I guess not, but did you perhaps get your cards images from it? If not where did you get the images - are they readily available elsewhere? Are any of these sets of images any better than other sets? How big is Cards.dll? Would either of you benefit from using it?

Just curious
Title: Re: Try patience solitaire
Post by: minor28 on September 28, 2016, 03:10:08 PM
I use no other external libraries than Microsoft´s api, not Cards.dll. I retrieved the cards from the net and I did some copy and paste. Later I also redused the size by changing the cards.bmp from 24 to 8 bit color. Now the size of the exe is 566 kB.
Title: Re: Try patience solitaire
Post by: minor28 on September 28, 2016, 06:03:51 PM
It was not so much work after I took out my old XP machine and got it to work.

Edit: bonus was not added and I change the bonus calculation
Title: Re: Try patience solitaire
Post by: FORTRANS on September 28, 2016, 11:21:24 PM
Hi minor28,

   Now it runs on Windows 2000, and Win98 after copying a DLL
over to the system.

Regards,

Steve N.
Title: Re: Try patience solitaire
Post by: raymond on September 29, 2016, 01:11:04 AM
Re Cards.dll from Windows.

As I mentioned in my first post, I wrote the initial program some 30 years ago, on a 386 till running with MS-DOS.  I thus needed to draw my own cards but, not having any drawing program, I had to first make one of those to draw the face cards and aces using 8-bit colors. That was a learning process.

That data is then compiled with the program into the .data section; appropriate numbers and small suit icons are also part of the .data section. The 52 cards are then drawn into RAM as part of the initializing process of the program.

The only difference today is the fact that I use Windows APIs to draw into a buffer and then transfer it to the monitor instead of drawing directly to the video memory. Although the base data remains 8-bit color for a 640x480 screen resolution, the image is still quite acceptable when the size is doubled by Windows.
Title: Re: Try patience solitaire
Post by: minor28 on September 29, 2016, 05:20:27 PM
Hello Steve N,

Which dll did you copy over to your system?
Title: Re: Try patience solitaire
Post by: FORTRANS on September 29, 2016, 10:25:51 PM
Hello,

Quote from: minor28 on September 29, 2016, 05:20:27 PM
Hello Steve N,

Which dll did you copy over to your system?

   gdiplus.dll

HTH,

Steve N.
Title: Re: Try patience solitaire
Post by: minor28 on September 29, 2016, 10:44:36 PM
OK,
I use gdiplus.dll only in function DrawPauseBoard to draw a white transparent image over the board. I thought that the dll was included in XP.
Title: Re: Try patience solitaire
Post by: FORTRANS on September 30, 2016, 07:52:07 AM
Hi,

   The gdiplus.dll now on both the Windows 2000 and 98 computers
probably originally came from an XP installation.  I remember having
a bit of reconfiguring the Win2k system a while back for a GDI+
program.

Regards,

Steve