-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
608dc0d
commit b233f2e
Showing
173 changed files
with
19,946 additions
and
480 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.