Welcome to Incels.is - Involuntary Celibate Forum

Welcome! This is a forum for involuntary celibates: people who lack a significant other. Are you lonely and wish you had someone in your life? You're not alone! Join our forum and talk to people just like you.

Story the SERPENT pill destroyed me

M

Med Amine

Visionary
★★★★★
Joined
Dec 29, 2022
Posts
24,357
didn't work :(
C++:
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
#include <ctype.h>
#include <process.h>
#define UP 72
#define DOWN 80
#define LEFT 75
#define RIGHT 77
typedef struct coordonnes coordonnes;
struct coordonnes
{
    int direction;
    int x;
    int y;
};
coordonnes tete, tour[500], apa, corps[30];
int len;
char ns;
int vie;
void load();
int langeur;
int alongation;
void record();
void Move();
void apat();
int Score();
int scooore();
void afficher();
int speed;
void xy(int x, int y);
void allerxy(int x, int y);
void tourner();
void mur();
void bas();
void gauche();
void haut();
void droit();
void quiter();
void afficher()
{
    printf("instructions:\n");
    printf("\n-> Utilisez les fleches pour deplacer le serpent.\n\n-> Vous recevrez des aliments aux differentes coordonnees de l'ecran que vous devrez manger. Chaque fois que vous mangez un aliment la longueur du serpent sera augmentee d'un element.\n\n->Votre vie diminuera lorsque vous frapperez le mur ou le corps du serpent.\n\n-> Vous pouvez mettre le jeu en pause en son milieu en appuyant sur P. Pour continuer le jeu en pause appuyez à nouveau sur n'importe quelle autre nd\n\n-> Si vous voulez quitter appuyez sur esc\n");
    int r;
    printf("selectionner la difficulté et clicker deux foix sur entrer \n");
    printf("1.difficile \n 2.mediume\n 3.facile \n ");
    scanf("%d", &r);
    if (r == 1) {
        speed = 25;
    }
    else if (r == 2) {
        speed = 55;
    else {
        speed = 100;
    }
    if (getch() == 27)
        exit(0);
}
void Move()
Show quoted text
    ns = getch();
    if ((ns == LEFT && tete.direction != RIGHT && tete.direction !=LEFT) || (ns == UP && tete.direction != DOWN && tete.direction != UP)|| (ns == RIGHT && tete.direction != LEFT && tete.direction != RIGHT) || (ns == DOWN && tete.direction != UP && tete.direction != DOWN))
    {
        alongation++;
        tour[alongation] = tete;
        tete.direction = ns;
        if (ns == RIGHT)
            tete.x+;
        if (ns == UP
            tete.y--;
        if (ns == LEFT)
            tete.x--;
        if (ns == DOWN)
            tete.y++;
        Move();
    }
    else
    {
        printf("\a");
        Move();
    }}
void xy(int x, int y)
{
    COORD coord;
    coord.X = x;
    coord.Y = y;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
void allerxy(int x, int y)
{
    HANDLE a;
    COORD b;
    fflush(stdout);
    b.X = x;
    b.Y = y;
    a = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(a, b);
}
void load()
{
    int row, col, i, j, q;
    xy(36, 14);
    printf("t'es pres?");
    xy(30, 15);
 
    for (i = 1; i <= 20; i++)
    {
        for (j = 0; j <= 10000000; j++)
            ;
        printf("%c", 177);
    }
    getch();
}
void quiter()
{
    int i, verf = 0;
    for (i = 4; i < langeur; i++)
    {
        if (corps[0].x == corps[i].x && corps[0].y == corps[i].y)
        {
            verf++;
        }
        if (i == langeur || verf != 0)
            break;
    }
    if (tete.x <= 10 || tete.x >= 70 || tete.y <= 10 || tete.y >= 30
        || verf != 0)
    {
        vie--;
        if (vie >= 0)
        {
            system("cls");
            mur();
            tete.x = 25;
            tete.y = 20;
            alongation = 0;
            tete.direction = RIGHT;
            Move();
        }
        else
        {
            system("cls");
            printf("game over\n");
            record();
            exit(0);
        }
    }
void apat()
{
    if (tete.x == apa.x && tete.y == apa.y)
    {
        langeur++;
        time_t a;
        a = time(0);
        srand(a);
        apa.x = rand() % 70;
        if (apa.x <= 10)
            apa.x += 11;
        apa.y = rand() % 30;
        if (apa.y <= 10)
            apa.y += 11;
    }
    else if (apa.x == 0)
    {
        apa.x = rand() % 70;
        if (apa.x <= 10)
            apa.x += 11;
        apa.y = rand() % 30;
        if (apa.y <= 10)
            apa.y += 11;
    }
}
 
void bas()
{
    int i;
    for (i = 0; i <= (tete.y - tour[alongation].y) && len < langeur; i++)
    {
        allerxy(tete.x, tete.y - i);
        {
            if (len == 0
                printf("v");
            else
                printf("*");
        }
        corps[len].x = tete.x;
        corps[len].y = tete.y - i;
        len++;
    }
    tourner();
    if (!kbhit())
        tete.y++;
}
 
void gauche()
{
    int i;
    for (i = 0; i <= (tour[alongation].x - tete.x) && len < langeur; i++)
    {
        allerxy((tete.x + i), tete.y);
        {
            if (len == 0)
                printf("<");
            else
                printf("*");
        }
        corps[len].x = tete.x + i;
        corps[len].y = tete.y;
        len++;
    }
    tourner();
    if (!kbhit())
        tete.x--;
}
void droit()
{
    int i;
    for (i = 0; i <= (tete.x - tour[alongation].x) && len < langeur; i++)
    {
        corps[len].x = tete.x - i;
        corps[len].y = tete.y;
        allerxy(corps[len].x, corps[len].y);
        {
            if (len == 0)
                printf(">");
            else
                printf("*");
        }
 
        len++;
    }
    tourner();
    if (!kbhit())
        tete.x++;
}
void haut()
{
    int i;
    for (i = 0; i <= (tour[alongation].y - tete.y) && len < langeur; i++)
    {
        allerxy(tete.x, tete.y + i);
        {
            if (len == 0)
                printf("^");
            else
                printf("*");
        }
        corps[len].x = tete.x;
        corps[len].y = tete.y + i;
        len++;
    }
    tourner();
    if (!kbhit()

        tete.y--;
}
void tourner()
{
    int i, j, diff, x, y;
    for (i = alongation; len < langeur && i >= 0 ; i--)
    {
        if (tour[i].x == tour[i - 1].x)
        {
            diff = tour[i].y - tour[i - 1].y;
            if (diff < 0)
                for (j = 1; j <= (-diff); j++)
                {
                    corps[len].x = tour[i].x;
                    corps[len].y = tour[i].y + j;
                    allerxy(corps[len].x, corps[len].y);
                    printf("*");
                    len++;
                    if (len == langeur)
                        j=-diff+1;
                }
            else if (diff > 0)
                for (j = 1; j <= diff; j++)
                {
 
                    corps[len].x = tour[i].x;
                    corps[len].y = tour[i].y - j;
                    allerxy(corps[len].x, corps[len].y);
                    printf("*");
                    len++;
                    if (len == langeur)
                        j=diff+1;
                }
        }
        else if (tour[i].y == tour[i - 1].y)
        {
            diff = tour[i].x - tour[i - 1].x;
            if (diff < 0)
                for (j = 1; j <= (-diff) && len < langeur; j++)
                {
 
                    corps[len].x = tour[i].x + j;
                    corps[len].y = tour[i].y;
                    allerxy(cors[len].x, corps[len].y);

                    printf("*");
                    len++;
                    if (len == langeur)
                        j=-diff+1;
                }
            else if (diff > 0)
                for (j = 1; j <= diff && len < langeur; j++)
                {
 
                    corps[len].x = tour[i].x - j;
                    corps[len].y = tour[i].y;
                    allerxy(corps[len].x, corps[len].y);
                    printf("*");
                    len++;
                    if (len == langeur)
                        j=diff+1;
                }
       }
    }
    x = corps[langeur - 1].x;
    y = corps[laneur - 1].y;
    allerxy(x, y);
}
void mur()
{
    int i;
    allerxy(apa.x, apa.y);
    printf("*");
    for (i = 10; i < 71; i++)
    {
        allerxy(i, 10);
        printf("+");
        allerxy(i, 30);
        printf("+");
    }
    for (i = 10; i < 31; i++)
    {
        allerxy(10, i);
        printf("+");
        allerxy(70, i);
        printf("+");
    }
}
int Score()
    int score;
    allerxy(20, 8);
    score = langeur - 3;
    printf("SCORE : %d", score);
    allerxy(50, 8);
    printf("Life : %d", vie);
    return score;
}
int scooore()
{
    int score = Score();
    system("cls");
    return score;
}
void record()
{
    char nj[20], nnj[20], rep, c;
    int i, j, px;
    FILE* info;
    info = fopen("record.txt", "a+");
    getch();
    system("cls");
    printf("Enter your name\n");
    scanf("%[^\n]",nj);
    for (j = 0;nj[j] != '\0'; j++)
    {
        nnj[0] = toupper(nj[0]);
        if (nj[j - 1] == ' ')
        {
            nnj[j] = toupper(nj[j]);
            nnj[j - 1] =nj[j - 1];
        }
        else
            nnj[j] =nj[j];
    }
    nnj[j] = '\0';
    fprintf(info, "nom joueur :%s\n", nnj);
    time_t mytime;
    mytime = time(NULL);
    fprintf(info, " Date:%s", ctime(&mytime));

    fprintf(info, "Score:%d\n", px = langeur - 5);
    for (i = 0; i <= 50; i++)
        fprintf(info, "%c", '_');
    fprintf(info, "\n");
    fclose(info);
    printf("voullez voir les autres record? 'oui'\n");
    rep = getch();
    system("cls");
    if (rep == "oui")
    {
        info = fopen("record.txt", "r");
        do
        {
            putchar(c = getc(info));
        } while (c != EOF);
   }
    fclose(info);
}
void main()
{
    char ns;
    afficher();
    system("cls");
    load();
    system("cls");
    langeur = 3;
    tete.x = 25;
    tete.y = 20;
    tete.direction = RIGHT;
    mur();
    apat();
    vie = 5;
    tour[0] = tete;
    Move();
Sent from Mail for Windows
Show quoted text
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
#include <ctype.h>
#include <process.h>
#define UP 72
#define DOWN 80
#define LEFT 75
#define RIGHT 77
typedef struct coordonnes coordonnes;
truct coordonnes
{
    int direction;
    int x
    int y;
};
coordonnes tete, tour[500], apa, corps[30];
int len;
char ns;
int vie;
void load();
int langeur;
int alongation;
void record();
void Move();
void apat();
int Score();
int scooore();
void affiher();
int speed;
void xy(int x, int y);
void allerxy(int x, int y);
void tourner();
void mur();
void bas();
void gauche();
void haut();
void droit();
void quiter();
void afficher()
{
    printf("instructions:\n");
    printf("\n-> Utilisez les fleches pour deplacer le serpent.\n\n-> Vous recevrez des aliments aux differentes coordonnees de l'ecran que vous devrez manger. Chaque fois que vous mangez un aliment la longueur du serpent sera augmentee d'un element.\n\n->Votre vie diminuera lorsque vous frapperez le mur ou le corps du serpent.\n\n-> Vous pouvez mettre le jeu en pause en son milieu en appuyant sur P. Pour continuer le jeu en pause appuyez à nouveau sur n'importe quelle autre nd\n\n-> Si vous voulez quitter appuyez sur esc\n");
    int r;
    printf("selectionner la difficulté et clicker deux foix sur entrer \n");
    printf("1.difficile \n 2.mediume\n 3.facile \n ");
    scanf("%d", &r);
    if (r == 1) {
        speed = 25;
    }
    else if (r == ) {
        speed = 55;
    }
    else {
        speed = 100;
    }
    if (getch() == 27)
        exit(0);
void Move()
Show quoted tex
    ns = getch();
    if ((ns == LEFT && tete.direction != RIGHT && tete.direction !=LEFT) || (ns == UP && tete.direction != DOWN && tete.direction != UP)|| (ns == RIGHT && tete.direction != LEFT && tete.direction != RIGHT) || (ns == DOWN && tete.direction != UP && tete.direction != DOWN))
    {
        alongation++;
        tour[alongation] = tete;
        tete.direction = ns;
 
        if (ns == RIGHT)
            tete.x++;
        if (ns == UP)
            tete.y--;
        if (ns == LEFT)
            tete.x--;
        if (ns == DOWN)
            tete.y++;
        Move();
    }
    else
    {
        printf("\a");
        Move();
    }
}
void xy(int x, int y)
{
    COORD coord;
    coord.X = x;
    coord.Y = y;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
void allerxy(int x, int y)
{
    HANDLE a;
    COORD b
    fflush(tdout);
    b.X = x;
    b.Y = y;
    a = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(a, b);
}
void load()
{
    int row, col, i, j, q;
    xy(36, 14);
    printf("t'es pres?");
    xy(30, 15);
 
    or (i = 1; i <= 20; i++)
    {
        for (j = 0; j <= 10000000; j++)
            ;
        printf("%c", 177);
    }
    getch();
}
void quiter()
{
    int i, verf = 0;
    for (i = 4; i < langeur; i++)
    {
        if (corps[0].x == corps[i].x && corps[0].y == corps[i].y)
        {
            verf++;
        }
        if (i == langeur || verf != 0)
            break;
    }
    if (tete.x <= 10 || tete.x >= 70 || tete.y <= 10 || tete.y >= 30
        || verf != 0)
    {
        vie--;
        if (vie >= 0)
        {
            system("cls");
            mur();
            tete.x = 25;
            tete.y = 20;
            alongation = 0;
            tete.direction = RIGHT;
            Move();
        }
        else
        {
            system("cls");
            printf("game over\n");
            record();
            exit(0);
        }
    }
}
void apat()
{
    if (tete.x == apa.x && tete.y == apa.y)
    {
        langeur++;
        time_t a;
        a = time(0);
        srand(a);
        apa.x = rand() % 70;
        if (apa.x <= 10)
            apa.x += 11;
        apa.y = rand() % 30;
        if (apa.y <= 10)
            apa.y += 11;
    }
    else if (apa.x == 0)
    {
        apa.x = rand() % 70;
        if (apa.x <= 10)
            apa.x += 11;
        apa.y = rand() % 30;
        if (apa.y <= 10)
            apa.y += 11;
    }
}
void bas()
{
    int i;
    for (i = 0; i <= (tete.y - tour[alongation].y) && len < langeur; i++)
    {
        allerxy(tete.x, tete.y - i);
        {
            if (len == 0)
                printf("v");
            else
                printf("*");
        }
        corps[len].x = tete.x;
        corps[len].y = tete.y - i;
        len++;
    }
    tourner();
    if (!kbhit())
        tete.y++;
}
void gauche()
{
    int i;
    for (i = 0; i <= (tour[alongation].x - tete.x) && len < langeur; i++)
    {
        allerxy((tete.x + i), tete.y);
        {
            if (len == 0)
                printf("<");
            else
                printf("*");
        }
        corps[len].x = tete.x + i;
        corps[len].y = tete.y;
        len++;
    }
    tourner();
    if (!kbhit())
       tete.x--;

}
void droit()
{
    int i;
    for (i = 0; i <= (tete.x - tour[alongation].x) && len < langeur; i++)
    {
        corps[len].x = tete.x - i;
        corps[len].y = tete.y;
        allerxy(corps[len].x, corps[len].y);
        {
            if (len == 0)
                printf(">");
            else
                printf("*");
        }
 
        len++;
    }
    tourner();
    if (!kbhit())
        tete.x++;
void haut()
{
    int i;
    for (i = 0; i <= (tour[alongation].y - tete.y) && len < langeur; i++)
    {
        allerxy(tete.x, tete.y + i);
        {
            if (len == 0)
                printf("^");
            else
                printf("*");
        }
        corps[len].x = tete.x;
        corps[len].y = tete.y + i;
        len++;
    }
    tourner();
    if (!kbhit())
       tete.y--;

}
void tourner()
{
    int i, j, diff, x, y;
    for (i = alongation; len < langeur && i >= 0 ; i--)
    {
        if (tour[i].x == tour[i - 1].x)
        {
            diff = tour[i].y - tour[i - 1].y;
            if (diff < 0)
                for (j = 1; j <= (-diff); j++)
                {
                    corps[len].x = tour[i].x;
                    corps[len].y = tour[i].y + j;
                    allerxy(corps[len].x, corps[len].y);
                    printf("*");
                    len++;
                    if (len == langeur)
                        j=-diff+1;
                }
            else if (diff > 0)
                for (j = 1; j <= diff; j++)
                {
 
                    corps[len].x = tour[i].x;
                    corps[len].y = tour[i].y - j;
                    allerxy(corps[len].x, corps[len].y);
                    printf("*");
                    len++;
                    if (len == langeur)
                        j=diff+1;
                }
        }
        else if (tour[i].y == tour[i - 1].y)
        {
            diff = tour[i].x - tour[i - 1].x;
            if (diff < 0)
                for (j = 1; j <= (-diff) && len < langeur; j++)
                {
 
                    corps[len].x = tour[i].x + j;
                    corps[len].y = tour[i].y;
                    allerxy(corps[len].x, corps[len].y);
                    printf("*");
                    len++;
                    if (len == langeur)
                        j=-diff+1;
                }
            else if (diff > 0)
                for (j = 1; j <= diff && len < langeur; j++)
                {
 
                    corps[len].x = tour[i].x - j;
                    corps[len].y = tour[i].y;
                    allerxy(corps[len].x, corps[len].y);
                    printf("*");
                    len++;
                    if (len == langeur)
                        j=diff+1;
                }
       }
    }
    x = corps[langeur - 1].x;
    y = corps[langeur - 1].y;
    allerxy(x, y);
}
void mur()
{
    int i;
    allerxy(apa.x, apa.y);
    printf("*");
    for (i = 10; i < 71; i++)
    {
        allerxy(i, 10);
        printf("+");
        allerxy(i, 30);
        printf("+");
    }
    for (i = 10; i < 31; i++)
    {
        allerxy(10, i);
        printf("+");
        allerxy(70, i);
        printf("+");
    }
}
int Score()
{
    int score;
    allerxy(20, 8);
    score = langeur - 3

    printf("SCORE : %d", score);
    allerxy(50, 8);
    printf("Life : %d", vie);
    return score;
}
int scooore()
{
    int score = Score();
    system("cls");
    return score;
}
void record()
{
    char nj[20], nnj[20], rep, c;
    int i, j, px;
    FILE* info;
    info = fopen("record.txt", "a+");
    getch();
    system("cls");
    printf("Enter your name\n");
    scanf("%[^\n]",nj);
    for (j = 0;nj[j] != '\0'; j++)
    {
        nnj[0] = toupper(nj[0]);
        if (nj[j - 1] == ' ')
        {
            nnj[j] = toupper(nj[j]);
            nnj[j - 1] =nj[j - 1];
        }
        else
            nnj[j] =nj[j];
    }
    nnj[j] = '\0';
    fprintf(info, "nom joueur :%s\n", nnj);
    time_t mytime;
    mytime = time(NULL);
    fprintf(info, " Date:%s", ctime(&mytime));
    fprintf(info, "Score:%d\n", px = langeur - 5);
    for (i = 0; i <= 50; i++)
        fprintf(info, "%c", '_');
    fprintf(info, "\n");
    fclose(info);
    printf("voullez voir les autres record? 'oui'\n");
    rep = getch();
    system("cls");
    if (rep == "oui")
    {
        info = fopen("record.txt", "r");
        do
        {
            putchar(c = getc(info));
        } while (c != EOF);
    }
    fclose(info);
}
 
void main()
{
    char ns;
    afficher();
    system("cls");
    load();
    system("cls");
    langeur = 3;
    tete.x = 25;
    tete.y = 20;
    tete.direction = RIGHT;
    mur();
    apat();
    vie = 5;
    tour[0] = tete;
    Move();
}


/thread
return 0;
}


View: https://www.youtube.com/watch?v=KT8sUs5Hrfk
 
Last edited:
No idea what any of that means.
 
Regular old C code
 

Similar threads

YuiStillMyCope
Replies
21
Views
5K
sultryloser
sultryloser
InMemoriam
Replies
2
Views
601
InMemoriam
InMemoriam
fukurou
Replies
5
Views
541
fukurou
fukurou
Pillow City Pimp
Replies
22
Views
12K
THE TRUE DIGLET
THE TRUE DIGLET

Users who are viewing this thread

shape1
shape2
shape3
shape4
shape5
shape6
Back
Top