Skip to content

Commit

Permalink
tmp(root): transfere files
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterLaplace committed Jun 10, 2024
1 parent 608dc0d commit b233f2e
Show file tree
Hide file tree
Showing 173 changed files with 19,946 additions and 480 deletions.
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# Use an official image as a parent image
FROM ubuntu:20.04
FROM ubuntu:latest

# Set the working directory
WORKDIR /app

# Install necessary libraries and tools
RUN apt-get update && apt-get install -y gcc libcsfml-dev make
RUN apt-get update && apt-get install -y gcc python3 libsfml-dev libcsfml-dev make python3-pip libglib2.0-0

# Copy your source code to the container
COPY . .

# Compile your C project
RUN make
RUN make re

# Set the entry point for your application
CMD ["./bin/engine.out"]
CMD ["./launcher"]
# CMD ["./bin/engine.out", "Projects/New/config.xml"]
29 changes: 29 additions & 0 deletions Engine/AI/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc générer le fichier actif",
"command": "/usr/bin/gcc",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}",
"-lm"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Tâche générée par le débogueur."
}
],
"version": "2.0.0"
}
69 changes: 69 additions & 0 deletions Engine/AI/gomoku_model.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
** EPITECH PROJECT, 2023
** Engine-3D
** File description:
** gomoku_model
*/

#define MH_IMPLEMENTATION
#include "machine_learning.h"

// 8x8=64 for the input board, 2 for the output coordinates
float gomoku_model[66] = {0};

typedef unsigned char uint8_t;

uint8_t random_between_0_2(void)
{
return rand() % 3 + '0';
}

int main(void)
{
srand(time(NULL));

size_t stride = 8*8+2;
size_t n = ARRAY_SIZE(gomoku_model)/stride;
matrix_t in = {
.rows = n,
.cols = 1,
.stride = stride,
.ptr = gomoku_model
};

matrix_t out = {
.rows = n,
.cols = 2,
.stride = stride,
.ptr = (float []){gomoku_model[64], gomoku_model[65]}
};

size_t arch[] = {64, 64, 2};
neural_n_t nn = neural_link_create(arch, ARRAY_SIZE(arch));
neural_n_t gradient = neural_link_create(arch, ARRAY_SIZE(arch));
neural_link_randomize(nn, 0, 1);

size_t epochs = 100*1000;
float rate = 1;

printf("Training...\n");

printf("c = %f\n", neural_link_cost(nn, in, out));
neural_link_train(nn, gradient, in, out, epochs, rate);
printf("c = %f\n", neural_link_cost(nn, in, out));

printf("Done!\n");

printf("Saving neural network to xor.nn\n");
neural_link_save(nn, "xor.nn");

neural_link_print_result(nn, (matrix_t) {
.rows = 1,
.cols = 2,
.ptr = (float[]){0, 1}
}, 1);
neural_link_free(nn);
return EXIT_SUCCESS;
}

// Build: gcc -Wall -Wextra -Werror gomoku_model.c -o gomoku_model -lm
135 changes: 135 additions & 0 deletions Engine/AI/let.nn

Large diffs are not rendered by default.

Binary file added Engine/AI/let_ai
Binary file not shown.
Loading

0 comments on commit b233f2e

Please sign in to comment.