diff --git a/FondamentauxTP1TicTacToe.drawio.png b/FondamentauxTP1TicTacToe.drawio.png
new file mode 100644
index 0000000..abfdee1
Binary files /dev/null and b/FondamentauxTP1TicTacToe.drawio.png differ
diff --git a/TTT_java/.idea/.gitignore b/TTT_java/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/TTT_java/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/TTT_java/.idea/misc.xml b/TTT_java/.idea/misc.xml
new file mode 100644
index 0000000..07115cd
--- /dev/null
+++ b/TTT_java/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TTT_java/.idea/modules.xml b/TTT_java/.idea/modules.xml
new file mode 100644
index 0000000..a1b57e5
--- /dev/null
+++ b/TTT_java/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TTT_java/.idea/vcs.xml b/TTT_java/.idea/vcs.xml
new file mode 100644
index 0000000..6c0b863
--- /dev/null
+++ b/TTT_java/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TTT_java/AIPlayer.java b/TTT_java/AIPlayer.java
new file mode 100644
index 0000000..cac16a2
--- /dev/null
+++ b/TTT_java/AIPlayer.java
@@ -0,0 +1,19 @@
+import java.util.Random;
+
+public class AIPlayer extends Player {
+ private Random random;
+
+ public AIPlayer(char mark) {
+ super(mark);
+ random = new Random();
+ }
+
+ public void makeMove(Board board) {
+ int row, col;
+ do {
+ row = random.nextInt(3);
+ col = random.nextInt(3);
+ } while (!board.isCellEmpty(row, col));
+ board.placeMark(row, col, getMark());
+ }
+}
\ No newline at end of file
diff --git a/TTT_java/Board.java b/TTT_java/Board.java
new file mode 100644
index 0000000..69a735f
--- /dev/null
+++ b/TTT_java/Board.java
@@ -0,0 +1,64 @@
+public class Board {
+ private char[][] grid;
+ private static final int SIZE = 3;
+
+ public Board() {
+ grid = new char[SIZE][SIZE];
+ for (int i = 0; i < SIZE; i++) {
+ for (int j = 0; j < SIZE; j++) {
+ grid[i][j] = '-';
+ }
+ }
+ }
+
+ public void printBoard() {
+ for (int i = 0; i < SIZE; i++) {
+ for (int j = 0; j < SIZE; j++) { //IL FAUT METTRE I ET J INFERIEUR!!! SINON PAS D'AFFICHAGE!!!
+ System.out.print(grid[i][j] + " ");
+ }
+ System.out.println();
+ }
+ }
+
+ public boolean isCellEmpty(int row, int col) {
+ return grid[row][col] == '-';
+ }
+
+ public void placeMark(int row, int col, char mark) {
+ grid[row][col] = mark;
+ }
+
+ public boolean hasWon(char mark) {
+ // Vérifie les lignes
+ for (int i = 0; i < SIZE; i++) {
+ if (grid[i][0] == mark && grid[i][1] == mark && grid[i][2] == mark) {
+ return true;
+ }
+ }
+ // Vérifie les colonnes
+ for (int j = 0; j < SIZE; j++) {
+ if (grid[0][j] == mark && grid[1][j] == mark && grid[2][j] == mark) {
+ return true;
+ }
+ }
+ // Vérifie les diagonales
+ if (grid[0][0] == mark && grid[1][1] == mark && grid[2][2] == mark) {
+ return true;
+ }
+ if (grid[0][2] == mark && grid[1][1] == mark && grid[2][0] == mark) {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean isFull() {
+ for (int i = 0; i < SIZE; i++) {
+ for (int j = 0; j < SIZE; j++) {
+ if (grid[i][j] == '-') {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+}
diff --git a/TTT_java/Game.java b/TTT_java/Game.java
new file mode 100644
index 0000000..2b5350a
--- /dev/null
+++ b/TTT_java/Game.java
@@ -0,0 +1,60 @@
+import java.util.Scanner;
+
+public class Game {
+ private Board board;
+ private Player human;
+ private Player ai= new AIPlayer('O');
+ private Scanner scanner;
+
+ public Game() {
+ board = new Board(); // ATTENTION IL FALLAIT INITIALISER LE BOARD!!!! sinon erreur exit code 1
+ human = new Player('X');
+ scanner = new Scanner(System.in);
+ }
+
+ public void start() {
+ System.out.println("Bienvenue dans Tic-Tac-Toe !");
+ board.printBoard();
+
+ while (true) {
+ humanTurn();
+ if (isGameOver(human)) break;
+
+ aiTurn();
+ if (isGameOver(ai)) break;
+ }
+ }
+
+ private void humanTurn() {
+ System.out.println("Votre tour ! Entrez la ligne et la colonne (ex: 2 2 pour le centre) :"); //ATTENTION !! LE MILIEU C'EST 2 2 PAS 1 1 !!
+ int row, col;
+ while (true) {
+ row = scanner.nextInt() - 1;
+ col = scanner.nextInt() - 1;
+ if (board.isCellEmpty(row, col)) {
+ board.placeMark(row, col, human.getMark());
+ board.printBoard();
+ break;
+ } else {
+ System.out.println("Cette case est déjà prise. Essayez à nouveau.");
+ }
+ }
+ }
+
+ private void aiTurn() {
+ System.out.println("Tour de l'IA...");
+ ((AIPlayer) ai).makeMove(board);
+ board.printBoard();
+ }
+
+ private boolean isGameOver(Player player) {
+ if (board.hasWon(player.getMark())) {
+ System.out.println("Le joueur " + player.getMark() + " a gagné !"); //PRENDRE LA MARK DU PLAYER!!! SINON AFFICHE TOUJOURS VICTOIRE IA!!
+ return true;
+ } else if (board.isFull()) {
+ System.out.println("Égalité ! La grille est pleine.");
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/TTT_java/Player.java b/TTT_java/Player.java
new file mode 100644
index 0000000..00f467b
--- /dev/null
+++ b/TTT_java/Player.java
@@ -0,0 +1,11 @@
+public class Player {
+ private char mark;
+
+ public Player(char mark) {
+ this.mark = mark;
+ }
+
+ public char getMark() {
+ return mark;
+ }
+}
diff --git a/TTT_java/TTT_java.iml b/TTT_java/TTT_java.iml
new file mode 100644
index 0000000..b107a2d
--- /dev/null
+++ b/TTT_java/TTT_java.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TTT_java/TicTacToeGame.java b/TTT_java/TicTacToeGame.java
new file mode 100644
index 0000000..e0240c5
--- /dev/null
+++ b/TTT_java/TicTacToeGame.java
@@ -0,0 +1,6 @@
+public class TicTacToeGame {
+ public static void main(String[] args) {
+ Game game = new Game();
+ game.start();
+ }
+}
diff --git a/TTT_java/out/production/TTT_java/.idea/.gitignore b/TTT_java/out/production/TTT_java/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/TTT_java/out/production/TTT_java/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/TTT_java/out/production/TTT_java/.idea/misc.xml b/TTT_java/out/production/TTT_java/.idea/misc.xml
new file mode 100644
index 0000000..07115cd
--- /dev/null
+++ b/TTT_java/out/production/TTT_java/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TTT_java/out/production/TTT_java/.idea/modules.xml b/TTT_java/out/production/TTT_java/.idea/modules.xml
new file mode 100644
index 0000000..a1b57e5
--- /dev/null
+++ b/TTT_java/out/production/TTT_java/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TTT_java/out/production/TTT_java/.idea/vcs.xml b/TTT_java/out/production/TTT_java/.idea/vcs.xml
new file mode 100644
index 0000000..6c0b863
--- /dev/null
+++ b/TTT_java/out/production/TTT_java/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TTT_java/out/production/TTT_java/AIPlayer.class b/TTT_java/out/production/TTT_java/AIPlayer.class
new file mode 100644
index 0000000..bcb4b2f
Binary files /dev/null and b/TTT_java/out/production/TTT_java/AIPlayer.class differ
diff --git a/TTT_java/out/production/TTT_java/Board.class b/TTT_java/out/production/TTT_java/Board.class
new file mode 100644
index 0000000..e179661
Binary files /dev/null and b/TTT_java/out/production/TTT_java/Board.class differ
diff --git a/TTT_java/out/production/TTT_java/Game.class b/TTT_java/out/production/TTT_java/Game.class
new file mode 100644
index 0000000..a34f2c8
Binary files /dev/null and b/TTT_java/out/production/TTT_java/Game.class differ
diff --git a/TTT_java/out/production/TTT_java/Player.class b/TTT_java/out/production/TTT_java/Player.class
new file mode 100644
index 0000000..09b948b
Binary files /dev/null and b/TTT_java/out/production/TTT_java/Player.class differ
diff --git a/TTT_java/out/production/TTT_java/TTT_java.iml b/TTT_java/out/production/TTT_java/TTT_java.iml
new file mode 100644
index 0000000..b107a2d
--- /dev/null
+++ b/TTT_java/out/production/TTT_java/TTT_java.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TTT_java/out/production/TTT_java/TicTacToeGame.class b/TTT_java/out/production/TTT_java/TicTacToeGame.class
new file mode 100644
index 0000000..5b12952
Binary files /dev/null and b/TTT_java/out/production/TTT_java/TicTacToeGame.class differ
diff --git a/pendu/.vscode/c_cpp_properties.json b/pendu/.vscode/c_cpp_properties.json
new file mode 100644
index 0000000..cea4d3f
--- /dev/null
+++ b/pendu/.vscode/c_cpp_properties.json
@@ -0,0 +1,18 @@
+{
+ "configurations": [
+ {
+ "name": "windows-gcc-x64",
+ "includePath": [
+ "${workspaceFolder}/**"
+ ],
+ "compilerPath": "gcc",
+ "cStandard": "${default}",
+ "cppStandard": "${default}",
+ "intelliSenseMode": "windows-gcc-x64",
+ "compilerArgs": [
+ ""
+ ]
+ }
+ ],
+ "version": 4
+}
\ No newline at end of file
diff --git a/pendu/.vscode/launch.json b/pendu/.vscode/launch.json
new file mode 100644
index 0000000..10d8f83
--- /dev/null
+++ b/pendu/.vscode/launch.json
@@ -0,0 +1,24 @@
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "C/C++ Runner: Debug Session",
+ "type": "cppdbg",
+ "request": "launch",
+ "args": [],
+ "stopAtEntry": false,
+ "externalConsole": true,
+ "cwd": "c:/Users/kennr/Downloads/pendu",
+ "program": "c:/Users/kennr/Downloads/pendu/build/Debug/outDebug",
+ "MIMode": "gdb",
+ "miDebuggerPath": "gdb",
+ "setupCommands": [
+ {
+ "description": "Enable pretty-printing for gdb",
+ "text": "-enable-pretty-printing",
+ "ignoreFailures": true
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/pendu/.vscode/settings.json b/pendu/.vscode/settings.json
new file mode 100644
index 0000000..c9e66f1
--- /dev/null
+++ b/pendu/.vscode/settings.json
@@ -0,0 +1,59 @@
+{
+ "C_Cpp_Runner.cCompilerPath": "gcc",
+ "C_Cpp_Runner.cppCompilerPath": "g++",
+ "C_Cpp_Runner.debuggerPath": "gdb",
+ "C_Cpp_Runner.cStandard": "",
+ "C_Cpp_Runner.cppStandard": "",
+ "C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvarsall.bat",
+ "C_Cpp_Runner.useMsvc": false,
+ "C_Cpp_Runner.warnings": [
+ "-Wall",
+ "-Wextra",
+ "-Wpedantic",
+ "-Wshadow",
+ "-Wformat=2",
+ "-Wcast-align",
+ "-Wconversion",
+ "-Wsign-conversion",
+ "-Wnull-dereference"
+ ],
+ "C_Cpp_Runner.msvcWarnings": [
+ "/W4",
+ "/permissive-",
+ "/w14242",
+ "/w14287",
+ "/w14296",
+ "/w14311",
+ "/w14826",
+ "/w44062",
+ "/w44242",
+ "/w14905",
+ "/w14906",
+ "/w14263",
+ "/w44265",
+ "/w14928"
+ ],
+ "C_Cpp_Runner.enableWarnings": true,
+ "C_Cpp_Runner.warningsAsError": false,
+ "C_Cpp_Runner.compilerArgs": [],
+ "C_Cpp_Runner.linkerArgs": [],
+ "C_Cpp_Runner.includePaths": [],
+ "C_Cpp_Runner.includeSearch": [
+ "*",
+ "**/*"
+ ],
+ "C_Cpp_Runner.excludeSearch": [
+ "**/build",
+ "**/build/**",
+ "**/.*",
+ "**/.*/**",
+ "**/.vscode",
+ "**/.vscode/**"
+ ],
+ "C_Cpp_Runner.useAddressSanitizer": false,
+ "C_Cpp_Runner.useUndefinedSanitizer": false,
+ "C_Cpp_Runner.useLeakSanitizer": false,
+ "C_Cpp_Runner.showCompilationTime": false,
+ "C_Cpp_Runner.useLinkTimeOptimization": false,
+ "C_Cpp_Runner.msvcSecureNoWarnings": false
+}
\ No newline at end of file
diff --git a/pendu/pendu_pbs.cpp b/pendu/pendu_pbs.cpp
new file mode 100644
index 0000000..c6338fe
--- /dev/null
+++ b/pendu/pendu_pbs.cpp
@@ -0,0 +1,84 @@
+// Code original généré par ChatGPT - nov 2024
+// Prompt : "Ecris moi un programme en C++ pour un jeu de pendu."
+// Modifications apportées : ajouts de bugs et d'erreurs de styles...
+
+
+#include
+#include
+#include
+#include
+#include
+
+using namespace std;
+
+// Fonction pour afficher l'état actuel du mot deviné
+void afficherMot(const string& mot, const vector& lettresDevinees) {
+ for (size_t i = 0; i <= mot.size(); i++) { // !!! Ne pas inclure "<=" mot size dans la taille de la boucle, crash lors de l'affichage du mot
+ if (lettresDevinees[i]) {
+ cout << mot[i] << " ";
+ }
+ else {
+ cout << "_ ";
+ }
+ }
+ cout << endl;
+}
+
+// Fonction pour vérifier si le joueur a deviné tout le mot
+bool motDevine(const vector& lettresDevinees) {
+ for (bool devinee : lettresDevinees) {
+ if (!devinee) return false;
+ }
+ return true;
+}
+
+int main() {
+ // Liste de mots pour le jeu
+ vector words = { "ordinateur", "programmation", "developpeur", "algorithme", "variable" };
+
+ // Initialiser le générateur de nombres aléatoires
+ srand(static_cast(((time(0))))); // !!! Manque de deux parenthèses, échec lors de l'éxecution
+
+ // Choisir un mot aléatoire dans la liste
+ string Mot = words[rand() % words.size()];
+
+ vector lettresDevinees(Mot.size(), false);
+ int essaisRestants = 6; // Nombre maximum de tentatives
+
+ cout << "Bienvenue au jeu du pendu !" << endl;
+
+ while (essaisRestants > 0 && !motDevine(lettresDevinees)) {
+ cout << "\nEssais restants: " << essaisRestants << endl;
+ afficherMot(Mot, lettresDevinees);
+
+ cout << "Entrez une lettre : ";
+ char lettre;
+ cin >> lettre;
+
+ bool lettreTrouvee = false;
+ for (int i = 0; i < Mot.size(); ++i){
+ if (Mot[i] == lettre) // !!! deux = pour comparer et pas instancier, crash lors de comparaison
+ {
+ lettresDevinees[i] = true;
+ lettreTrouvee = true;
+ }
+ }
+
+ if (!lettreTrouvee) {
+ cout << "Lettre incorrecte !" << endl;
+ --essaisRestants;
+ }
+
+ if (motDevine(lettresDevinees));
+ {
+ cout << "\nFélicitations ! Vous avez deviné le mot : " << Mot << endl;
+ return 0;
+ }
+ }
+
+ if (essaisRestants == 0) {
+ cout << "\nDommage ! Vous avez perdu. Le mot était : " << Mot << endl;
+ }
+
+ return 0;
+}
diff --git a/testTags b/testTags
new file mode 160000
index 0000000..6a50b09
--- /dev/null
+++ b/testTags
@@ -0,0 +1 @@
+Subproject commit 6a50b094362908c63cfc03d6af3af83cc9876a25