Category Archives: Programming

Building your own game using pygame

These days I was experimenting with pygame and found out that how easy game development can be done with pygame. I build a ‘Space War’ clone using pygame with some sound effects. Now I’m making a HOWTO on building the games using pygame. When it is complete I will post it here..

Space War

[DOWNLOAD SPACEWAR SOURCE]

1 Comment

Filed under Linux, Programming, Python

Self Printing C Code

Have you ever tried writing a C code that prints the source itself. Its a little bit tricky anyway. But the solution is here

#include
char *program = "#include  %c char *program = %c%s%c;%c int main()%c{%cprintf(program, 10, 34, program, 34, 10, 10, 10, 10, 10, 10);%c    return 0;%c}%c";
int main()
{
        printf(program, 10, 34, program, 34, 10, 10, 10, 10, 10, 10);
        return 0;
}

Another program can be written in a single line

main(a){a="main(a){a=%c%s%c;printf(a,34,a,34);}";printf(a,34,a,34);}

Assumptions:

  • The program is run on an ASCII machine.
  • No newline is needed at the end of the source.
  • char * does not lose any information when converted to int.
  • int has the same bit representation, size, and argument passing convention as char *.
  • A random return value from main does not cause problems.
  • printf works without prototype.

Comments Off on Self Printing C Code

Filed under Programming

Microsoft XNA Game Studio 2.0

Microsoft XNA Game Studio 2.0 is a set of tools based on supported versions of Microsoft Visual Studio tools that allow students and hobbyists to build games for both Microsoft Windows and Xbox 360. XNA Game Studio also includes the XNA Framework, which is a set of managed libraries based on the Microsoft .NET Framework 2.0 that are designed for game development. This documentation collection contains technology overviews, tutorials, and reference material related to XNA Game Studio.

Visit Official Site

Leave a comment

Filed under Applications, Programming