<commit_before>#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <time.h>
#include <math.h>
#include <string.h>
#include "libs/arrkeys.h"
#include "libs/characters.h"
#include "libs/map_utils.h"

void loadLv(int *nLv, int *enN);
void fightSmiley(chara *hero, int ind, int enN);

int main (){

    srand(time(0));

    int ch;
    int ind = 0;
    int lvs = 2;
    int enN = 3;

    loadLv(&lvs, &enN);

    int map_size = MAX*MAX;

    pos you_are_here, map_positions[map_size];
    pos goal;
    chara hero;

    hero.hp = 30;
    hero.st = 10;
    hero.sp = 20;
    hero.def = 7;
    hero.xp = 0;

    system("mode con:cols=80 lines=31");

    for(ind=0;ind<map_size;ind++){
        map_positions[ind].x=-1;
        map_positions[ind].y=-1;
    }

    ind =1;

    loadMap(&you_are_here, map_positions, &goal, ind);

    ch=0;

    mapi(you_are_here, map_positions, goal, map_size, hero);

    while ((ch = getch()) != 27){  /* 27 = Esc key */
        if (ch == 0 || ch == 224){

            switch (_getch ()){

                case 72:
                    if(!checkli(you_are_here.x, you_are_here.y-1, map_positions, map_size)){
                        if(you_are_here.y > 0){
                            you_are_here.y -= 1;
                        }
                        else if(!checkli(you_are_here.x, MAX-1, map_positions, map_size)){
                            you_are_here.y = MAX-1;
                        }
                    }
                    break;

                case 77:
                    if(!checkli(((you_are_here.x+1)%MAX), you_are_here.y, map_positions, map_size)){
                        you_are_here.x = (you_are_here.x+1)%MAX;
                    }
                    break;
                case 75:
                    if(!checkli(you_are_here.x-1, you_are_here.y, map_positions, map_size)){
                        if(you_are_here.x > 0){
                            you_are_here.x -= 1;
                        }
                        else if(!checkli(MAX-1, you_are_here.y, map_positions, map_size)){
                            you_are_here.x = MAX-1;
                        }
                    }
                    break;
                case 80:
                    if(!checkli(you_are_here.x, (you_are_here.y+1)%MAX, map_positions, map_size)){
                        you_are_here.y = (you_are_here.y+1)%MAX;
                    }
                    break;
            }

            system("cls");

            if(rand()%15==1){
                fightSmiley(&hero, ind, enN);
            }

            system("cls");

            mapi(you_are_here, map_positions, goal, map_size, hero);
        }
        if (you_are_here.x==goal.x&& you_are_here.y==goal.y){

            char lv[16];
            int pp=0;

            if (ind<lvs){
                ind++;
                loadMap(&you_are_here, map_positions, &goal, ind);
                system("cls");

                sprintf(lv, "L E V E L   %d", ind);

                int pp=0;

                for(pp=0;lv[pp]!='\0';pp++){
                    printf("%c", lv[pp]);
                    Sleep(100);
                }

            }
            else{
                system("cls");
                printf("\n\n\n\n\n\n\n\n\n");

                char end[107] = "congratulations you've escaped the castle of death \n and survived the evil smiley horde\n\n\n T H E   E N D";

                for(pp=0;end[pp] != '\0';pp++){
                    printf("%c", end[pp]);
                    Sleep(100);
                }

                printf("\n\n");
                system("pause");

                exit(0);

            }
        }
    }

    printf("ESC %d\n", ch);
    return (0);
}


void loadLv(int *nLv, int *enN){

    char ch[7];
    char file_name[25] = "settings.txt";
    FILE *fp;

    fp = fopen(file_name, "r"); // read mode

    if( fp == NULL )
    {
        perror("Error while opening the level file.\n");
        system("pause");
        exit(EXIT_FAILURE);
    }

    fgets(ch, sizeof(ch), fp);
    sscanf(ch, "lv: %d", &nLv);
    fgets(ch, sizeof(ch), fp);
    sscanf(ch, "en: %d", &enN);
    fclose(fp);
}

