Merge branch 'master' of https://codefirst.iut.uca.fr/git/Crypteam/Cryptid into ConnexionAPI
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 254 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 12 KiB |
@ -0,0 +1,95 @@
|
||||
import PersonNetwork from "../model/PersonsNetwork";
|
||||
import Person from "../model/Person";
|
||||
import GenerateNetwork from "../model/NetworkGenerator";
|
||||
import NetworkGenerator from "../model/NetworkGenerator";
|
||||
|
||||
import fs from 'fs';
|
||||
import Stub from "../model/Stub";
|
||||
import GameCreator from "../model/GameCreator";
|
||||
import Indice from "../model/Indices/Indice";
|
||||
import { ColorToString, SportToString } from "../model/EnumExtender";
|
||||
import GraphCreator from "../model/Graph/GraphCreator";
|
||||
import { DataSet, Network } from "vis-network";
|
||||
|
||||
function generateLatexCode(personsNet : PersonNetwork, choosenPerson : Person, choosenIndices : Indice[], network: Network): string {
|
||||
let latexCode = "";
|
||||
|
||||
|
||||
//*Setup
|
||||
latexCode += "\\documentclass[11pt]{article}\n"
|
||||
latexCode += "\\usepackage{fullpage}\n"
|
||||
latexCode += "\\usepackage{times}\n"
|
||||
latexCode += "\\usepackage{tikz}\n"
|
||||
latexCode += "\\usepackage{paralist}\n"
|
||||
latexCode += "\\usepackage{geometry}\n"
|
||||
|
||||
latexCode += "\\usetikzlibrary {shapes.multipart}\n"
|
||||
latexCode += "\\geometry{margin=0.5cm}\n"
|
||||
latexCode += "\\newcommand{\\Basketball}{\\includegraphics[width=.5cm]{ballon-de-basket.png}}\n"
|
||||
latexCode += "\\newcommand{\\Football}{\\includegraphics[width=.4cm]{ballon-de-foot.png}}\n"
|
||||
latexCode += "\\newcommand{\\Bowling}{\\includegraphics[width=.5cm]{bowling.png}}\n"
|
||||
latexCode += "\\newcommand{\\Baseball}{\\includegraphics[width=.5cm]{baseball.png}}\n"
|
||||
latexCode += "\\newcommand{\\Tennis}{\\includegraphics[width=.5cm]{tennis.png}}\n"
|
||||
|
||||
|
||||
//** Header
|
||||
latexCode+= "\\begin{document}\n"
|
||||
latexCode+= "\\thispagestyle{empty}\n"
|
||||
latexCode+= "Voici le graphe de SocialGraphe\n"
|
||||
latexCode+= "\\begin{center}\n"
|
||||
latexCode+= "\\begin{tikzpicture}[scale=.17]\n"
|
||||
|
||||
|
||||
personsNet.getPersons().forEach((person, index) => {
|
||||
|
||||
var nodesData = network.getPositions();
|
||||
// Obtenir les coordonnées du nœud
|
||||
const nodeId = person.getId().toString();
|
||||
const position = nodesData[nodeId];
|
||||
if (position) {
|
||||
const x = (position.x / 9).toFixed(2); // Arrondir à 2 décimales
|
||||
const y = (position.y / 9).toFixed(2);
|
||||
|
||||
latexCode += ` \\node[draw, circle split, align=center] (${person.getId()}) at (${x},${y}) { ${person.getName()} \\\\ ${person.getAge()} \\nodepart{lower}`;
|
||||
latexCode += `${ColorToString(person.getColor(), "fr")} \\\\`
|
||||
person.getSports().forEach((sport) => { latexCode += ` \\${SportToString(sport, 'fr')}{}` });
|
||||
latexCode += "};\n";
|
||||
} else {
|
||||
console.error(`Les coordonnées du nœud ${nodeId} ne sont pas disponibles.`);
|
||||
}
|
||||
});
|
||||
|
||||
personsNet.getPersons().forEach((person) => {
|
||||
person.getFriends().forEach((friend) => {
|
||||
latexCode += ` \\draw (${person.getId()}) -- (${friend.getId()});\n`;
|
||||
});
|
||||
console.log(person.getFriends().length);
|
||||
});
|
||||
|
||||
latexCode += "\\end{tikzpicture}\n";
|
||||
latexCode += "\\end{center}\n";
|
||||
|
||||
//* Zone d'énoncé :
|
||||
|
||||
latexCode += "\n\n\\paragraph{Première énigme}\n"
|
||||
|
||||
|
||||
latexCode += "Trouver qui est le coupable avec les indices suivants.\n"
|
||||
latexCode += "\\begin{compactitem}\n"
|
||||
|
||||
|
||||
choosenIndices.forEach((indice, index) => {
|
||||
|
||||
latexCode += `\\item Indice ${index + 1} : ${indice.ToString('fr')}.\n`
|
||||
})
|
||||
latexCode += "\\end{compactitem}\n"
|
||||
|
||||
//* Solution
|
||||
latexCode += "% Solution : " + choosenPerson.getName() + "\n";
|
||||
|
||||
latexCode += "\\end{document}\n"
|
||||
|
||||
return latexCode
|
||||
}
|
||||
|
||||
export default generateLatexCode
|
@ -1,6 +1,6 @@
|
||||
import { io } from "socket.io-client";
|
||||
|
||||
|
||||
const socket = io("http://172.20.10.4:3002");
|
||||
const socket = io("http://localhost:3002");
|
||||
|
||||
export {socket}
|
@ -0,0 +1,11 @@
|
||||
class NodeColor{
|
||||
public background: string
|
||||
public border: string
|
||||
|
||||
constructor(color: string, border: string){
|
||||
this.background=color
|
||||
this.border=border
|
||||
}
|
||||
}
|
||||
|
||||
export default NodeColor
|
After Width: | Height: | Size: 386 B |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,3 @@
|
||||
\relax
|
||||
\@writefile{toc}{\contentsline {paragraph}{Première énigme}{2}{}\protected@file@percent }
|
||||
\gdef \@abspage@last{2}
|
@ -0,0 +1,132 @@
|
||||
\documentclass[11pt]{article}
|
||||
\usepackage{fullpage}
|
||||
\usepackage{times}
|
||||
\usepackage{tikz}
|
||||
\usepackage{paralist}
|
||||
\usetikzlibrary {shapes.multipart}
|
||||
\newcommand{\Basketball}{\includegraphics[width=.5cm]{ballon-de-basket.png}}
|
||||
\newcommand{\Football}{\includegraphics[width=.4cm]{ballon-de-foot.png}}
|
||||
\newcommand{\Bowling}{\includegraphics[width=.5cm]{bowling.png}}
|
||||
\newcommand{\Baseball}{\includegraphics[width=.5cm]{baseball.png}}
|
||||
\newcommand{\Tennis}{\includegraphics[width=.5cm]{tennis.png}}
|
||||
\begin{document}
|
||||
\thispagestyle{empty}
|
||||
Voici le graphe de SocialGraphe
|
||||
\begin{center}
|
||||
\begin{tikzpicture}[scale=.9]
|
||||
\node[draw, circle split] (0) at (0,0) { Alexander \nodepart{lower} \Football{} \Bowling{}};
|
||||
\node[draw, circle split] (1) at (4,0) { Wyatt \nodepart{lower} \Baseball{} \Tennis{}};
|
||||
\node[draw, circle split] (2) at (8,0) { Mia \nodepart{lower} \Basketball{}};
|
||||
\node[draw, circle split] (3) at (12,0) { William \nodepart{lower} \Baseball{} \Football{}};
|
||||
\node[draw, circle split] (4) at (16,0) { Zoey \nodepart{lower} \Basketball{} \Bowling{} \Tennis{}};
|
||||
\node[draw, circle split] (5) at (0,4) { Isabella \nodepart{lower} \Tennis{}};
|
||||
\node[draw, circle split] (6) at (4,4) { Abigail \nodepart{lower} \Baseball{}};
|
||||
\node[draw, circle split] (7) at (8,4) { Savannah \nodepart{lower} \Bowling{} \Basketball{} \Football{}};
|
||||
\node[draw, circle split] (8) at (12,4) { Peyton \nodepart{lower} \Football{}};
|
||||
\node[draw, circle split] (9) at (16,4) { Alice \nodepart{lower} \Tennis{} \Baseball{}};
|
||||
\node[draw, circle split] (10) at (0,8) { Sophia \nodepart{lower} \Bowling{} \Basketball{} \Bowling{}};
|
||||
\node[draw, circle split] (11) at (4,8) { Layla \nodepart{lower} \Tennis{} \Baseball{} \Football{}};
|
||||
\node[draw, circle split] (12) at (8,8) { Ava \nodepart{lower} \Basketball{}};
|
||||
\node[draw, circle split] (13) at (12,8) { Harper \nodepart{lower} \Bowling{}};
|
||||
\node[draw, circle split] (14) at (16,8) { Sebastian \nodepart{lower} \Tennis{} \Basketball{} \Baseball{}};
|
||||
\node[draw, circle split] (15) at (0,12) { Michael \nodepart{lower} \Football{}};
|
||||
\node[draw, circle split] (16) at (4,12) { Natalie \nodepart{lower} \Bowling{} \Football{} \Baseball{}};
|
||||
\node[draw, circle split] (17) at (8,12) { Penelope \nodepart{lower} \Basketball{}};
|
||||
\node[draw, circle split] (18) at (12,12) { Lily \nodepart{lower} \Tennis{} \Tennis{}};
|
||||
\node[draw, circle split] (19) at (16,12) { Eleanor \nodepart{lower} \Football{}};
|
||||
\node[draw, circle split] (20) at (0,16) { Henry \nodepart{lower} \Bowling{} \Basketball{}};
|
||||
\node[draw, circle split] (21) at (4,16) { Claire \nodepart{lower} \Baseball{} \Basketball{}};
|
||||
\node[draw, circle split] (22) at (8,16) { Caleb \nodepart{lower} \Baseball{}};
|
||||
\node[draw, circle split] (23) at (12,16) { Charlotte \nodepart{lower} \Bowling{} \Football{} \Tennis{}};
|
||||
\node[draw, circle split] (24) at (16,16) { Luke \nodepart{lower} \Football{}};
|
||||
\node[draw, circle split] (25) at (0,20) { Connor \nodepart{lower} \Baseball{} \Tennis{}};
|
||||
\node[draw, circle split] (26) at (4,20) { Aiden \nodepart{lower} \Basketball{} \Bowling{} \Tennis{}};
|
||||
\node[draw, circle split] (27) at (8,20) { Aurora \nodepart{lower} \Football{}};
|
||||
\node[draw, circle split] (28) at (12,20) { Nathan \nodepart{lower} \Bowling{} \Baseball{}};
|
||||
\node[draw, circle split] (29) at (16,20) { Aurora \nodepart{lower} \Basketball{}};
|
||||
\draw (0) -- (11);
|
||||
\draw (0) -- (13);
|
||||
\draw (0) -- (18);
|
||||
\draw (1) -- (13);
|
||||
\draw (1) -- (24);
|
||||
\draw (2) -- (22);
|
||||
\draw (2) -- (16);
|
||||
\draw (2) -- (9);
|
||||
\draw (2) -- (6);
|
||||
\draw (3) -- (4);
|
||||
\draw (3) -- (20);
|
||||
\draw (4) -- (28);
|
||||
\draw (4) -- (3);
|
||||
\draw (5) -- (17);
|
||||
\draw (5) -- (15);
|
||||
\draw (5) -- (24);
|
||||
\draw (6) -- (2);
|
||||
\draw (7) -- (17);
|
||||
\draw (7) -- (24);
|
||||
\draw (7) -- (22);
|
||||
\draw (7) -- (11);
|
||||
\draw (8) -- (25);
|
||||
\draw (8) -- (21);
|
||||
\draw (8) -- (24);
|
||||
\draw (8) -- (11);
|
||||
\draw (9) -- (2);
|
||||
\draw (10) -- (25);
|
||||
\draw (10) -- (26);
|
||||
\draw (10) -- (27);
|
||||
\draw (11) -- (0);
|
||||
\draw (11) -- (7);
|
||||
\draw (11) -- (8);
|
||||
\draw (12) -- (20);
|
||||
\draw (12) -- (27);
|
||||
\draw (13) -- (0);
|
||||
\draw (13) -- (1);
|
||||
\draw (14) -- (15);
|
||||
\draw (15) -- (5);
|
||||
\draw (15) -- (14);
|
||||
\draw (15) -- (20);
|
||||
\draw (15) -- (17);
|
||||
\draw (16) -- (2);
|
||||
\draw (16) -- (26);
|
||||
\draw (17) -- (5);
|
||||
\draw (17) -- (7);
|
||||
\draw (17) -- (15);
|
||||
\draw (17) -- (20);
|
||||
\draw (18) -- (0);
|
||||
\draw (19) -- (23);
|
||||
\draw (20) -- (3);
|
||||
\draw (20) -- (12);
|
||||
\draw (20) -- (15);
|
||||
\draw (20) -- (17);
|
||||
\draw (21) -- (8);
|
||||
\draw (22) -- (2);
|
||||
\draw (22) -- (7);
|
||||
\draw (22) -- (23);
|
||||
\draw (23) -- (19);
|
||||
\draw (23) -- (22);
|
||||
\draw (24) -- (1);
|
||||
\draw (24) -- (5);
|
||||
\draw (24) -- (7);
|
||||
\draw (24) -- (8);
|
||||
\draw (25) -- (8);
|
||||
\draw (25) -- (10);
|
||||
\draw (26) -- (10);
|
||||
\draw (26) -- (16);
|
||||
\draw (26) -- (29);
|
||||
\draw (27) -- (10);
|
||||
\draw (27) -- (12);
|
||||
\draw (28) -- (4);
|
||||
\draw (29) -- (26);
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
||||
|
||||
|
||||
\paragraph{Première énigme}
|
||||
Trouver qui est le coupable avec les indices suivants.
|
||||
\begin{compactitem}
|
||||
\item Indice 1 : Le suspect pratique au moins du Baseball et/ou du Basketball .
|
||||
\item Indice 2 : Le suspect pratique 2 ou 1 sport(s).
|
||||
\item Indice 3 : Le suspect a les cheveux Roux ou Blond .
|
||||
\item Indice 4 : Le suspect a au moins un ami avec les cheveux Roux .
|
||||
\end{compactitem}
|
||||
% Solution : Nathan
|
||||
\end{document}
|
After Width: | Height: | Size: 25 KiB |