Skip to content

Instantly share code, notes, and snippets.

@madcoder2k17
Created July 3, 2017 07:12
Show Gist options
  • Save madcoder2k17/b0f1941f0c0c43d2303e274934e1b112 to your computer and use it in GitHub Desktop.
Save madcoder2k17/b0f1941f0c0c43d2303e274934e1b112 to your computer and use it in GitHub Desktop.
It is unready c code for solitaire game. This the only thing i can make, the others, i going crazy!! i need to creat Deck, giving cards, make the moves, the table and the points
#include <stdio.h>
#include <conio.h>
#include <time.h>
#include <conio.c>
main()
{
int random(int x)
{
srand((int) time(NULL));
return 1 + rand() % x;
}
and this, the colors:
void cardcolr(int naipe,int cardwcolr)
{
if (naipe == 1) // Hearts
{
switch(cardwcolr)
{
case 1:
textcolor(LIGHTRED);
printf(" A\3");
break;
case 11:
textcolor(LIGHTRED);
printf(" J\3");
break;
case 12:
textcolor(LIGHTRED);
printf(" Q\3");
break;
case 13:
textcolor(LIGHTRED);
printf(" K\3");
break;
default:
textcolor(LIGHTRED);
printf(" %d\3",cardwcolr);
}
}
if (naipe == 2) // Spades
{
switch(cardwcolr)
{
case 1:
textcolor(BLACK);
printf(" A\6");
break;
case 11:
textcolor(BLACK);
printf(" J\6");
break;
case 12:
textcolor(BLACK);
printf(" Q\6");
break;
case 13:
textcolor(BLACK);
printf(" K\6");
break;
default:
textcolor(BLACK);
printf(" %d\6",cardwcolr);
}
}
if (naipe == 3) // Diamonds
{
switch(cardwcolr)
{
case 1:
textcolor(LIGHTRED);
printf(" A\4");
break;
case 11:
textcolor(LIGHTRED);
printf(" J\4");
break;
case 12:
textcolor(LIGHTRED);
printf(" Q\4");
break;
case 13:
textcolor(LIGHTRED);
printf(" K\4");
break;
default:
textcolor(LIGHTRED);
printf(" %d\4",cardwcolr);
}
}
if (naipe == 4) // Clubs
{
switch(cardwcolr)
{
case 1:
textcolor(BLACK);
printf(" A\5");
break;
case 11:
textcolor(BLACK);
printf(" J\5");
break;
case 12:
textcolor(BLACK);
printf(" Q\5");
break;
case 13:
textcolor(BLACK);
printf(" K\5");
break;
default:
textcolor(BLACK);
printf(" %d\5",cardwcolr);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment