I've written Tic-tac-toe in hypercube 4x4x4x4 in pure C

Discuss interdimensional programming, Java applets and so forth.

I've written Tic-tac-toe in hypercube 4x4x4x4 in pure C

Postby MorgothV8 » Fri Feb 20, 2009 2:05 pm

Hi all, I've written game tic-tac-toe in a pure-C (using only console output), this can be compiled on Windows, UNIX, DOS and so on
It only uses scanf() to get user input
Display is text-like,
XXXX = @ is a single 2D wall, and wall are tiled, that way

@@@@ = meaning thay You see just 4x4x4x hypercube as 4x4 grid of 4x4 fields, simply 16x16 grid

You can play against computer AI or observe duel beetween two AI's
z - mark place
x - let CPU move
ki - Y+/- move
jl - Y+/- move
om - Z+/- move
un - V+/- move
Anytime 'h' gives help

Game is simple, and its heart is just one (commented) method:
Inside this function, ale moves are described

Good luck!

here source_code - can be compiled by nearly all C compilers, example: gcc -o game game.c

Please don't embed entire source files in code tags - upload the file (for example on TI Share as I have) and provide a link. I also cleaned up your indentation, and merged these posts - you can use the "edit" button at the top right of a post to add more info. ~Keiji

Oh and few tips
The game reads commands as letter+ENTER, for example:
l<ENTER> moves You left (x++)
z<ENTER> marks your move on current position
x<ENTER> makes that CPU is moving instead You in Your turn and then again normal CPU

This is because I'm using scanf() to get command, I could use some getch() but it is platform-specific, for example in conio.h in M$windows or in <termios.h> in UNIX, using only ordinary scanf makes it run on (I've tested)
Windows with Visual2003, Cygwin on Windows, Gcc on Solaris, Linux, FreeBSD (also 64bit)

To compile it, save as: game.c, launch command-prompt:
sh# gcc -O2 -Wall -o tttgame game.c
sh# ./tttgame

Try it and tell me if You like it.

Licencing: NONE
Do with this game and its source whatever You want.
Posts: 8
Joined: Fri Feb 20, 2009 1:57 pm

Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest