Commit 504de472 authored by Louane MECHOUD's avatar Louane MECHOUD
Browse files

Initial commit

parents
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-08 sam. 19:38 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Rapport</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Louane MECHOUD" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: visible;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
/*]]>*/-->
</style>
<link rel="stylesheet" type="text/css" href="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/readtheorg.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://fniessen.github.io/org-html-themes/src/lib/js/jquery.stickytableheaders.min.js"></script>
<script type="text/javascript" src="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/js/readtheorg.js"></script>
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
</head>
<body>
<div id="content">
<h1 class="title">Rapport</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org1590816">1. Shadows-of-the-knight-episode-1</a>
<ul>
<li><a href="#orgb7b3435">1.1. Fournir des solutions expliquées des puzzles</a>
<ul>
<li><a href="#orge700872">1.1.1. Code répondant aux demandes de l'exercice</a></li>
<li><a href="#orgee73999">1.1.2. Fonction 'Coordonnee'</a></li>
<li><a href="#org6d617cd">1.1.3. Fonction 'main'</a></li>
</ul>
</li>
<li><a href="#org81d4e63">1.2. Présenter les tests et leur exécution</a>
<ul>
<li><a href="#org1ce5613">1.2.1. Premier Test</a></li>
<li><a href="#orgeeb2c52">1.2.2. Deuxième Test</a></li>
</ul>
</li>
<li><a href="#org3734cd1">1.3. Présenter une solution plébiscitée de la communauté</a>
<ul>
<li><a href="#orgb92d4d6">1.3.1. Fonction 'main'</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org72779eb">2. La Bataille</a>
<ul>
<li><a href="#org7fc377c">2.1. Fournir des solutions expliquées des puzzles</a>
<ul>
<li><a href="#org4867e11">2.1.1. Structure 'Element'</a></li>
<li><a href="#org11105b9">2.1.2. Fonction 'enfiler'</a></li>
<li><a href="#org286d0e0">2.1.3. Fonction 'defiler'</a></li>
<li><a href="#org6cbdd6c">2.1.4. Fonction 'valeurTop'</a></li>
<li><a href="#orgea794fe">2.1.5. Fonction 'valeurCarte'</a></li>
<li><a href="#org29ea7a4">2.1.6. Fonction 'tailleFile'</a></li>
<li><a href="#org1572095">2.1.7. Fonction 'main'</a></li>
</ul>
</li>
<li><a href="#org8fda4d4">2.2. Présenter les tests et leur exécution</a>
<ul>
<li><a href="#org9498ed9">2.2.1. Premier Test</a></li>
<li><a href="#org55e112d">2.2.2. Deuxième Test</a></li>
</ul>
</li>
<li><a href="#org996085a">2.3. Présenter une solution plébiscitée de la communauté</a>
<ul>
<li><a href="#orgb94fab8">2.3.1. Structure 'elem'</a></li>
<li><a href="#orgec776dd">2.3.2. Fonction 'insert'</a></li>
<li><a href="#org57e4a09">2.3.3. Fonction 'main'</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#orge5c3abb">3. Configuration</a></li>
</ul>
</div>
</div>
<p>
;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-x C-f and enter text in its buffer.
</p>
<p>
Afin de retrouver mon fichier html : <a href="https://perso.isima.fr/~lomechoud/rapport.html">https://perso.isima.fr/~lomechoud/rapport.html</a>
</p>
<p>
Ainsi que la page GitLab associée à ce fichier : [[]]
</p>
<div id="outline-container-org1590816" class="outline-2">
<h2 id="org1590816"><span class="section-number-2">1</span> Shadows-of-the-knight-episode-1</h2>
<div class="outline-text-2" id="text-1">
</div>
<div id="outline-container-orgb7b3435" class="outline-3">
<h3 id="orgb7b3435"><span class="section-number-3">1.1</span> Fournir des solutions expliquées des puzzles</h3>
<div class="outline-text-3" id="text-1-1">
<p>
On souhaite chercher l'emplacement des otages dans un immeuble. Pour cela on va effectuer une recherche dichotomique dans un tableau 2D représentant l'immeuble.
</p>
</div>
<div id="outline-container-orge700872" class="outline-4">
<h4 id="orge700872"><span class="section-number-4">1.1.1</span> Code répondant aux demandes de l'exercice</h4>
<div class="outline-text-4" id="text-1-1-1">
<p>
Voici ma solution pour l'algorithme de Shadows-of-the-knight-episode-1, remplie avec des valeurs afin de vérifier son bon fonctionnement :
</p>
<div class="org-src-container">
<pre class="src src-C"><span style="color: #e5786d;"> #include</span> <span style="color: #95e454;">"stdlib.h"</span>
<span style="color: #e5786d;"> #include</span> <span style="color: #95e454;">"stdio.h"</span>
<span style="color: #e5786d;"> #include</span> <span style="color: #95e454;">"string.h"</span>
<span style="color: #e5786d;"> #include</span> <span style="color: #95e454;">"stdbool.h"</span>
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">Coordonnee</span>(<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">lim</span>, <span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">x</span>) {
<span style="color: #8ac6f2; font-weight: bold;">if</span> ((lim+x)%2==1) {
x=(lim+x)/2+1;
}
<span style="color: #8ac6f2; font-weight: bold;">else</span> {
x=(lim+x)/2;
}
<span style="color: #8ac6f2; font-weight: bold;">return</span> x;
}
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">main</span>()
{
<span style="color: #99968b;">// </span><span style="color: #99968b;">width of the building.</span>
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">W</span>=5;
<span style="color: #99968b;">// </span><span style="color: #99968b;">height of the building.</span>
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">H</span>=8;
<span style="color: #99968b;">// </span><span style="color: #99968b;">maximum number of turns before game over.</span>
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">N</span>=40;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">X0</span>=0;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">Y0</span>=0;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">LimB</span>=H-1;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">LimH</span>=0;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">LimG</span>=0;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">LimD</span>=W-1;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">compteur</span>=0;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">Xbombe</span>=3;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">Ybombe</span>=4;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">i</span>=0;
<span style="color: #99968b;">// </span><span style="color: #99968b;">game loop</span>
<span style="color: #8ac6f2; font-weight: bold;">while</span> (i&lt;N) {
<span style="color: #99968b;">// </span><span style="color: #99968b;">the direction of the bombs from batman's current location (U, UR, R, DR, D, DL, L or UL)</span>
<span style="color: #92a65e; font-weight: bold;">char</span> <span style="color: #cae682;">bomb_dir</span>[4];
<span style="color: #8ac6f2; font-weight: bold;">if</span> (X0&lt;Xbombe)
{
bomb_dir[0]=<span style="color: #95e454;">'D'</span>;
compteur++;
}
<span style="color: #8ac6f2; font-weight: bold;">else</span> <span style="color: #8ac6f2; font-weight: bold;">if</span> (X0&gt;Xbombe)
{
bomb_dir[0]=<span style="color: #95e454;">'U'</span>;
compteur++;
}
<span style="color: #8ac6f2; font-weight: bold;">if</span> (Y0&lt;Ybombe)
{
<span style="color: #8ac6f2; font-weight: bold;">if</span> (compteur!=0) {
bomb_dir[1]=<span style="color: #95e454;">'R'</span>;
}
<span style="color: #8ac6f2; font-weight: bold;">else</span> {
bomb_dir[0]=<span style="color: #95e454;">'R'</span>;
}
}
<span style="color: #8ac6f2; font-weight: bold;">else</span> <span style="color: #8ac6f2; font-weight: bold;">if</span> (Y0&gt;Ybombe)
{
<span style="color: #8ac6f2; font-weight: bold;">if</span> (compteur!=0) {
bomb_dir[1]=<span style="color: #95e454;">'L'</span>;
}
<span style="color: #8ac6f2; font-weight: bold;">else</span> {
bomb_dir[0]=<span style="color: #95e454;">'L'</span>;
}
}
<span style="color: #8ac6f2; font-weight: bold;">for</span> (<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">i</span>=0; i&lt;2; i++) {
<span style="color: #8ac6f2; font-weight: bold;">switch</span>(bomb_dir[i]){
<span style="color: #8ac6f2; font-weight: bold;">case</span> <span style="color: #95e454;">'U'</span> :
LimB=Y0;
Y0=(LimH+Y0)/2;
<span style="color: #8ac6f2; font-weight: bold;">break</span>;
<span style="color: #8ac6f2; font-weight: bold;">case</span> <span style="color: #95e454;">'R'</span> :
LimG=X0;
X0=Coordonnee(LimD, X0);
<span style="color: #8ac6f2; font-weight: bold;">break</span>;
<span style="color: #8ac6f2; font-weight: bold;">case</span> <span style="color: #95e454;">'D'</span> :
LimH=Y0;
Y0=Coordonnee(LimB, Y0);
<span style="color: #8ac6f2; font-weight: bold;">break</span>;
<span style="color: #8ac6f2; font-weight: bold;">case</span> <span style="color: #95e454;">'L'</span> :
LimD=X0;
X0=(LimG+X0)/2;
<span style="color: #8ac6f2; font-weight: bold;">break</span>;
<span style="color: #8ac6f2; font-weight: bold;">default</span>:
<span style="color: #8ac6f2; font-weight: bold;">break</span>;
}
}
printf(<span style="color: #95e454;">"%d %d\n"</span>, X0, Y0);
i++;
}
<span style="color: #8ac6f2; font-weight: bold;">return</span> 0;
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orgee73999" class="outline-4">
<h4 id="orgee73999"><span class="section-number-4">1.1.2</span> Fonction 'Coordonnee'</h4>
<div class="outline-text-4" id="text-1-1-2">
<div class="org-src-container">
<pre class="src src-nillangnilswitchesnilflags">nilbody
</pre>
</div>
<p>
Cette fonction est simplement constituée d'un 'if'. Elle permet, en étant appelée de renvoyer la prochaine case sur laquelle va se rendre Batman
Elle prend donc en compte l'espacement sur lequel il peut se déplacer, et renvoie la case se trouvant à mi-chemin de cet espacement.
On a alors ici une recherche DICHOTOMIQUE.
</p>
</div>
</div>
<div id="outline-container-org6d617cd" class="outline-4">
<h4 id="org6d617cd"><span class="section-number-4">1.1.3</span> Fonction 'main'</h4>
<div class="outline-text-4" id="text-1-1-3">
</div>
<ol class="org-ol">
<li><a id="org9ca5391"></a>Déclaration des variables<br />
<div class="outline-text-5" id="text-1-1-3-1">
<p>
On commence ici par donner une valeur aux variables 'W' (width) et 'H' (height), qui représentent respectivement la largeur et la hauteur de l'immeuble.
Puis la valeur du maximum de tours que l'on va pouvoir effectuer avant que la bombe explose, les coordonnées de l'emplacement de Batman au départ (X0 et Y0).
J'ai crée ensuite quatre variables : LimB, LimH, LimG, et LimD. En assemblant chacune d'entre elles on se retrouve avec la délimitation de ce que l'on a besoin de parcourir dans l'immeuble.
Par exemple, si on nous donne l'indication de descendre, on peut en déduire que la bombe ne se trouvera pas au-dessus, ce qui permet de diminuer le secteur à parcourir.
</p>
</div>
</li>
<li><a id="orgbf45b7e"></a>Parcours de l'immeuble<br />
<div class="outline-text-5" id="text-1-1-3-2">
<p>
On entre à présent dans une boucle 'while', elle prend simplement la condition 'N', qui représente le nombre de tours maximum avant que la bombre n'explose.
A chaque tour, on va alors déterminer la direction vers laquelle se trouve la bombe par rapport à Batman. En effet, on va pouvoir accéder à un tableau comprenant cette direction, pouvant être d'un ou de deux caractères.
On entre dans une 'for' qui nous permet de parcourir ces deux cases. On cherche à présent la direction à l'aide de 'switch', qui nous permet de traiter chacun des cas.
En trouvant la direction, on peut ainsi délimiter la partie dans laquelle on va chercher la bombe, et appeler la fonction 'Coordonnee'.
A chaque tour de boucle, la fonction va afficher les nouvelles coordonnées de Batman, jusqu'à tomber sur celles où se trouve la bombe.
</p>
</div>
</li>
</ol>
</div>
</div>
<div id="outline-container-org81d4e63" class="outline-3">
<h3 id="org81d4e63"><span class="section-number-3">1.2</span> Présenter les tests et leur exécution</h3>
<div class="outline-text-3" id="text-1-2">
<p>
Afin de vérifier que le code est correct, on va devoir le tester avec différentes données en entrée.
</p>
</div>
<div id="outline-container-org1ce5613" class="outline-4">
<h4 id="org1ce5613"><span class="section-number-4">1.2.1</span> Premier Test</h4>
<div class="outline-text-4" id="text-1-2-1">
<p>
L'immeuble sera ici d'une largeur égale à 8, et de longueur 4.
Batman sera positionné aux coordonnées (2,3).
</p>
<p>
On a alors comme sortie :
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-right" />
<col class="org-right" />
</colgroup>
<tbody>
<tr>
<td class="org-right">X0</td>
<td class="org-right">Y0</td>
</tr>
<tr>
<td class="org-right">3</td>
<td class="org-right">7</td>
</tr>
</tbody>
</table>
<p>
On a donc récupérer les coordonnées de la bombe, qui sont (3,7).
</p>
</div>
</div>
<div id="outline-container-orgeeb2c52" class="outline-4">
<h4 id="orgeeb2c52"><span class="section-number-4">1.2.2</span> Deuxième Test</h4>
<div class="outline-text-4" id="text-1-2-2">
<p>
L'immeuble sera ici d'une largeur égale à 1, et de longueur 80.
Batman sera positionné aux coordonnées (0,1).
</p>
<p>
On a alors comme sortie :
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-right" />
<col class="org-right" />
</colgroup>
<tbody>
<tr>
<td class="org-right">X0</td>
<td class="org-right">Y0</td>
</tr>
<tr>
<td class="org-right">0</td>
<td class="org-right">36</td>
</tr>
</tbody>
</table>
<p>
On a donc récupérer les coordonnées de la bombe, qui sont (0,36).
</p>
<p>
Chaque test a ici renvoyé les bonnes valeurs on peut en conclure, avec nos données, que l'algorithme est correct.
</p>
</div>
</div>
</div>
<div id="outline-container-org3734cd1" class="outline-3">
<h3 id="org3734cd1"><span class="section-number-3">1.3</span> Présenter une solution plébiscitée de la communauté</h3>
<div class="outline-text-3" id="text-1-3">
<p>
J'ai souhaité pour cette partie reprendre la solution de Klemek qu'il a déposé sur le site, remplie avec des valeurs afin de vérifier son bon fonctionnement :.
</p>
<div class="org-src-container">
<pre class="src src-C">
<span style="color: #e5786d;">#include</span> <span style="color: #95e454;">"stdlib.h"</span>
<span style="color: #e5786d;">#include</span> <span style="color: #95e454;">"stdio.h"</span>
<span style="color: #e5786d;">#include</span> <span style="color: #95e454;">"string.h"</span>
<span style="color: #e5786d;">#include</span> <span style="color: #95e454;">"stdbool.h"</span>
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">main</span>()
{
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">W</span>=5;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">H</span>=8;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">N</span>=40;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">X0</span>=0;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">Y0</span>=0;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">compteur</span>=0;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">Xbombe</span>=3;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">Ybombe</span>=4;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">min_x</span> = 0;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">min_y</span> = 0;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">max_x</span> = W;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">max_y</span> = H;
<span style="color: #92a65e; font-weight: bold;">int</span> <span style="color: #cae682;">i</span> =0;
<span style="color: #8ac6f2; font-weight: bold;">while</span> (i&lt;N) {
<span style="color: #92a65e; font-weight: bold;">char</span> <span style="color: #cae682;">bomb_dir</span>[4];
<span style="color: #8ac6f2; font-weight: bold;">if</span> (X0&lt;Xbombe)
{
bomb_dir[0]=<span style="color: #95e454;">'D'</span>;
compteur++;
}
<span style="color: #8ac6f2; font-weight: bold;">else</span> <span style="color: #8ac6f2; font-weight: bold;">if</span> (X0&gt;Xbombe)
{
bomb_dir[0]=<span style="color: #95e454;">'U'</span>;
compteur++;
}