Text Based game in C | SoloLearn: Learn to code for FREE!


Text Based game in C

Can anyone give me suggestions on some easy text based games to code in C? Something that's not really complicated... As long as it uses loops, statements, and maybe arrays. Its for our finals!

1/19/2021 2:14:03 PM


7 Answers

New Answer


I would have told you to search the web for such ideas. But I couldn't find good results myself that were suitable for a complete beginner. All of them were either graphical or too complex for beginners. So, Personally, my first ever games were 1. A number guessing game where the user has to guess a number the computer is thinking. The user gets 5 tries, and for each wrong try, the computer tells if the number entered by the user was too low or too high. If you're not familiar with random numbers in C, here is the documentation https://en.cppreference.com/w/c/numeric/random/srand 2. This, but without the drawing and the first player is the computer: https://en.m.wikipedia.org/wiki/Hangman_(game) Sagar Maurya the OP just said in the question that he/she wants to make a *text-based* or in other words, a console based game. The link you gave is for graphical games. And that too, in C#


A simple one room text adventure is trivial to write, and will probably suit your needs. The main parser just loops getting user input then that input is checked against an array of known words (the vocabulary). You have arrays of objects, key, gold coin etc. A simple tutorial can be found here... https://home.hccnet.nl/r.helderman/adventures/htpataic01.html


you can make a sudoku game. Where user will have to enter coordinates along with the value in it.


You could make a simple Tic Tac Toe game where 'x' and 'o' are pieces on a board and the board is a 2D grid of slots (which when printed can be separated by '|' and '-' ASCII characters). You then have the player and computer take turns putting pieces on the board. After each piece ('x' or 'o') print the board and check it to see if 1.) there's a winner 2.) it's a draw or 3.) the game continues. What you'll learn: turn-based input simple A.I (if you play against the computer) drawing (the board and its pieces) evaluation (checking the board for a winner) arrays/matrices (drawing, checking, and putting pieces on the board) game loop (repeating these steps until there's a draw/winner.)




A fizzbuzz game between you and the computer. The computer will never lose but the user can see how far she can go. Otherwise introduce some randomness later in the game to make the computer probabilistically lose.


Game development 2d or 3d Check here all need fulfill https://www.studytonight.com/game-development-in-2D/