void fightSmiley(chara *hero, int ind, int enN){
<commit_msg>removed the & pointer marking because it was turning a pointer into a pointer's pointer<commit_after>#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <time.h>
#include <math.h>
#include <string.h>
#include "libs/arrkeys.h"
#include "libs/characters.h"
#include "libs/map_utils.h"

void loadLv(int *nLv, int *enN);
void fightSmiley(chara *hero, int ind, int enN);

int main (){

    srand(time(0));

    int ch;
    int ind = 0;
    int lvs = 2;
    int enN = 3;

    loadLv(&lvs, &enN);

    int map_size = MAX*MAX;

    pos you_are_here, map_positions[map_size];
    pos goal;
    chara hero;

    hero.hp = 30;
    hero.st = 10;
    hero.sp = 20;
    hero.def = 7;
    hero.xp = 0;

    system("mode con:cols=80 lines=31");

    for(ind=0;ind<map_size;ind++){
        map_positions[ind].x=-1;
        map_positions[ind].y=-1;
    }

    ind =1;

    loadMap(&you_are_here, map_positions, &goal, ind);

    ch=0;

    mapi(you_are_here, map_positions, goal, map_size, hero);

    while ((ch = getch()) != 27){  /* 27 = Esc key */
        if (ch == 0 || ch == 224){

            switch (_getch ()){

                case 72:
                    if(!checkli(you_are_here.x, you_are_here.y-1, map_positions, map_size)){
                        if(you_are_here.y > 0){
                            you_are_here.y -= 1;
                        }
                        else if(!checkli(you_are_here.x, MAX-1, map_positions, map_size)){
                            you_are_here.y = MAX-1;
                        }
                    }
                    break;

                case 77:
                    if(!checkli(((you_are_here.x+1)%MAX), you_are_here.y, map_positions, map_size)){
                        you_are_here.x = (you_are_here.x+1)%MAX;
                    }
                    break;
                case 75:
                    if(!checkli(you_are_here.x-1, you_are_here.y, map_positions, map_size)){
                        if(you_are_here.x > 0){
                            you_are_here.x -= 1;
                        }
                        else if(!checkli(MAX-1, you_are_here.y, map_positions, map_size)){
                            you_are_here.x = MAX-1;
                        }
                    }
                    break;
                case 80:
                    if(!checkli(you_are_here.x, (you_are_here.y+1)%MAX, map_positions, map_size)){
                        you_are_here.y = (you_are_here.y+1)%MAX;
                    }
                    break;
            }

            system("cls");

            if(rand()%15==1){
                fightSmiley(&hero, ind, enN);
            }

            system("cls");

            mapi(you_are_here, map_positions, goal, map_size, hero);
        }
        if (you_are_here.x==goal.x&& you_are_here.y==goal.y){

            char lv[16];
            int pp=0;

            if (ind<lvs){
                ind++;
                loadMap(&you_are_here, map_positions, &goal, ind);
                system("cls");

                sprintf(lv, "L E V E L   %d", ind);

                int pp=0;

                for(pp=0;lv[pp]!='\0';pp++){
                    printf("%c", lv[pp]);
                    Sleep(100);
                }

            }
            else{
                system("cls");
                printf("\n\n\n\n\n\n\n\n\n");

                char end[107] = "congratulations you've escaped the castle of death \n and survived the evil smiley horde\n\n\n T H E   E N D";

                for(pp=0;end[pp] != '\0';pp++){
                    printf("%c", end[pp]);
                    Sleep(100);
                }

                printf("\n\n");
                system("pause");

                exit(0);

            }
        }
    }

    printf("ESC %d\n", ch);
    return (0);
}


void loadLv(int *nLv, int *enN){

    char ch[7];
    char file_name[25] = "settings.txt";
    FILE *fp;

    fp = fopen(file_name, "r"); // read mode

    if( fp == NULL )
    {
        perror("Error while opening the level file.\n");
        system("pause");
        exit(EXIT_FAILURE);
    }

    fgets(ch, sizeof(ch), fp);
    sscanf(ch, "lv: %d", nLv);
    fgets(ch, sizeof(ch), fp);
    sscanf(ch, "en: %d", enN);
    fclose(fp);

}

void fightSmiley(chara *hero, int ind, int enN){

{'fraction_non_alphanumeric': 0.14223580580698247, 'fraction_numerical': 0.017867638415422594, 'mean_word_length': 1.3119565217391305, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2517106', 'n_tokens_mistral': 3065, 'n_tokens_neox': 2769, 'n_words': 573}