SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

Naughts and Crosses

A simple tic-tac-toe game based on Allegro (previously console based) By Darryl LeCount

  1. License and disclaimer
  2. What this is
  3. Installation
  4. User guide
  5. Troubleshooting/FAQ
  6. Contact

License and disclaimer

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Prerequisites

The game depends on the Allegro library (minimum 4.2.0) available at http://alleg.sourceforge.net. The Windows DLL (allegro.dll) is packaged with the Windows binary versions.

Installation

To install the Windows installer version of the game, just double click the icon and follow the prompts. The game can be run by either going to Jamyskis/ Naughts and Crosses under the start menu or click on the desktop icon. To uninstall, go to the start menu entry and select uninstall, or go to Add/Remove Programs.

If you have downloaded the game as a binary in a .zip (Windows) or .tar.gz (Linux) archive, you simply have to extract the binary to a directory of your choice. Under Windows, click on Naughts and Crosses.exe. Under Linux, you can run start_naughts_and_crosses.sh from the desktop environment of your choice or type ./naughts_and_crosses.bin from the command line when in the game directory. Please remember that the executable and script should both have the executable flag set.

Under all operating systems, the game will attempt to launch with a fullscreen mode of 800x600, and will revert back to windowed mode, opening a window of the same size should fullscreen fail. You can, however, force fullscreen or windowed mode with the arguments -f or -w respectively. Thus, "./naughts_and_crosses.bin -w" will run in a forced windowed mode. Please note that -f is somewhat redundant as it is assumed that fullscreen does not work if the game defaults to windowed mode. It will, however, produce error messages that may be useful for debugging purposes.

If you wish to compile from source under Linux, it is sufficient to type the following (for installation you need sudo or root permissions):

./configure
make
make install
naughts_and_crosses

If you wish to remove the program, go to the source directory and type:

make uninstall

It is possible when compiling from source to set your language and OS in "compile_settings.h" and/or add a language in "language.h", although at present only English is complete and officially supported. Currently you can set the OS to "WINDOWS" or "LINUX". If you're using Windows, set it to Windows, if you're using LINUX, set it to "LINUX". Most other major OSs are *NIX-based, so while they are not supported, they may well work with the "LINUX" tag.

Please note that the executable name when compiling from source is not "naughts_and_crosses.bin", but simply "naughts_and_crosses".

Please also note that running this game under Xgl or AiGLX is not supported, and probably won't work. It doesn't from my experience anyway.

If you choose to compile from source under Windows, you may well find that you have to rename naughts.cc and main.cc to naughts.cpp and main.cpp. Don't forget to link in naughts.cpp!

You're welcome to redistribute the new binary, as long as you distribute the source with it or at least a clear link to it and a copy of the GPL as per the GPL. I would also request that my name be kept in the binary and source and that the changes be sent to me.

What this is

This is basically my pet project while learning C++. It's a simple game of naughts and crosses. It's kind of grown over time to include a larger number of features.

User guide

On the main menu you are faced with a number of choices - begin a one or two player game, go to the options menu, or exit to the desktop. I hope these are fairly self-explanatory. Worth noting is that when you select a game to play, you have the option of entering your name by simply highlighting the option and typing away. When you want to begin, select "Begin Game".

The options menu offers a number of possibilities. You can modify the difficulty level from 0 to 20 (0 being the easiest), the boardsize (up to 9x9) and whether to play the "enhanced" version.

The enhanced version offers something with a bit more strategy. The aim is, as before, to have a full row of all of your pieces. The difference is that each player now only has as many pieces as necessary, plus one extra, to create a line. The exception to this rule is on a 3x3 board, on which each player only has three pieces each, to avoid the board getting too crowded. This means that on a 5x5 board, each player has six pieces at their disposal.

When the game proper begins, just enter the code for the space in which you wish to place your marker - e.g. A1. Classic tic-tac-toe should be familiar to everybody. It is possible (and with smaller boards highly likely) that you will often achieve a draw.

In the enhanced game, once all of the pieces are placed, players are required to remove a piece and place it elsewhere. This prevents the game from ending in a draw, and can also result in some very long games. If the game drags on and on, and you eventually get bored, press CTRL+C to exit.

Troubleshooting/FAQ

  • Why make this game? For my own personal amusement. I'm learning C++ and anything I add to this game is basically to test things that I have learnt. Of course, if you enjoy it, all the better :-)
  • This game sucks. This isn't meant to be the latest technological innovation. Play something else if you don't like it, or e-mail me suggestions for changes, or even changes to the source if you're able to program in C++.
  • The game won't compile. If you select Italian or another language that is currently not supported, compilation will fail. If you set another OS other than Windows or Linux, compilation will also fail. If you try to compile without Allegro installed, including/or the development package of it, it won't compile. If both are set correctly, send me the output of whatever process the program fails at (configure or make). I'll take a look at it.
  • The game won't run at all/properly. If you downloaded the binary version, send me your specs and a description of the problem and I'll have a look. If you compiled from source, make sure you set "OS" correctly. The game requires the Allegro runtime library to run correctly. This is included in the Windows distribution, must be installed under Linux. Attempts to compile on anything except Linux or Windows are (currently) not officially supported, although I would welcome reports of success with BSD-based systems, MacOS, Solaris and the like. It's certainly worth trying to run the game with the -w or -f switches to see if it is a display problem.
  • The game appears in a weird language. For version 0.7, English is the only officially supported language. Other languages will be reimplemented at a later date.
  • What happened to the console version? Although I originally intended this to be a console project, I stopped at 0.62 and moved on to Allegro for a number of reasons. Firstly, there are more than enough console-based tic-tac-toe games. Secondly, the console version of the game wasn't going to go much further than it got to. And finally, demand dictated that I produce something a bit beyond the standard tic-tac-toe games, and this is only really possible with a library like Allegro or SDL.
  • The code is a mess! The code has always been a mess - that's what you get from a newbie programmer! Seriously though, the problem has gotten worse since I introduced Allegro into the equation, and in some near future version I will go through the code and seriously streamline it.
  • I wanna contribute with additions to the game! If you have an idea or a suggestion for how the game could be improved, let me know. Particularly welcome are binaries and source for other OS's, and translations.
  • I wanna contribute with money! Don't bother. At the moment I certainly wouldn't pay for this game, and while I'm not rich, I'm not in dire need of a home, operation, food or new hardware. Wait until I have a good game up and going. I've written this as a learning project, and would like it to stay that way for the moment.
  • I've found a bug! Send it to me at the address below.

Contact

You can write to me at darryl@jamyskis.net. Alternatively you can visit my web page at http://www.jamyskis.net.


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.