Thread: (share) shuten game

  1. #1
    Registered User
    Join Date
    Jun 2013
    Posts
    17

    (share) shuten game

    i just wanna share my first game in C programming.

    Code:
    #include <stdio.h>
    #include <math.h>
    void win(void){
        printf("\nyou win and computer lose\n");
        }
    void lose(void){
        printf("\nyou lose and computer win\n");
        }
    void draw(void){
        printf("\ndraw my bro\n");
        }
    void thumble(void){
    printf("            ▄▄\n");
    printf("           █░░█\n");
    printf("           █░░█\n");
    printf("          █░░░█\n");
    printf("         █░░░░█\n");
    printf("██████▄▄█░░░░░██████▄\n");
    printf("▓▓▓▓▓▓█░░░░░░░░░░░░░░█\n");
    printf("▓▓▓▓▓▓█░░░░░░░░░░░░░░█\n");
    printf("▓▓▓▓▓▓█░░░░░░░░░░░░░░█\n");
    printf("▓▓▓▓▓▓█░░░░░░░░░░░░░░█\n");
    printf("▓▓▓▓▓▓█░░░░░░░░░░░░░░█\n");
    printf("▓▓▓▓▓▓█████░░░░░░░░░██\n");
    printf("█████     ▀▀████████\n");
    }
    void vs(void){
    printf("\n\n\tvs\n\n");
    
    
    
    
    
    
    }
    void index1(void){
    printf("         ██████\n");
    printf("██████▄▄█░░░░░██████▄▄▄▄▄▄▄▄▄▄▄\n");
    printf("▓▓▓▓▓▓█░░░░░░░░░░░░░░▄▄▄▄▄▄▄▄▄█\n");
    printf("▓▓▓▓▓▓█░░░░░░░░░░░░░░█\n");
    printf("▓▓▓▓▓▓█░░░░░░░░░░░░░░█\n");
    printf("▓▓▓▓▓▓█░░░░░░░░░░░░░░█\n");
    printf("▓▓▓▓▓▓█░░░░░░░░░░░░░░█\n");
    printf("▓▓▓▓▓▓█████░░░░░░░░░██\n");
    printf("█████     ▀▀████████\n");
    }
    void pinkie(void){
    printf("         ██████\n");
    printf("██████▄▄█░░░░░██████▄\n");
    printf("▓▓▓▓▓▓█░░░░░░░░░░░░░░█\n");
    printf("▓▓▓▓▓▓█░░░░░░░░░░░░░░█\n");
    printf("▓▓▓▓▓▓█░░░░░░░░░░░░░░█\n");
    printf("▓▓▓▓▓▓█░░░░░░░░░░░░░░█\n ");
    printf("▓▓▓▓▓▓█░░░░░░░░░░░░░░█▄▄▄▄▄\n");
    printf("▓▓▓▓▓▓█████░░░░░░░░░▄▄▄▄▄▄▄▄█\n");
    printf("█████     ▀▀████████\n");
    } 
    int play();
    main(){
        int play1=1,win[3]={0,0,0};
         while (play1 >= 1)
        {
                
             char again;
            int
        a= play();
        
        
         switch (a){
                case 1: 
                   
                    win[0]++;
                    break;
                case -1:
                    
                    win[1]++;
                    break;
                case 0:
                     
                    win[2]++;
                    break;
                default:
                    printf("Unknown winner");
                    break;
            }
            printf("So far \n you has won: %d times\n computer has won: %d times\n and there have been %d draws.\n", win[0], win[1], win[2]);
        
        
        printf("would you like another go Y or N :");
            scanf("%c", &again);
            getchar();
     if ((again=='y') || (again=='Y'))
            {
                play1    ++;
                
            }
            else if ((again=='n') || (again=='N'))
            {
                printf("Thank you for playing goodbye\n");
     
                play1=0;
            }
                 else
                        printf("Invalid entry\n");
        }    
        }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    int play(){
    system("clear");
    printf("|mini game shuten\t\t|\n");
    printf("|1 . thumble\t\t\t|\n");
    printf("|2 . index\t\t\t|\n");
    printf("|3 . kelinking\t\t\t|\n");
    printf("\n\n entry what do you choose : ");
    int a,b;
    
    
    scanf("%d", &a);
    srand((unsigned int)time(NULL) );
    b = rand()%3;
    b += 1;
    
    
    
    
    if ((a==1&&b==1)||(a==2&&b==2)||(a==3&&b==3)){
    if (a==1&&b==1){
    thumble();
    vs();
    thumble();
    draw();
    return 0;
    }
    else if (a==2&&b==2){
     index1();
     vs();
     index1();
     draw();
    return 0;
    }
    
    
    else if (a==3&&b==3){
     pinkie();
     vs();
     pinkie();
     draw();
    return 0;
    }
    else {
    return 0;
    draw();
    }
    }
    else if ((a==1&&b==2)||(a==2&&b==3)||(a==3&&b==1)){
    if  (a==1&&b==2){
    thumble();
    vs();
    index1();
    win();
    return 1;
    }
    else if (a==2&&b==3){
     index1();
     vs();
     pinkie();
     win();
    return 1;
    }
    else if (a==3&&b==1){
     pinkie();
     vs();
     thumble();
     win();
    return 1;
    }
    else{
        win();
    return 1; } } else if ((a==2&&b==1)||(a==3&&b==2)||(a==1&&b==3)){ if 
    (a==2&&b==1){
     index1();
     vs();
     thumble();
     lose();
    return 2;
    }
    else if (a==3&&b==2){
     pinkie();
     vs();
     index1();
     lose();
     return 2;
     }
     else if (a==1&&b==3){
    thumble();
    vs();
    pinkie();
    lose();     
    return 2;
    }
         else{
    lose();
    return 2;
    
    
    }
    }
    }

    i was sorry before i still study
    Last edited by aldyfight; 06-19-2013 at 05:50 AM.

  2. #2
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    i was sorry before i still study
    not make sense you much

    Clearly your first language is not English. Are you using a translation program? If so, it's not working very well.

    And the layout of your code is so bad that no one here is going to read it. If you actually want feedback on how to improve it, you'll have to format it better.

  3. #3
    Registered User
    Join Date
    Jun 2013
    Posts
    17
    hahahaha on linux is doesnt have, conio.h and i will make it better, i was sorry i am from indonesia my vocabolary is little, hahahahah next time i will improve. if you wanna improve. use this code

  4. #4
    Registered User
    Join Date
    Jun 2013
    Posts
    17
    okey thanks for feed back

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Share with us!
    By ILoveVectors in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 08-24-2005, 05:15 PM
  2. Everybody share your site
    By Shadow in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 09-28-2004, 11:13 AM
  3. I want to share in your knowlegde
    By zergdeath1 in forum C Programming
    Replies: 3
    Last Post: 09-23-2003, 09:05 PM