Silverfrost Forums

Welcome to our forums

Minesweeper game

1 Aug 2012 7:56 #10544

Hi all,

I just put source and data files of my first ever program written in Fortran available: here

Any comments and insults about the code are welcome. 😉

2 Aug 2012 1:40 #10548

Jalih,

I had a very quick look at your code. Not able to provide much of a comment, from the brief scan.

One thing I did notice is that in function gr_func() you have code only for 2 possible values of reason. It would be worth keeping a track of other possible values of reason. The example I provided of call_back_statistics could be a way to monitor this. You can be surprised as to what are the other possible interrupts and then consider how best to respond to them. There may be some that you do not wish to respond to, in the way that follows in gr_func.

John

2 Aug 2012 11:30 #10550

Jalih,

It's a very creditable first effort.

Several of your subroutine calls refer to INTEGER FUNCTIONs, such as IMPORT_IMAGE@, SELECT_GRAPHICS_OBJECT@ - hence the linker warnings. FTN95 doesn't mind sometimes if these are called the wrong way, but there is still a right way.

If you want to use the complicated way of running graphics, then that is fine, but in an app like this that runs very fast you don't need to do all the stuff with different graphics regions, you can do it all on screen, using the 'painter's algorithm' (each change overprints the last).

When you shut down the program (%cc), you don't need to tidy up, memory is released automatically. %cc is for use when the program shouldn't just close down without user intervention, for example, if you want to ask the user about saving files. In your case, maybe on %cc you should show the statistics on wins, losses etc. (In cases where files might need to be saved you probably need %ew as well).

It is a game, so consider adding sound effects. As programmed, there is no benefit in using the XP manifest (the line 1 24 default.manifest in your resources), except maybe to modernise the OK button in your About box - and the About ... menu item needs the dots afterwards because it leads you to another Window, and it probably needs to be About Sweeper ... Using the system font often looks better than choosing specific fonts when they are used at default size.

The 'reset' menu item is a clear example of a place to have an accelerator key, as is Exit (Ctrl-X usually).

Your mines would look more 3D if you moved the highlight up and left a bit. If you make the bevel effect a bit more complicated, then you will get a better visual effect when one tile is 'up' next to one that is 'down'. You have to be a bit careful with greys, as a lot of standard Windows themes use grey with a tint in it, and your tiles can look a bit flat in comparison.

As you are using Fortran 95 style, maybe you should use '>' rather than '.gt.' (I'm old-fashioned, and use the '.gt.' form, but it takes more space and is less clear).

Eddie

2 Aug 2012 5:55 #10553

Thanks for comments and improvement suggestions!

I will try to put some of them into my code and will also add menu item for setting the game difficulty.

3 Aug 2012 9:59 #10554

Quoted from jalih

I will try to put some of them into my code and will also add menu item for setting the game difficulty.

Source and binary packages updated...

6 Aug 2012 6:18 #10559

Quoted from jalih

Quoted from jalih

I will try to put some of them into my code and will also add menu item for setting the game difficulty.

Source and binary packages updated...

Some bugs fixed and sounds added...

9 Aug 2012 2:46 #10574

Cool! Sell it when Win8 tablets will be available

Please login to reply.