Advertisement

Are these games really "beginner" games?

Started by April 01, 2013 05:12 AM
15 comments, last by markr 11 years, 5 months ago

First of all, I've never attempted any of these games, so I don't know.

Second, please rank these games on programming difficulty level (beginner, intermediate, advanced, expert). If you can be so kind, please give a quick sentence or two (or more if needed), as to why you gave the game that rank.

  • Go
  • Hangman
  • Tic-Tac-Toe
  • Chess
  • Connect Four
  • Battleship
  • Checkers

The reason I am asking the question is that the programming to get these games right and deal with the various strategies seems far more complex than a simple switch statement. A lot of the games I've listed don't seem ...appropriate... for a beginner to tackle. Or another way of putting it, the AI for these games seem far more complex than SMB. But again, I'm guessing and don't really know. So I'm asking.

Beginner in Game Development?  Read here. And read here.

 

Go
Don't know, I don't even know this game.

Hangman
Beginner level, hangman is pretty much just "reveal the letter" game, and in my opinion is probably one of the easiest things to program, just requires an understanding of strings.

Tic-Tac-Toe
Beginner level, the gameplay itself is incredibly simple.

Chess
Intermediate-advanced. the gameplay has alot of diffrent moving pieces, pieces can attack only a certain way. their's also things like castle move, and first move for pawns that need to be taken into consideration.

Connect Four
Beginner, maybe Intermediate. it's mostly just finding the next available slot to place your piece, and scanning the board for any possible win conditions.

Battleship
Intermediate, battleship could be thought of as an extension of tic-tac-toe, except with targeting specific spots on the board.

Checkers
Intermediate. checkers is a bit easier imo than chess, there's really only two types of pieces(king and regular), and there's a specific order to move/attack. Really checkers is imo what you should make before doing chess.


Of course none of my answers take into consideration building ai for the games, and only the gameplay itself.


EDIT: Fixed forum eating my post.
Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.
Advertisement

Go, tic-tac-toe, battleship, and connect-four are all of the same basic dynamic - a grid in which both players can modify the state of each grid point, each game with its own specific dynamic/mechanic.. eg: connect four, grid contents 'fall', and battleship the points are sets of 2/4/5 grid points at different orientations. Detecting various gameplay situations/states, and how each player can 'move' from the current state to the next is a fairly simple static set of rules.

Chess and checkers, on the other hand, are a bit more complicated.. Both require greater state-searching capacity if one desires to supply worthy a worthy AI opponent for single-player experience. Chess, especially, demands specific rules per the different game pieces the game entails, which further complicates implementation what with the validation of player moves and generation of AI moves.

The dynamic of Go's gameplay is somewhat abstract, and might involve a similar high-capacity state-search in an AI implementation, similar to chess/checkers, but the fact that there are only two game pieces, black and white, should simplify things.

Go and checkers are similar, in some respect. But I imagine checkers, and its rules, as being much simpler to implement.

Presentation is a seperate issue, and can be as basic or involved as desired (or capable of). You can go with text-mode graphics for all of these games, to eliminate the need for any complex graphical work. My assessment of these games and their difficulty in implementation is purely based on my perception and understanding of their mechanics and imagined complexity of their implementation.

I'll just comment on the AI part (none of the AI except maybe tic tac toe can be done with a series of switch or if/else statements)

  • Go

Very hard, you can't use standard tree search (minimax and related algorithms) to generate lots of potential moves and evaluate how good they are after looking ahead, since the number of moves that can be made each turn is enormous (far more than in chess or checkers). This is an ongoing AI research problem and the best human players can still tonk the AI...

  • Hangman

This involves having a large dictionary of potential words if you want the computer to guess the word. Eliminate large parts of the dictionary after the result of each guess (best strategy is to try and eliminate the most words from the dictionary regardless of whether your guess is correct or not, also guess common letters first, etc.). If you see a new word, add it to the dictionary. Not too hard.

EDIT: You can use statistics for this, for each letter that is a potential guess calculate the expected value of the number of words that will be removed from the dictionary, and pick the one with the highest expected value.

  • Tic-Tac-Toe

Or "my first minimax algorithm implementation". Easy. You can also do it by hard coding in a perfect strategy, but that only applies to tic tac toe and not other 2 player games with perfect information like chess/checkers etc.

  • Chess

Hard to get it to play well, there are lots of forums about it and you probably want to ask Alvaro questions in the AI forum. Uses variants of minimax along with large databases of opening moves and endgame databases as well.

  • Connect Four

Minimax again should get this to play fairly well. It has been solved (i.e. computer algorithm exists which plays perfectly) recently

EDIT: I think the standard board size has been solved but larger boards still remain open research

  • Battleship

This is more about distributing your shots to find all the ships in the most optimal way but I suspect for every strategy there may be a counter strategy for ship placement...

  • Checkers

Easier than chess and harder than Connect 4, same sort of principles (i.e. minimax based) apply. I think this was solved fairly recently as well...

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

They're easy for a beginner in the sense that UI-wise they can be done in a pretty simple way, you don't even have a timer to cope with (actions aren't in real time, it's entirely turn-based). The AI is a completely different situation, though you can always avert that by forcing only humans to play =P The rules of board games are also complex, but at least they're very well defined (they need to be interpreted by humans, after all!) so ultimately they're more of a time sink than actually being hard to implement. You don't even need to do it in a very optimal way given it's all turn based (no framerate to worry about).

