Thread: Text Based Card Game

  1. #1
    Registered User
    Join Date
    Feb 2016

    Text Based Card Game

    The card game I'm creating is for two players, one user and the other player will be the computer. In general, this is what is suppose to happen:
    The player starts off the game then the computer plays then player again then computer again and so on..
    If the player is unable to play after the computer played well then the player has to skip a turn. Whenever the player skips a turn, the computer automatically wins the round and starts the next round.
    If the computer skips his turn on the other hand, he will lose the round and the player gets to play first in the new round. At the end of each play, a function checks to see if the player or computer's hand is empty. The first one to have an empty hand wins the game.

    I've created all my functions as it relates to playing the game. However, to get the game to run in this manner is quite confusing to me. I would like to think that I have to use a while loop but I don't know how to go about this to get my game running as I want it to.
    Can someone guide me on this and what I can do to get the game working?
    Any help is appreciated. Thank you

  2. #2
    Registered User
    Join Date
    Jun 2015
    Something like:
    initialize game
    shuffle deck
    deal cards
    turn = PLAYER
    while game is not over
        if turn == PLAYER
            do player turn
            if player couldn't play
                computer wins round
            else if player's hand is empty
                player wins game
            turn = COMPUTER
            do computer turn
            if computer couldn't play
                player wins round
            else if computer's hand is empty
                computer wins game
            turn = PLAYER

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Text based game
    By wipeout4wh in forum C Programming
    Replies: 12
    Last Post: 03-26-2009, 04:39 PM
  2. Text-based game in C++
    By Nectarios in forum C++ Programming
    Replies: 2
    Last Post: 12-17-2008, 07:12 PM
  3. Text based game
    By beene in forum Game Programming
    Replies: 10
    Last Post: 05-12-2008, 07:52 PM
  4. Runoff -- Text Compressor or Card Game?
    By ygfperson in forum Contests Board
    Replies: 5
    Last Post: 09-03-2002, 08:01 PM
  5. Text Based Game
    By drdroid in forum C++ Programming
    Replies: 2
    Last Post: 02-18-2002, 06:21 PM

Tags for this Thread