![]() |
#41 | ||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: May 2005
Location: Aurora, United States
Posts: 606
|
![]() <div align="center">FLASH CARDS</div>
The name says it all. This is a perfect oporutinty to practice your basic math skills, addition, subraction, multplication and division. At the end of your session (defined in length by the NUM constant) your score will be added up and you will be assigned a grade. Flash Cards uses binary data, encoded in decimal form, to make the shapes of the form. Take the data listed in the shape array at the top of the program, write them out in binary form (1's and 0's) and stack them on top of each other to see how it works. The drawline routine is the one that decodes the data sent to it. A line variable is loaded with what each of the 6 characters per line will be. Then it looks for that numbered shape in the shape array and uses that data to output the numbers. #20 is blank, because #0 is the number 0, so that #1 can be 1 and so on. After 0-9 comes the plus sign, the minus sign, ect, two equals signs, the strike icon (for when you get an answer wrong), three icons for when you get an answer right, and finally the blank space. For fun, change the data in the shape array and see if you can't make your own style of numbering! Code:
/* Flash Cards * by Joseph Larson 2005 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #define NUM 25 int shape[21][9] = { **{ 28,**54,**99,**99,**99,**99,**99,**54,**28}, **{ 24,**28,**30,**24,**24,**24,**24,**24, 126}, **{ 62,**99,**99,**48,**24,**12,** 6,** 7, 127}, **{127,**96, 112,**48,**56,**96,**99,**99,**62}, **{ 32,**48,**52,**54,**54,**51, 127,**48,**48}, **{127,** 3,** 3,** 3,**63,**96,**99,**51,**30}, **{ 56,**12,** 6,** 3,**63,**99,**99,**99,**62}, **{127,**99,**48,**48,**24,**24,**12,**12,**12}, **{ 28,**54,**54,**28,**54,**99,**99,**54,**28}, **{ 62,**99,**99,**99, 126,**96,**48,**24,**14}, **{**0,**24,**24, 126, 126,**24,**24,** 0,** 0}, **{**0,** 0,** 0, 126, 126,** 0,** 0,** 0,** 0}, **{**0,** 0, 102,**60,**24,**60, 102,** 0,** 0}, **{**0,**24,** 0, 126, 126,** 0,**24,** 0,** 0}, **{**0, 126, 126,** 0,** 0, 126, 126,** 0,** 0}, **{**0,** 0,** 0, 255, 255,** 0,** 0,** 0,** 0}, **{**0, 255, 231, 189, 153, 189, 231, 255,** 0}, **{112, 140, 146,**80, 248, 136, 136, 132,** 4}, **{**0,** 0,**12,**96,**84, 234, 246,**73,**56}, **{128, 166, 146,**61, 139,**58,** 6,** 0,** 0}, **{**0,** 0,** 0,** 0,** 0,** 0,** 0,** 0,** 0}}; char *name[21] = {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Plus", "Minus", "Times", "Into", "Equals", "Equals", "Strike", "Right", "htRig", "ightR", " "}; void drawline (const int msg[6]) { **int ch, col, row; **for (row = 0; row < 9; row ++) { ****for (ch = 0; ch < 6; ch ++) for (col = 0; col < 8; col ++) ******putchar ((shape[msg[ch]][row] & 1 << col) ? ******name[msg[ch]][(col + row) % strlen (name[msg[ch]])] : ' '); ****putchar ('\n'); **} **putchar ('\n'); } int main (void) { **int op, max, q1, q2, ans, input, strikes, s, v, z, line[6], score[4]; **double cscore; **srand (time (NULL)); s = 0; **printf ("Choose an option:\n 1) Addition (easy)\n 2) Addition (hard)\n" ****" 3) Subtraction (easy)\n 4) Subtraction (hard)\n" ****" 5) Multiplication\n 6) Division\n 7) Shuffle\n ? "); **scanf("%d", &input); **while (input < 1 || input > 7) { ****printf ("Please type a number between 1 and 7 ? "); scanf("%d", input); **} **switch (input) { ****case 1 : max = 10; op = 1; break; ****case 2 : max = 99; op = 1; break; ****case 3 : max = 10; op = 2; break; ****case 4 : max = 99; op = 2; break; ****case 5 : max = 10; op = 3; break; ****case 6 : max = 10; op = 4; break; ****case 7 : max = 10; s = 1; **} **for (z = 0; z < 4; z++) score[z] = 0; **for (z = 0; z < NUM; z++) { ****q1 = rand () % max; q2 = rand () % (max - 1) + 1; ans = rand () % max; ****v = (rand () < RAND_MAX / 2); ****strikes = 0; ****if (s) op = rand () % 4 + 1; ****switch (op) { ******case 1 : ans = q1 + q2; break; ******case 2 : if (q1 < q2) {q1 ^= q2; q2 ^= q1; q1 ^= q2;} ************** ans = q1 - q2; break; ******case 3 : ans = q1 * q2; break; ******case 4 : q1 = ans * q2; ans = q1 / q2; break; ****} ****do { ******if (v) { ********line[0] = (q1 / 10) ? (q1 / 10) : 20; ********line[1] = q1 % 10; ********line[2] = 9 + op; ********line[3] = (q2 / 10) ? (q2 / 10) : 20; ********line[4] = q2 % 10; ********line[5] = 14; ********drawline (line); ******} else { ********line[0] = line[1] = line[4] = line[5] = 20; ********line[2] = (q1 / 10) ? (q1 / 10) : 20; ********line[3] = q1 % 10; ********drawline (line); ********line[0] = line[4] = line[5] = 20; ********line[1] = 9 + op; ********line[2] = (q2 / 10) ? (q2 / 10) : 20; ********line[3] = q2 % 10; ********drawline (line); ********line[0] = line[4] = line[5] = 20; ********line[1] = line[2] = line[3] = 15; ********drawline (line); ******} ******scanf("%d", &input); ******if (input != ans) { ********line[0] = line[2] = line[4] = 20; ********line[1] = (++strikes > 1) ? 16 : 20; ********line[3] = 16; ********line[5] = (strikes > 2) ? 16 : 20; ********drawline (line); ******} ****} while (input != ans && strikes < 3); ****line[0] = line[1] = line[4] = line[5] = 20; ****line[2] = (ans / 10) ? (ans / 10) : 20;; ****line[3] = ans % 10; ****drawline (line); ****if (input == ans) { ******line[0] = line[4] = line[5] = 20; ******line[1] = 17; ******line[2] = 18; ******line[3] = 19; ******drawline (line); ****} ****score[strikes] ++; ****puts ("Press any key..."); ****getchar (); getchar (); **} **printf ("Report Card\n------ ----\n\n" ****"Out of %d:\n %d on first try (%2.1f%%)\n %d on second try (%2.1f%%)\n %d on" ****" last try (%2.1f%%)\n %d missed (%2.1f%%)\n\n", ****NUM, score[0], (float)score[0] * 100 / NUM, ****score[1], (float)score[1] * 100 / NUM, ****score[2], (float)score[2] * 100 / NUM, ****score[3], (float)score[3] * 100 / NUM); **cscore = (float)score[0] * 100.0 / NUM + (float)score[1] * 50.0 / NUM + ****(float)score[2] * 25.0 / NUM; **printf ("Grade: %c, (%2.2f%%)\n", 'A' + (cscore < 90.0) + (cscore < 80.0) ****+ (cscore < 70.0) + 2 * (cscore < 60.0), cscore); **exit (0); } Code:
****v = (rand () < RAND_MAX / 2); Code:
****v = 1;
|
||
![]() ![]() |
|
![]() |
#42 | ||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() You love us? Oh, my... *faints* :P
As for this program, I was pretty impressed by the flag made out of "right" and the numbers made out of, well numbers. (I would have made them all by hand As for the next program...Hangman is what I choose. |
||
![]() ![]() |
|
![]() |
#43 | ||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: May 2005
Location: Aurora, United States
Posts: 606
|
![]() <div align="center">HangMan</div>
Now, whenever I'm at a loss for words, the worst that happens is I make a fool of myself. However, in HangMan being at a loss for words is a life and death stuation. In this game the "graphics" are designed so to take up the fewest lines of code. Consequently it can be said that they suck. In order to see a fully hanged man you need to tilt your head 90 degrees to the left. Here is what the fully hung man looks like: Code:
****************** O || ||****@**/==O /===// || ||-O):o{)X###]<******|| ||\** @**\==O \===\\ || ||\\************** O || |==========AEOQMBCDPR|| If you don't like the way the graphic looks you can re-write the drawgallows() routine yourself to draw the gallows according to how much of the player is left. 10 is hung, 0 is empty. Post your drawgallows routine here if you make one! (I know I'd love to see a better one.) Code:
/* Hangman * by Joseph Larson 2005 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <limits.h> #include <ctype.h> char missed[11] = "=========="; char dict[255][25] = {"artfull", "baton", "brazier", "create", "disgard", **"flight", "great", "hydrant", "justify", "lacerate", "master", "niagra" , **"oxygen", "pieces", "question", "rough", "sachet", "trumpet", "vestibule"}; int dictnum = 19; void drawgallows (int d) { **printf ("\n****************** %c ||\n", d < 9 ? ' ' : 'O'); **printf ("||****%c**%s%s%s%s ||\n", d < 1 ? ' ' : '@', d < 3 ? "** " : "/==", ****d < 7 ? "**" : "O ", d < 5 ? "****" : "/===", d < 9 ? "**" : "//"); **printf ("||%s%s******||\n", d < 1 ? "--ss(O)" : "-O):o{)", ****d < 2 ? "******" : "X###]<"); **printf ("||\\** %c**%s%s%s%s ||\n", d < 1 ? ' ' : '@', d < 4 ? "** " : "\\==", ****d < 8 ? "**" : "O ", d < 6 ? "****" : "\\===", d < 10 ? "**" : "\\\\"); **printf ("||\\\\************** %c ||\n", d < 10 ? ' ' : 'O'); **printf ("|==========%s||\n\n", missed); } void play (void) { unsigned long guessed = 0; char *word, input; int c, found, nummissed = 0; **for (c = 0; c < 10; c++) missed[c] = '='; **c = rand () % dictnum; **word = dict[c]; **guessed = ULONG_MAX << strlen (word); **for (c = 0; c < strlen (word); c++) ****if (toupper(word[c]) < 'A' || toupper(word[c]) > 'Z') ******guessed |= (1 << c); **do { ****drawgallows (nummissed); ****for (c = 0; c < strlen (word); c++) ******putchar (guessed & (1 << c) ? word[c] : '-'); ****printf ("\nWhat is your guess? "); input = getche (); ****found = 0; ****for (c = 0; c < strlen (word); c++) ******if (toupper(word[c]) == toupper(input)) { ********found = 1; ********guessed |= (1 << c); ******} ****if (toupper(input) < 'A' || toupper(input) > 'Z') { ******found = 1; ******puts ("\nPlease guess a letter"); ****} ****if (!found) { ******printf ("\nNope, no %c.\n", input); ******missed[nummissed++] = toupper(input); ****} **} while (nummissed < 10 && guessed < ULONG_MAX); **drawgallows (nummissed); **if (nummissed == 10) printf ("\nYour man is hanged. My word was '%s'.\n", word); **else printf ("%s\n\nGood work! You guessed my word!", word); } int play_again (void) { **char yesno; **printf ("\nWould you like to try another one? "); **while (!isalpha (yesno = getche ())); **if (tolower(yesno) != 'n') return 1; **return 0; } int main (int argc, char *arg[]) { FILE *fp; char buffer[25]; **srand (time (NULL)); **if (--argc > 0) { ****dictnum = 0; ****fp = fopen (arg[1], "r"); ****while (fgets (buffer, 25, fp)) { ******buffer[strlen(buffer) - 1] = 0; ******strcpy (dict[dictnum++], buffer); ****} **} **puts ("Hangman\n-------\n" **"Try to guess the word and save yourself from the gallows.\n" **"(To see the graphic tilt your head to the left.)\n"); **do {play ();} while (play_again ()); **puts ("Good-bye.\n"); **exit (0); } And NEXT?
|
||
![]() ![]() |
|
![]() |
#44 | ||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jan 2005
Location: Dusseldorf, Germany
Posts: 493
|
![]() Woohoo, finally some motivation to get back into c/c++. If I may say this in my case at all. I don´t believe that I ever came way further than the silly "Hello World" program
Indeed I got a little bit deeper into C of course. But I never made programming to a great passion although I always liked to. Maybe I was to layzy and easygoing, maybe I was absorbed with other things. "Anytime I will try to program every day a little" I thought to myself. And who knows: probably I´ll get my spurs in here. In any case I have to take my hat off to Guesst |
||
![]() ![]() |
|
![]() |
#45 | ||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: May 2005
Location: Aurora, United States
Posts: 606
|
![]() And if you write something, anything silly, dumb, creative, or awesome, post it here. That's what I started this project for.
I've been thinking I want to start up the Cymon's Games website in the next year or so. These games will be the first, but hopefully there will be enough people submitting that by the time they run out I'll have a ready flow of incomming programs. So who knows, DonCorleone, you may be the first, getting in on the ground floor of the future new thing on the Internet. Actually, it's a little below the ground at the moment. And it may never be built up. But stay tuned. |
||
![]() ![]() |
|
![]() |
#46 | ||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: May 2005
Location: Aurora, United States
Posts: 606
|
![]() Well, since no one voulenteered a game they'd like to see, it's my turn to pick. And I pick...
<div align="center"> ![]() Remember those little sliding puzzles where you'd win when all the pieces were in order? I loved those games. I was a wiz at them. This game has a similar concept. Once again I must kaotao to the BASIC program this game draws inspiration from. A 4x4 block of letters have been scrambled. In order to unscramble them you rotate 4 at a time clockwise. Thus there are 9 overlapping areas of rotation centered between each block of 4 letters. Code:
********A B C D ********E F G H ********I J M N ********K O L P Which position to rotate (0 - 9) ? A proper scrambling routine would take an unscrabled board and rotate pieces randomly. However, this game doesn't do that. This game's rotation routine just drops the pieces randomly on the board. Consequently it is possible to have an unwinnable situation if you limited yourself to just rotating pieces. So a bonus move has been added that will allow you to swap two pieces, like taking the stickers off the rubix cube. But to make it more game like the two pieces being swapped must be adjacent and you only get to do it once (you won't ever need more than that). Code:
/* Rotate * by Joseph Larson * Inspired by a BASIC program of the same name by David H. Ahl * as found in 'More BASIC Programs' edited by David H. Ahl (c) 1978 */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <ctype.h> #define DRAW for(c = 0; c < 16; c++) printf((c % 4) ? "%c " : "\n\n\t%c ", b[c]) int main (void) { **int c, d, temp, turn, special, done, b[16]; **char input; **int x[4] = {0, 4, 5, 1}; **int t[9] = {8, 9, 10, 4, 5, 6, 0, 1, 2}; **long mask; ** **srand (time (NULL)); **printf ("Rotate\n-------\n" **"Order the puzzle board from top to botom, left to right, in alphabetical\n" **"order by rotating four blocks at a time clockwise:\n" **"\n\tA B C D\n\t 7 8 9\n\tE F G H\n\t 4 5 6\n\tI J K L\n\t 1 2 3\n\tM N O P\n" **"\nIn the above illustration, the numbers betweent the letters are what you\n" **"will input. So if you want to rotate the A, D, E, and F you would input 7\n" **"as your move.\n\n" **"You also have one special move that you may not need where you can switch\n" **"the location of two adjacent blocks with each other. Input 0 (zero) as\n" **"your move if you want to do this. If you try to do a second special move\n" **"you will be asked if you want to quit.\n" **"\nGood luck!\n\nPress ENTER to begin..."); **getchar (); **do { ****mask = 0; ****for (c = 0; c < 16; c++) { ******while (1 << (b[c]=rand () % 16) & mask); ********mask |= 1 << b[c]; ********b[c] += 'A'; ****} ****done = 0; ****for (turn = special = 0; !done; turn++) { ******done = 0; ******putchar ('\t'); ******DRAW; ******printf ("\n\nWhich position to rotate (0 - 9) ? "); ******while (!isdigit(input = getchar ())) ********if (isalnum(input)) **********printf("\nPlease choose a number between 0 and 9 ? "); ******input -= '0'; ******if (input) { ********temp = b[t[--input]]; ********for (c = 0; c < 3; c++) **********b[t[input] + x[c]] = b[t[input] + x[c + 1]]; ********b[t[input] + x[3]] = temp; ******} else { ********printf ("\nDo you want to quit? (y/n) "); ********while (!isalpha(input = getchar ())) **********if (isalpha (input) && toupper (input) != 'Y' **********&& toupper (input) != 'N') printf("\nY or N please ? "); ********if (toupper (input) == 'Y') done = 2; ********else if (!special) { **********printf ("Which two letters do you want to switch? "); **********do input = getchar (); **********while (toupper (input) < 'A' || toupper (input) > 'P'); **********for (c = 0; b[c] != toupper(input); c++); **********do input = getchar (); **********while (toupper (input) < 'A' || toupper (input) > 'P'); **********for (d = 0; b[d] != toupper(input); d++); **********if (d - c != 1 && d - c != -1 && d - c != 4 && d - c != -4) { ************puts ("Those two letters are not adjacent."); turn --; **********} else {temp = b[c]; b[c] = b[d]; b[d] = temp; special = 1; turn++;} ********} ******} ******if (!done) for (c = done = 1; c < 16; c++) ********if (b[c - 1] > b[c]) done = 0; ****} ****if (!--done) { ******DRAW; ******printf ("\n\nYou ordered the board in %d moves!", turn); ******printf ("\nDo you want to play again? "); ****} else printf ("\nDo you want to try another? "); ****do input = getchar (); ****while (toupper (input) != 'Y' && toupper (input) != 'N'); ****done = (toupper (input) == 'N'); **} while (!done); **puts ("Goodbye!"); **exit (0); } Well, Cymon's original games is drawing near it's end. There are only 3 of the original 18 programs left. So what do you want to see next?
|
||
![]() ![]() |
|
![]() |
#47 | ||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() Quote:
And now I pick Pickup Piles. *goes back to doing math exercises; I've got an important exam next year* |
||
![]() ![]() |
|
![]() |
#48 | ||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: May 2005
Location: Aurora, United States
Posts: 606
|
![]() Pickup Piles
Before you is a pile and your opponent. You can only take a certian number of pieces, and you have to take at least a certian number. Maybe you want to be the one to take the last piece. Maybe you want to take everything but the last piece. So many things to keep track of, do you have the mind to win? The frustrating thing about this game is the outcome is almost always predictable from the first move, if at least one player knows what they are doing. Thus the only way to actually win is to stack the deck in your favor. Where this game gets fun is the endless variations it provides. Playing with the settings and getting good at this game is what it's about. When you get the hang of the game and figure out what the trick is take your skill to family and friends, maybe even play this it in the bar and make <strike>a few dollars</strike> some new friends. Seeing how the computer plays a perfect game can teach you the trick. It is of course mathematical in nature, so bone up on your division skills. The computer plays a perfect game but every so often, depending on the difficulty level, it will just make a shot in the dark random move that may or may not be the right move. This can also be part of the fun, catching the computer's mistakes. Code:
/* Pickup Pile */ /* by Joseph Larson */ /* Inspired by a BASIC game Batnum by John Kemeny */ /* as found in 'BASIC Computer Games' edited by David H. Ahl © 1978 */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <ctype.h> #define random(x) ((int) rand() / ((float)(RAND_MAX + 1) / x)) int num, max, min; int takelast, comfirst; int skill; void intro (void) { **printf ("\nPick Up Pile\n------\n" **"Pick Up Pile is a game with many variations on the same idea.\n" **"You and the computer each take turns picking up items from an\n" **"imaginary pile of objects. Depending on the type of game you choose\n" **"to play you will have different restrictions on how much you can\n" **"pick up at a time, and whether you want to be the one to pick up the\n" **"last piece or not.\n"); } void random_setup (void) { ******num = random (25) + 10; max = random (5) + 3; ******do min = random (3) + 1; while ( max < min ); ******takelast = random (2); comfirst = random (2); ******printf ("\n%d in pile, %s first, winner %s last piece.\n", num, ********(comfirst) ? "computer goes" : "you go", ********(takelast) ? "takes" : "leaves" ); ******printf ("Take at least %d and at most %d per turn.\n", min, max); } void custom_setup(void) { **int input; **char yesno; **printf ("\nFor any option input 0 to have the computer randomly select a value."); **printf ("\nChoose the size of the pile (at least 3) "); **do scanf("%d", &num); **while (num < 3 && num != 0); **if (num == 0) { ******num = random (30) + 10; ******printf("%d in pile.", num); **}**** **printf ("\nWhat is the least that can be taken in a turn? "); **do scanf("%d", &min); **while (min < 0); **if (min == 0) { ******min = random (5) + 1; ******printf("\n%d minimum taken per turn.", min); **}**** **printf ("\nWhat is the most that can be taken in a turn (at least %d)? ", min + 1); **do scanf("%d", &max); **while (max < min && max != 0); **if (max == 0) { ******max = random (5) + min + 2; ******printf("%d maximum taken per turn.", max); **}**** **printf ("\nShould the winner take the last peace? (y/n/0)"); **do scanf("%c", &yesno); **while (yesno != 'y' && yesno != 'Y' && yesno != 'n' && yesno != 'N' && yesno != '0'); **switch (yesno) { ****case 'y': case 'Y': takelast = 1; break; ****case 'n': case 'N': takelast = 0; break; ****case '0': ******takelast = random (2); ******printf("Winner %s last peace.", (takelast) ? "takes" : "leaves" ); **}**** **printf ("\nDo you want to go first? (y/n/0)"); **do scanf("%c", &yesno); **while (yesno != 'y' && yesno != 'Y' && yesno != 'n' && yesno != 'N' && yesno != '0'); **switch (yesno) { ****case 'y': case'Y': comfirst = 0; break; ****case 'n': case 'N': comfirst = 1; break; ****case '0':**** ******comfirst = random (2); ******printf("%s first.", (comfirst) ? "Computer goes" : "You go" ); **}** } int humanmove(void) { **int input; **printf ("\nHow many do you want to take (%d - %d) ", ****(min > num) ? num : min, (max > num) ? num : max); **input = 0; **do { ****if (input) printf ("\nInvalid move. Try again. "); ****scanf ("%d", &input); ****if (num <= min) input = (input == num) ? input : -1; ******else if (input < min || input > max || input > num) input = -1; **} **while (input < 0); **num -= input; **printf ("You leave %d", num); **return ((num) ? 0 : (takelast)? 1 : 2); } int compmove (void) { **int c; **int move; ** **c = min + max; move = num - !takelast; **move = move % c; **if (move < min || move > max || skill < random (5)) ****move = random((max - min + 1)) + min; **if (move > num) move = num; **num -= move; **printf ("\nComputer takes %d and leaves %d", move, num); **return ((num) ? 0 : (takelast)? 2 : 1); } void playgame (void) { **int input; **int winner; **printf ("\n(1) 23 Matches (23 in pile, take at most 3, last piece looses)\n"); **printf ("(2) Random\n"); **printf ("(3) Custom\n"); **printf ("\nChoose a game type: "); **input = 0; **do { ****if (input) printf ("\nChoose 1, 2, or 3 please. "); ****scanf ("%d", &input); **} while (input < 1 || input > 3); **switch (input) { ****case 1 : ******num = 23; max = 3; min = 1; takelast = 0; comfirst = 0; ******break; ****case 2 : ******random_setup(); ******break; ****case 3 : ******custom_setup (); **} **printf ("\nOn a scale of 1 to 5, 5 being best,\n"); **printf ("how well do you want the computer to play? (1-5) "); **scanf("%d", &skill); **winner = 0; **if (!comfirst) { ****printf ("\n%d in pile.", num); ****winner = humanmove (); **} **while (!winner) { ****winner = compmove (); ****if (!winner) winner = humanmove (); **} **if (winner == 2) ****printf ("\nComputer wins!"); **else printf ("\nYou win!"); } int playagain (void) { **char input; **printf ("\nThat was fun. Would you like to play again? (y\\n) "); **do input = getchar(); **while (!isalpha(input)); **if (input == 'y' || input == 'Y') return (1); **else return(0); } int main (void) { **srand (time(NULL)); **intro (); **do playgame (); while (playagain ()); **exit (0); }
|
||
![]() ![]() |
|
![]() |
#49 | ||
![]() ![]() ![]() ![]() Join Date: Aug 2005
Location: Ofverby, Finland
Posts: 12
|
![]() You're missing Minesweeper (at least) in the original list! :wink:
I did it with Python, somebody PM me if you want to see it. (o_O) |
||
![]() ![]() |
|
![]() |
#50 | ||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: May 2005
Location: Aurora, United States
Posts: 606
|
![]() Feel free to post it here or make your own thread for it.
Minesweeper in a console ap? I guess it could be done, but the input process would be tedious at best. |
||
![]() ![]() |
|
![]() |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Happy Birthday Guesst | Japo | Birthdays & Celebrations | 8 | 06-07-2007 09:50 AM |
Happy Birthday, Guesst | Shrek | Blah, blah, blah... | 10 | 08-07-2006 09:31 AM |
|
|
||
  |