{"id":1125,"date":"2023-02-11T15:39:07","date_gmt":"2023-02-11T14:39:07","guid":{"rendered":"https:\/\/blog.univ-angers.fr\/mathsinfo\/?page_id=1125"},"modified":"2023-02-18T14:56:30","modified_gmt":"2023-02-18T13:56:30","slug":"images-sur-la-casio-fx-92-speciale-college","status":"publish","type":"page","link":"https:\/\/blog.univ-angers.fr\/mathsinfo\/images-sur-la-casio-fx-92-speciale-college\/","title":{"rendered":"Images sur la CASIO fx-92+ Sp\u00e9ciale Coll\u00e8ge"},"content":{"rendered":"\n<p>La CASIO fx-92+ a une petite r\u00e9solution de <strong>192<\/strong> pixels (-95 \u00e0 96) de large et <strong>47<\/strong> pixels de haut (-23 \u00e0 23). Ceci permet malgr\u00e9 tout d&rsquo;obtenir quelques jolis visuels :<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"582\" height=\"219\" src=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image.png\" alt=\"\" class=\"wp-image-1127\" srcset=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image.png 582w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-300x113.png 300w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-500x188.png 500w\" sizes=\"auto, (max-width: 582px) 100vw, 582px\" \/><\/a><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"582\" height=\"219\" src=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-1.png\" alt=\"\" class=\"wp-image-1128\" srcset=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-1.png 582w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-1-300x113.png 300w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-1-500x188.png 500w\" sizes=\"auto, (max-width: 582px) 100vw, 582px\" \/><\/a><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"582\" height=\"219\" src=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-2.png\" alt=\"\" class=\"wp-image-1134\" srcset=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-2.png 582w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-2-300x113.png 300w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-2-500x188.png 500w\" sizes=\"auto, (max-width: 582px) 100vw, 582px\" \/><\/a><figcaption class=\"wp-element-caption\">Marylin Monroe<\/figcaption><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-3.png\"><img loading=\"lazy\" decoding=\"async\" width=\"910\" height=\"342\" src=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-3.png\" alt=\"\" class=\"wp-image-1139\" srcset=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-3.png 910w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-3-300x113.png 300w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-3-768x289.png 768w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-3-500x188.png 500w\" sizes=\"auto, (max-width: 910px) 100vw, 910px\" \/><\/a><figcaption class=\"wp-element-caption\">Jeu Dark Castle pour Macintosh (1986)<\/figcaption><\/figure>\n<\/div>\n\n\n<p>La CASIO accepte des nombres sans les arrondir jusqu&rsquo;\u00e0 12 chiffres, ce qui en binaire fait :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt;&gt; bin(999999999999)\n\n'0b1110100011010100101001010000111111111111'<\/code><\/pre>\n\n\n\n<p>Soit l&rsquo;\u00e9quivalent de 40 pixels. Cependant, si tous les pixels \u00e9taient \u00e0 1, on obtiendrait le nombre :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt;&gt; int('0b'+'1'*40, 2)\n1099511627775<\/code><\/pre>\n\n\n\n<p>qui a 13 chiffres. On peut donc soit se restreindre \u00e0 39 pixels de haut o\u00f9 \u00eatre conscient qu&rsquo;avec 40 pixels il pourra y avoir \u00e9ventuellement des anomalies. Nous prendrons ce petit risque.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Partie Gimp<\/h2>\n\n\n\n<p>Cr\u00e9ez une image de <strong>L x 40<\/strong> pixels o\u00f9 <strong>L<\/strong> est entre 1 et 192. Mettre l&rsquo;image en noir et blanc (Menu Image &#8211; Mode &#8211; Couleurs index\u00e9es &#8211; Utiliser une palette noir et blanc 1 bit). Faire votre dessin.<\/p>\n\n\n\n<p>Filtres &#8211; Python Fu &#8211; Console et coller ce script :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def gimp2fx92():\n   img = gimp.image_list()&#091;0]\n   drw = pdb.gimp_image_active_drawable(img)\n   L = pdb.gimp_image_width(img)\n   H = pdb.gimp_image_height(img)\n   for x in range(L):\n    for y in reversed(range(H)):\n      v = 0 != sum(list(pdb.gimp_image_pick_color(img,drw,x,y,1,0,0))&#091;:-1])\n      c = v + (2 * c if y != H - 1 else 0)\n    print c<\/code><\/pre>\n\n\n\n<p>Pour chaque <strong>x<\/strong> entre 0 et la largeur <strong>L<\/strong> de l&rsquo;image, on parcourt les pixels <strong>y<\/strong> de la colonne. La valeur de <strong>v<\/strong> sera \u00e9gale \u00e0 0 si le pixel est noir. A chaque \u00e9tape <strong>c<\/strong> est multipli\u00e9 par 2 et on ajoute 1 s&rsquo;il y a un pixel noir.<\/p>\n\n\n\n<p>En lan\u00e7ant le script on obtient une liste d&rsquo;entiers. Voici un exemple avec l&rsquo;image ci-dessous : <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-5.png\"><img loading=\"lazy\" decoding=\"async\" width=\"426\" height=\"311\" src=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-5.png\" alt=\"\" class=\"wp-image-1147\" srcset=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-5.png 426w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-5-300x219.png 300w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-5-411x300.png 411w\" sizes=\"auto, (max-width: 426px) 100vw, 426px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p>Si on d\u00e9compose 402653184 en binaire on obtient :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt;&gt; bin(402653184)\n'0b11000000000000000000000000000'<\/code><\/pre>\n\n\n\n<p>Les 27 z\u00e9ros correspondent aux 27 cases noires de la premi\u00e8re colonne suivi de 2 cases blanches (les &rsquo;11&rsquo;) et le reste est noir :<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-6.png\"><img loading=\"lazy\" decoding=\"async\" width=\"49\" height=\"661\" src=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2023\/02\/image-6.png\" alt=\"\" class=\"wp-image-1148\" \/><\/a><figcaption class=\"wp-element-caption\">La premi\u00e8re colonne de l&rsquo;image<\/figcaption><\/figure>\n<\/div>\n\n\n<p>Pour d\u00e9composer l&rsquo;entier en nombre binaire sur la CASIO, on va utiliser des divisions successives par 2, ce qui en Python donne :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def dec2bin(a):\n s = ''\n while n &gt; 0:\n  a \/= 2\n  s += '0' if a == int(a) else '1'\n  a = int(a) \n return s \n\n&gt;&gt; dec2bin(402653184)\n'00000000000000000000000000011'<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Partie CASIO fx-92+<\/h2>\n\n\n\n<p>Script pour la CASIO :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-95 \u2192 B\nS'orienter \u00e0 -90\nR\u00e9p\u00e9ter jusqu'\u00e0 B = 95\n Aller \u00e0 x = B , y = 22\n ? \u2192 A\n B + 1 \u2192 B\n R\u00e9p\u00e9ter 40\n   A \u00f7 2 \u2192 A\n   Si A = Ent(A)\n    Stylo \u00e9crit\n    Avancer de 0 pixels\n   Fin\n   Stylo relev\u00e9\n   Avancer de 1 pixels\n   Ent(A) \u2192 A\n \u2934\n\u2934\nAller \u00e0 x = 110 , y = 0<\/code><\/pre>\n\n\n\n<p>Ainsi, en lan\u00e7ant le programme CASIO et en tapant tous les nombres entiers fournis par Gimp, on aura l&rsquo;image finale !<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Macro Excel<\/h2>\n\n\n\n<p>Si vous avez la cl\u00e9 USB CASIO avec l&rsquo;\u00e9mulateur de la fx-92+ Sp\u00e9ciale Coll\u00e8ge, il est possible de cr\u00e9er une petite macro qui va envoyer les diff\u00e9rents nombres \u00e0 intervalles r\u00e9guliers. Pour cela copiez-collez les nombres dans un classeur Excel puis <strong>ALT+F11<\/strong> pour acc\u00e9der \u00e0 VBA, Insertion &#8211; Module et coller le code :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Sub data2fx92()\n Application.Wait Now + #12:00:05 AM#\n For Each cellule In Selection\n  If cellule.Value &lt;&gt; \"\" Then\n   SendKeys cellule.Value &amp; \"~\"\n   Application.Wait Now + #12:00:12 AM#\n  End If\n Next\nEnd Sub<\/code><\/pre>\n\n\n\n<p>Lancez l&rsquo;\u00e9mulateur CASIO, tapez le programme et le lancer. Il s&rsquo;affiche <strong>A?<\/strong><\/p>\n\n\n\n<p>Dans Excel s\u00e9lectionnez uniquement les donn\u00e9es (<strong>CTRL + A<\/strong>) mais <strong>PAS<\/strong> toute la colonne (qui contient 1 million de cellules !!). Lancez la macro et dans les 5 secondes qui suivent retournez dans l&rsquo;\u00e9mulateur (si c&rsquo;est trop rapide modifiez la ligne 12:00:05 en 12:00:10 pour vous laisser par exemple 10 secondes). Toutes les 12 secondes un entier est envoy\u00e9 \u00e0 la machine et la colonne s&rsquo;affiche \u00e0 l&rsquo;\u00e9cran.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>La CASIO fx-92+ a une petite r\u00e9solution de 192 pixels (-95 \u00e0 96) de large et 47 pixels de haut (-23 \u00e0 23). Ceci permet malgr\u00e9 tout d&rsquo;obtenir quelques jolis visuels : La CASIO accepte des nombres sans les arrondir &hellip; <a href=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/images-sur-la-casio-fx-92-speciale-college\/\">Continuer la lecture <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":4913,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1125","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/pages\/1125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/users\/4913"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/comments?post=1125"}],"version-history":[{"count":24,"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/pages\/1125\/revisions"}],"predecessor-version":[{"id":1159,"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/pages\/1125\/revisions\/1159"}],"wp:attachment":[{"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/media?parent=1125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}