diff --git a/Y/Ada-S2/Programmes/exos-preparatoires/css b/Y/Ada-S2/Programmes/exos-preparatoires/css index e69de29..3203323 100644 --- a/Y/Ada-S2/Programmes/exos-preparatoires/css +++ b/Y/Ada-S2/Programmes/exos-preparatoires/css @@ -0,0 +1,106 @@ +code.highlight { + font-weight: bold; + color: #0000BB; +} + +code.block { + display: inline-block; + border: thin dotted #44F; + padding: 0.4ex 1.5ex 0.5ex 1.5ex; + margin: 0.2ex 1ex 0.2ex 1ex; + box-shadow: 1px 1px 1px #CCC; + background: rgba(255, 255, 255, 0.5); + white-space: pre; + vertical-align: middle; +} + +code.page { + margin-left: 8%; + box-shadow: 3px 3px 3px #DBD; + font-size: 11pt; + background: #F0FFFF; +} + +span.comment { + color: rgba(0, 110, 0, 0.7); + font-style: italic; + font-family: sans; + font-size: 105%; + white-space: pre; +} + +span.semi { + font-weight: bold; + color: rgba(196, 0, 128, 0.6); +} + +span.operator { + color: #840; + font-weight: bold; +} + +span.highcomment { + font-style: italic; + font-family: sans; + font-size: 105%; + white-space: pre; + font-size: 110%; + font-weight: bold; + color: rgba(0, 110, 0, 0.9); + margin: 0.25ex 0ex 0.25ex 0ex; +} + +span.highercomment { + font-style: italic; + font-family: sans; + font-size: 105%; + white-space: pre; + font-size: 105%; + font-weight: bold; + color: #000; + background: #DDD; + padding: 0ex 4.5ex 0ex 4.5ex; + margin: 0.25ex 0ex 2.5ex -4ex; + border: thin solid black; +} + +span.label { + font-style: italic; + color: #44F; +} + +span.letvar { + color: #0000A0; + font-style: italic; +} + +span.uident { + font-weight: bold; + font-size: 110%; + color: #080; +} + +span.string, span.char { + color: #E22; + white-space: pre; + font-family: serif; + font-size: 92%; +} + +span.kw, code.kw { + display: inline; + font-weight: bold; + color: #600080; +} + +span.type { + font-weight: bold; + color: #069; +} + +span.fname { + font-variant: small-caps; + font-weight: bold; + font-size: 110%; + color: #050; +} diff --git a/Y/Ada-S2/Programmes/exos-preparatoires/mission1.html b/Y/Ada-S2/Programmes/exos-preparatoires/mission1.html new file mode 100644 index 0000000..fac6a62 --- /dev/null +++ b/Y/Ada-S2/Programmes/exos-preparatoires/mission1.html @@ -0,0 +1,154 @@ + + + + mission1.adb + + + + + + + +
with Gada.Text_IO ; + + procedure Mission1 is + + package Txt renames GAda.Text_IO ; + + procedure Tracer_Ligne (Long : Integer) is + begin + -- Tracer n fois le caractère # puis passer à la ligne. + for Colonne in 1..Long loop + Txt.Put("#") ; + end loop ; + Txt.New_Line ; + end Tracer_Ligne ; + + procedure Tracer_Rectangle (Largeur : Integer ; Hauteur : Integer) is + begin + -- Première ligne, pleine + Tracer_Ligne(Largeur) ; + + -- Les lignes suivantes (de 2 à Hauteur-1) ne contiennent que + -- le caractère # du début et celui de la fin. + for Ligne in 2..Hauteur - 1 loop + Txt.Put("#") ; + + -- Des espaces au milieu. + for Col in 2..Largeur - 1 loop + Txt.Put(" ") ; + end loop ; + + Txt.Put("#") ; + Txt.New_Line ; + end loop ; + + -- La dernière ligne est pleine. + Tracer_Ligne(Largeur) ; + Txt.New_Line ; + end Tracer_Rectangle ; + + procedure Tracer_Quadrillage (Largeur : Integer ; Hauteur : Integer) is + begin + -- On dessine ligne par ligne, colonne par colonne. + for Ligne in 1..Hauteur loop + for Col in 1..Largeur loop + -- Il suffit de tracer les lignes impaires et les colonnes impaires. + if (Ligne mod 2 = 1) or (Col mod 2 = 1) then + Txt.Put("#") ; + else + Txt.Put(" ") ; + end if ; + end loop ; + Txt.New_Line ; + end loop ; + Txt.New_Line ; + end Tracer_Quadrillage ; + + procedure Tracer_Damier (Largeur : Integer ; Hauteur : Integer) is + begin + -- Même principe que Tester_Quadrillage + for Ligne in 1..Hauteur loop + for Col in 1..Largeur loop + -- Il suffit de tracer les cases telles que x+y est pair. + if (Ligne + Col) mod 2 = 0 then + Txt.Put("#") ; + else + Txt.Put(" ") ; + end if ; + end loop ; + Txt.New_Line ; + end loop ; + Txt.New_Line ; + end Tracer_Damier ; + + procedure Tracer_Gros_Damier (Largeur : Integer ; Hauteur : Integer) is + begin + -- Même principe, mais en divisant les coordonnées par 2 pour faire des paquets de 2x2. + for Ligne in 1..Hauteur loop + for Col in 1..Largeur loop + + -- On soustrait 1 car sinon le damier commence au milieu d'un paquet de 2x2 et ce n'est pas joli. + if ((Ligne-1)/2 + (Col-1)/2) mod 2 = 1 then + Txt.Put("#") ; + else + Txt.Put(" ") ; + end if ; + end loop ; + Txt.New_Line ; + end loop ; + Txt.New_Line ; + end Tracer_Gros_Damier ; + + begin + + Txt.Put_Line("Test de Tracer_Ligne : ") ; + Txt.New_Line ; + + Tracer_Ligne(3) ; + Tracer_Ligne(8) ; + Tracer_Ligne(20) ; + + Txt.New_Line ; + Txt.Put_Line("Test de Tracer_Rectangle : ") ; + Txt.New_Line ; + + Tracer_Rectangle(5, 5) ; + Tracer_Rectangle(14, 2) ; + Tracer_Rectangle(4, 6) ; + + Txt.New_Line ; + Txt.Put_Line("Test de Tracer_Quadrillage : ") ; + Txt.New_Line ; + + Tracer_Quadrillage(19, 11) ; + + Txt.New_Line ; + Txt.Put_Line("Test de Tracer_Damier : ") ; + Txt.New_Line ; + + Tracer_Damier(18, 10) ; + + Txt.New_Line ; + Txt.Put_Line("Test de Tracer_Gros_Damier : ") ; + Txt.New_Line ; + + Tracer_Gros_Damier(18, 10) ; + + end Mission1 ; +
+ + + + diff --git a/Y/Ada-S2/Programmes/exos-preparatoires/solution-en-ocaml.html b/Y/Ada-S2/Programmes/exos-preparatoires/solution-en-ocaml.html new file mode 100644 index 0000000..2d66ed2 --- /dev/null +++ b/Y/Ada-S2/Programmes/exos-preparatoires/solution-en-ocaml.html @@ -0,0 +1,80 @@ + + + + mission2.ml + + + + + + + +
(* Version OCaml de l'exercice sur les intervalles *) + + type t_intervalle = + { inf: float ; + sup: float } + + let sof x = string_of_int (int_of_float x) + + (* Les trois premières fonctions demandées. *) + let intervalle_image it = "[" ^ sof it.inf ^ ", " ^ sof it.sup ^ "]" + let est_inclus a b = (a.inf >= b.inf && a.sup <= b.sup) + let disjoints a b = (a.sup < b.inf || a.inf > b.sup) + + (* Fonction d'affichage générique qui marchera pour t_intervalle et pour t_prod. *) + let affichage_gen f_inclus f_disjoint f_image i1 i2 = + let s1 = f_image i1 + and s2 = f_image i2 in + + if f_inclus i1 i2 then Printf.printf "%s est inclus dans %s\n" s1 s2 + else if f_inclus i2 i1 then Printf.printf "%s est inclus dans %s\n" s2 s1 + else if f_disjoint i1 i2 then Printf.printf "%s et %s sont disjoints\n" s1 s2 + else Printf.printf "%s et %s ne sont pas disjoints, ni inclus\n" s1 s2 + + (* Afficher_relation pour les intervalles. *) + let afficher_relation = affichage_gen est_inclus disjoints intervalle_image + + (* Produit cartésien *) + type t_prod = + { left: t_intervalle ; + right: t_intervalle } + + (* Les trois premières fonctions pour les produits cartésiens. *) + let prod_image p = intervalle_image p.left ^ " x " ^ intervalle_image p.right + let prod_est_inclus a b = est_inclus a.left b.left && est_inclus a.right b.right + let prod_disjoints a b = disjoints a.left b.left || disjoints a.right b.right + + (* La fonction d'affichage demandée. *) + let prod_afficher_relation = affichage_gen prod_est_inclus prod_disjoints prod_image + + let prod a b = { left = a ; right = b } + + (* Test *) + let () = + let c = { inf = 5.0 ; sup = 10.0 } + and d = { inf = 7.0 ; sup = 8.0 } + and e = { inf = 4.0 ; sup = 6.0 } + in + + afficher_relation c d ; + afficher_relation d c ; + afficher_relation c e ; + afficher_relation d e ; + + prod_afficher_relation (prod c c) (prod d d) ; + prod_afficher_relation (prod c d) (prod d c) ; + prod_afficher_relation (prod d c) (prod e c) ; + () + + +
+ + + + diff --git a/Y/ystyle.css b/Y/ystyle.css index 7e877da..ee6fba1 100644 --- a/Y/ystyle.css +++ b/Y/ystyle.css @@ -218,7 +218,7 @@ code { margin-left: 3vw; margin-top: 20px; font-family: monospace; - display: inline-block; + display: block; color: #ffffcc; tab-size: 2; @@ -240,11 +240,31 @@ code * { span.comment { font-style: italic; color: rgb(128, 139, 150); + white-space: pre; } span.kw { - color: rgb(203, 67, 53); - font-weight: bold; + color: rgb(227,99,99); +} + +span.type { + color: rgb(203, 128, 53); +} + +span.fname { + color: rgb(203, 203, 53); +} + +span.string { + color: rgb(53, 203, 128); +} + +span.letvar { + color: rgb(128, 203, 53); +} + +span.uident{ + color: rgb(203, 203, 53); } diff --git a/script.js b/script.js deleted file mode 100644 index 8b0c3d0..0000000 --- a/script.js +++ /dev/null @@ -1,81 +0,0 @@ - -// -// Show/hide some sections by clicking on the title. -// -// Can be replaced by
, once it is supported by most browsers. -// - -function saveStatus(id, shown) { - if (typeof(Storage) !== "undefined") { - localStorage.setItem("yfold-shown-" + id, shown) ; - } -} - -// record : (when clicked), record the status in local storage -function setStatus(id, shown, content, record) { - - // console.log ("setStatus (" + id + ", " + shown + ")") ; - - var span = document.getElementById("arrow-" + id) ; - - if (shown) { - content.classList.remove("anim-hide") ; - content.classList.remove("hidden") ; - span.innerHTML = "▾" ; - if (record) { content.classList.add("anim-show") ; } - else { content.classList.add("shown") ; } - } - else { - content.classList.remove("anim-show") ; - content.classList.remove("shown") ; - span.innerHTML = "▸" ; - if (record) { content.classList.add("anim-hide") ; } - else { content.classList.add("hidden") ; } - } - - if (record) { saveStatus(id, shown) ; } -} - -// Invoked at load-time once for every yfold section. -function initYfold(id) { - - // console.log ("initYfold (" + id + ")") ; - - // console.log ("unknown " + id) - var shown = true ; - var content = document.getElementById("content-" + id) ; - - // Sets the state according to local storage or default value. - - if (typeof(Storage) !== "undefined") { - var local = localStorage.getItem("yfold-shown-" + id) ; - // console.log ("using storage value = " + local) - - if (local === 'true') { - shown = true ; - } - else if (local === 'false') { - shown = false ; - } - else { - // Get default value - var defv = content.getAttribute("data-yfold-default") ; - if (defv === 'hide') { - shown = false ; - } - // console.log ("using default value = " + shown) - } - } - - setStatus(id, shown, content, false) ; -} - -// Function invoked when the title is clicked. -function toggleYfold(id) { - - // console.log ("toggleYfold (" + id + ")") ; - - var content = document.getElementById("content-" + id) ; - var expand = content.classList.contains("anim-hide") || content.classList.contains("hidden") ; - setStatus(id, expand, content, true) ; -}