Hi, I need help with my assignment.
•Create a memory game in C
•Function oriented with several functions
•Structured programming
•All cards are randomly placed on the board with face down •The player pick one card from the board and the symbol is shown •The player picks another card, with the aim to get pair (same symbol twice), and the symbol is shown
•If two equal card is found (pair) the player gets one point and the pair is removed from the board •The game continues until the board is empty
•NxM board size •Random board
my code not working becaus I cant get the random board to work.
Thanks
#include "stdafx.h"
#include "stdlib.h"
#include <stdio.h>
#include <cstdlib>
#include <ctime>
int _tmain(int argc, _TCHAR* argv[])
{
char comma;
int r1, c1, r2, c2, cards[4][4];
srand((unsigned)time(NULL));
//fill board
for (int r=0; r<4; r++)
{
for (int c=0; c<4; c++)
{
cards[r][c]=rand()%8+1;
//display board
printf(" 1 2 3 4\n");
printf("");
for (int i=0; i<=8; i++)
{
printf("-");
}
printf("");
for (int r=0; r<4; r++)
{
printf("%d",r+1);
for (int c=0; c<4; c++)
{
printf("*");
}
printf("");
}
printf("");
//selection
printf(" enter first card row and column:.\n");
scanf("%d,%d",&r1,&c1);
printf("enter second card row and column:.\n");
scanf("%d,%d",&r2,&c2);
//fix
r1--;
c1--;
r2--;
c2--;
//reveal
printf(" 1 2 3 4\n");
printf("");
for (int i=0; i<=8; i++)
{
printf("-");
}
printf("");
for (int r=0; r<4; r++)
{
printf("%d",r+1);
for (int c=0; c<4; c++)
{
if ((r==r1)&&(c==c1))
{
printf("%d",cards[r][c]);
}
else if((r==r2)&&(c==c2))
{
printf("%d",cards[r][c]);
}
else
{
printf("*");
}
}
printf("");
}
//match?
if (cards[r1][c1]==cards[r2][c2])
{
}
else
{
}
printf("Enter 1 to play again. Enter 0 to quit: ");
scanf("%d",&r1);
if (r1 == 1)
{
system("CLS");
goto loop;
}
return 0;
}
Hi, I need help with my assignment. •Create a memory game in C •Function oriented with...
I have to create a game for my stats class and my card game is that each play, every player is given 4 cards and their goal is to match the suits. for every pair they win $2, for every 3 its $5, and for all four of the same suit its $10. What are the odds of winning 1 pair, 2 pairs, 3, and all 4? thank you :)
Need a blackjack code for my assignment its due in 3 hours: it has to include classes and object C++. Create a fully functioning Blackjack game in three separate phases. A text based version with no graphics, a text based object oriented version and lastly an object oriented 2D graphical version. Credits (money) is kept track of throughout the game by placing a number next to the player name. Everything shown to the user will be in plain text. No...
"Blackjack 40" my teacher created this assignment and I need help. He is using c++ and has provided this template: Further instructions are below the template! #include <iostream> #include <cmath> #include <cstdlib> using namespace std; //Will return a number from 1 to 13, representing the face of a card int draw_card() { return rand() % 13 + 1; } int main() { const int BET = 10; //This will allow you to control chance, to make testing easier cout <<...
Problem Develop a simple C++ memory puzzle game. The description of the game is as follows: A board has 4 by 4 overturned cards. There is a pair for each card. The player flips over two cards. If they match, then they stay overturned. Otherwise they flip back after 3 seconds. The player needs to overturn all the cards in the fewest moves to win. This is a console game. Use the alphabetical letters from A to H as cards....
Problem Develop a simple C++ memory puzzle game. The description of the game is as follows: A board has 4 by 4 overturned cards. There is a pair for each card. The player flips over two cards. If they match, then they stay overturned. Otherwise they flip back after 3 seconds. The player needs to overturn all the cards in the fewest moves to win. This is a console game. Use the alphabetical letters from A to H as cards....
C++ Project - Create a memory game in c++ using structs and pointers. For this exercise, you will create a simple version of the Memory Game. You will again be working with multiple functions and arrays. You will be using pointers for your arrays and you must use a struct to store the move and pass it to functions as needed. Program Design You may want to create two different 4x4 arrays. One to store the symbols the player is...
1. create a class called MemoryBoard. a. MemoryBoard will represent a grid of memory squares. it needs to track all of the squares on the board, the cars set it's using, the width and the height of the board, the number of turns that have been taken, and the current player's id. 2. create a arraylist to store the squares on the board. it should store Square objects. the class should also store the width(an int), the number of turns...
NEED HELP TO CREATE A BLACKJACK GAME WITH THE UML DIAGRAM AND PROBLEM SOLVING TO GET CODE TO RUN!! THANKS Extend the DeckofCards and the Card class in the book to implement a card game application such as BlackJack, Texas poker or others. Your game should support multiple players (up to 5 for BlackJack). You must build your game based on the Cards and DeckofCards class from the book. You need to implement the logic of the game. You can...
For this assignment you will create a one-player variation of the game BlackJack. The game will be divided into five rounds. The goal of each round is to accumulate a hand of cards that gets as close to 21 without going over. At the beginng of the game you will start with a score of 100 points. After each round, the difference between your hand and 21 will be subtracted from your total score. The object of the entire game...
I need a basic program in C to modify my program with
the following instructions:
Create a program in C that will:
Add an option 4 to your menu for "Play Bingo"
-read in a bingo call (e,g, B6, I17, G57, G65)
-checks to see if the bingo call read in is valid (i.e., G65 is
not valid)
-marks all the boards that have the bingo call
-checks to see if there is a winner, for our purposes winning
means...