For AI on board games the most common trick is to assign points to each possible thing that can happen, then try all possible moves and see which one has the best score (then do that). To make the AI harder you can try several turns ahead, but then the computation time can explode exponentially so maybe as a beginner you may want to avoid considering that one.

Tic-Tac-Toe has so few possible combinations you can just brute-force the way through it...

EDIT: by the way, there's an old DOS game called Tetris Deluxe that does exactly the same thing as I mentioned for board games. Even when you take into account the next piece it amounts to a total of 81 possible moves, and the "AI" can end up doing some surprisingly smart moves a human player would initially consider stupid. So yeah, that method works on Tetris too. It's pretty fast, consider that game was made on a 4.77MHz 8088 =P

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

I think programming any games is not an easy task. Even the seemingly simple games like Tic-Tac-Toe require some effort to make it work as expected. However, that is the whole point of the exercise, is to create something that seems simple and realize how much work is actually needed.

It'd make any beginners rethink their MMORPG dream.

Advertisement

I think to write machine players for these games from easiest to implement to hardest would be:

  • Tic-Tac-Toe: beginner. Tic-tac-toe is easy because perfect play can be expressed as a list of rules that would be relatively straight-forward to implement in a function. See here.
  • Hangman : beginner. You need to implement a dictionary as a data structure that can be searched with wild cards, basically. A beginner could do this by doing the naive linear time search, building a set of all possible matches, picking a word at random from this set, and picking a letter that hasn't been played yet at random from this word.
  • Battleship: intermediate. Wouldn't be entirely trivial to implement a good machine player, I think, although not sure I remember how you play battleship so am not sure.
  • Connect Four: advanced. This is the easiest of the games listed for which you would want to implement the alpha beta algorithm, but realistically doing this at all competently is advanced in my opinion; others may find this conservative.
  • Checkers: advanced.
  • Chess: expert.
  • Go: expert.

But basically writing machine players for any of these besides Tic-Tac-Toe would not be a good project for a total beginner.

Implementing a tic tac toe AI with an expert (i.e. rules based) system is no use for learning though, you want to use it to learn about minimax and related algorithms, which you can then use as a platform to move onto reversi, connect4, checkers, chess, etc.

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

please rank these games on programming difficulty level ... Or another way of putting it, the AI for these games seem far more complex than SMB. But again, I'm guessing and don't really know.

Assuming SMB = Super Mario Bros, the original doesn't have much for AI.

SMB scripts for AI are pretty simple:
Buzzy Beetle, Goomba, Green Koopa Troopa and Paratroopa, and Spiny: move left until you hit an obstacle, then walk right until you hit an obstacle.
Red Koopa Troopa and Paratroopa: Move left/right or up/down within two points.
Spiny Egg: Fall
Podobo (fireball) and flying Cheep Cheep: arc
Bullet Bill, swimming Cheep Cheep: Straight line
Firebar: Spin
Piranha Plant and Bill Blaster: Timer with minimum distance

The remaining characters (blooper, hammer bro, lakitu, and Bowser) all have a slighly more involved AI, but these are all in the beginner or intermediate level.



On to my view of the sorted list:

* Hangman: beginner. Sometimes used in schools for string manipulation.
* Tic-Tac-Toe: Game logic: beginner. AI: intermediate. The AI is frequently used in schools.
* Connect Four: Game logic: beginner/intermediate. AI: Advanced
* Checkers: Game logic: Intermediate. AI: Advanced/expert. A proper AI needs to rank risk vs rewards and use the logic of forced choice, but a simple AI can use minimax.
* Battleship: Advanced
* Chess: Game logic: Advanced. AI: expert. There are occasional research papers on the chess AI.
* Go: Game logic: beginner/intermediate. AI: very expert. You can still easily write doctoral dissertations on Go AI.

Implementing a tic tac toe AI with an expert (i.e. rules based) system is no use for learning though, you want to use it to learn about minimax and related algorithms, which you can then use as a platform to move onto reversi, connect4, checkers, chess, etc.

Didn't mean rules in the sense of rule-based expert system. I meant rules in the sense of what each item in the following is:


  • Win: If the player has two in a row, they can place a third to get three in a row.
  • Block: If the [opponent] has two in a row, the player must play the third themself to block the opponent.
  • Fork: Creation of an opportunity where the player has two threats to win (two non-blocked lines of 2).
  • Blocking an opponent's fork:
    • Option 1: The player should create two in a row to force the opponent into defending, as long as it doesn't result in them creating a fork. For example, if "X" has a corner, "O" has the center, and "X" has the opposite corner as well, "O" must not play a corner in order to win. (Playing a corner in this scenario creates a fork for "X" to win.)

    • Option 2: If there is a configuration where the opponent can fork, the player should block that fork

  • Center: A player marks the center. (If it is the first move of the game, playing on a corner gives "O" more opportunities to make a mistake and may therefore be the better choice; however, it makes no difference between perfect players.)
  • Opposite corner: If the opponent is in the corner, the player plays the opposite corner.
  • Empty corner: The player plays in a corner square.
  • Empty side: The player plays in a middle square on any of the 4 sides.

which I think an "advanced beginner" should be able to do.

This topic is closed to new replies.

Advertisement