TIGSource Forums

Feedback => Playtesting => Topic started by: Average Software on July 31, 2011, 01:10:24 PM



Title: Common Blocks
Post by: Average Software on July 31, 2011, 01:10:24 PM
I finally got around to doing a project to help me learn Fortran, and the result is this, Common Blocks.

(http://www.averagesoftware.org/images/common_blocks.png)

As you can see, it's a Tetris clone, and not really a particularly good one.

The name 'Common Blocks' comes from a Fortran language construct, so it's kind of a joke.  Ironically, the code itself does not use any common blocks.

The game isn't entirely in Fortran, the Gtk frontend is in C, and all the game logic is handled in Fortran.

I'm just posting this here in case anyone is interested in seeing some Fortran code, and examples of how to do interaction between Fortran and C.  This is the first time I've done anything with Fortran, so don't take this as an example of good Fortran.

The game is controlled with arrow keys, left and right move the piece, up rotates, and down drops it.

The game is distributed as source, and you will have to build it.  GCC with the GFortran component are required, the only dependency is Gtk, so as long as you have the Gtk development headers you should be fine.  A makefile is included, a normal make includes debug info, use 'make release' to get the highly tuned and optimized version.

The program targets Linux, but should build on any Gtk environment in theory.

Here's the download:

Common Blocks (http://www.averagesoftware.org/files/common_blocks.tar.gz)


Title: Re: Common Blocks
Post by: Rainchild on July 31, 2011, 07:51:10 PM
Having never seen a line of Fortran before, it seems quite readable (contrary to what I pictured in my mind previously).


Title: Re: Common Blocks
Post by: Average Software on July 31, 2011, 08:58:33 PM
Having never seen a line of Fortran before, it seems quite readable (contrary to what I pictured in my mind previously).

Yeah, it isn't bad once you get used to it.  Some things take some getting used to, the one that bothered me the most was using % instead of . for member access.  some_structure%member = 10 just doesn't look right me, no matter how many times I type it.


Title: Re: Common Blocks
Post by: kidchameleon on August 03, 2011, 02:10:11 PM
Code looks pretty readable. Any chance of an executable? Not really up to scratch on makefiles!


Title: Re: Common Blocks
Post by: Average Software on August 04, 2011, 12:23:15 PM
Code looks pretty readable. Any chance of an executable? Not really up to scratch on makefiles!

All you have to do is go into the directory and type make.  As long you have the compilers and the Gtk libraries, you're all set.

The point behind the project was really the source, and not the executable, since the executable is a just a really bad Tetris clone, and the only reason to mess around with it would be to play with the source.

If you still want one, I guess I can throw it in there.