{"id":10669,"date":"2025-10-24T14:16:56","date_gmt":"2025-10-24T12:16:56","guid":{"rendered":"https:\/\/spgoo.org\/?page_id=10669"},"modified":"2025-10-26T10:52:11","modified_gmt":"2025-10-26T09:52:11","slug":"axelrod","status":"publish","type":"page","link":"https:\/\/spgoo.org\/?page_id=10669","title":{"rendered":"Axelrod"},"content":{"rendered":"\n<link rel='stylesheet' id='10654-css'  href='https:\/\/spgoo.org\/wp-content\/uploads\/winp-css-js\/10654.css?ver=1761585761' type='text\/css' media='all' \/>\n\n\n<script type='text\/javascript'>\nvar id = \"10667\";<\/script>\n<script type='text\/javascript' src='https:\/\/spgoo.org\/wp-content\/uploads\/winp-css-js\/10667.js?ver=1762078084'><\/script>\n\n\n<link rel=\"stylesheet\" href=\"https:\/\/cdn.jsdelivr.net\/npm\/jsxgraph\/distrib\/jsxgraph.css\">\r\n<script src=\"https:\/\/cdn.jsdelivr.net\/npm\/jsxgraph\/distrib\/jsxgraphcore.js\"><\/script>\r\n<link rel=\"stylesheet\" type=\"text\/css\" href=\"https:\/\/cdn.jsdelivr.net\/gh\/bitmaks\/cm-web-fonts@latest\/fonts.css\">\r\n    \r\n<!-- MathJax -->\r\n<script>\r\n\twindow.MathJax = {\r\n\t\ttex: { inlineMath: [['\\\\(', '\\\\)'], ['$', '$']] },\r\n\t\tsvg: { fontCache: 'global' }\r\n\t};\r\n<\/script>\r\n<script src=\"https:\/\/cdn.jsdelivr.net\/npm\/mathjax@3\/es5\/tex-svg.js\"><\/script>  \r\n\r\n<h1>\\(\\textrm{Tournois d&#8217;Axelrod : Face \u00e0 Face}\\)<\/h1>  \r\n  <div class=\"containerCP\">\r\n    <div class=\"top-row\">\r\n      <div id=\"board1\" class=\"board\"><\/div>\r\n      <div id=\"board2\" class=\"board\"><\/div>\r\n      <div id=\"board3\" class=\"board\"><\/div>\r\n    <\/div>\r\n    <div id=\"board4\" class=\"board\"><\/div>\r\n  <\/div>\r\n<!-- <div id=\"board5\" style=\"width:400px; height:150px; display:block; margin-top:10px;\"><\/div> -->\r\n<div style=\"display:flex;justify-content:space-between;\">\r\n<a style=\"font-Size:20px;color:white\" href=\"https:\/\/spgoo.org\/?page_id=10751\">\\(\\,\\,\\,\\textrm{Tournoi Round-robin}\\)<\/a> \r\n<a style=\"font-Size:20px;color:white\" href=\"https:\/\/spgoo.org\/?page_id=10890\">\\(\\,\\,\\,\\textrm{Tournoi par \u00c9limination directe}\\)<\/a> \r\n<\/div>\r\n<details class=\"wp-block-details is-layout-flow wp-block-details-is-layout-flow\" style=\"text-align:center;\"><summary style=\"color:white\">D\u00e9tails<\/summary>\r\n<div id=\"explications\" style=\"color:white\" >\r\n\t<h1>Explications sur le simulateur<\/h1>\r\n\t<p>Ce simulateur \u00e0 plusieurs niveaux vous permet de tester des strat\u00e9gies selon diff\u00e9rentes configurations.<\/p>\r\n\t<br\/>\r\n\t<p>Configuration face \u00e0 face\r\n\t\t<li>Joueur contre joueur : vous devez fixer pour chaque joueur une strat\u00e9gie parmi les propos\u00e9es et le nombre de parties.  <\/li>\r\n\t\t<li>Joueur contre la machine : vous devez fixer pour un seul joueur une strat\u00e9gie et fixer le nombre de parties. Au d\u00e9marrage de la partie la machine choisit une strat\u00e9gie et l&#8217;affiche.  <\/li>\r\n\t<\/p>\r\n\t<p>Configuration en tournoi Round-Robin\r\n\t\t<li>Dans cette configuration, un ensemble de joueurs va apparaitre autour du simulateur. Une fois la partie d\u00e9marr\u00e9e, une s\u00e9lection de deux joueurs parmi l&#8217;ensemble sera effectu\u00e9e . Les deux joueurs apr\u00e8s avoir s\u00e9lection\u00e9 une strat\u00e9gie pourront se confronter. Le jeu se d\u00e9roulera jusqu&#8217;\u00e0 ce que chaque joueur ait affront\u00e9 tous les joueurs.      <\/li>\r\n\t<\/p>\r\n\t<p>Configuration en tournoi par Elimination directe\r\n\t\t<li>Dans cette configuration, les tirages des joueurs sont al\u00e9atoires, le gagnant reste et le vaincu est \u00e9limin\u00e9. <\/li>\r\n\t<\/p>\r\n<\/div>\r\n<\/details>\r\n\r\n\r\n<script>\r\n  const board1 = JXG.JSXGraph.initBoard('board1', {boundingbox: [-5, 5, 5, -5],\r\n    axis: false, showCopyright: false,showNavigation: false});\r\n  board1.renderer.container.style.backgroundColor = '#EBACA2';\r\n\r\n  const board2 = JXG.JSXGraph.initBoard('board2', { boundingbox: [-10, 10, 10, -10],\r\n    axis: false,keepAspectRatio:true,showCopyright: false,showNavigation: false});\r\n\r\n  const board3 = JXG.JSXGraph.initBoard('board3', { boundingbox: [-5, 5, 5, -5],\r\n    axis: false,showCopyright: false,showNavigation: false});\r\n  board3.renderer.container.style.backgroundColor = '#BED3C3';\r\n\r\n  const board4 = JXG.JSXGraph.initBoard('board4', {boundingbox: [-12, 6, 12, -6],\r\n    axis: false,keepAspectRatio:true,showCopyright: false,showNavigation: false});\r\n  board4.renderer.container.style.backgroundColor = '#FBF6E1';\r\n\r\n   \/\/ zone d'affectation aux joueurs \r\n  board2.create('polygon',[[-13,0],[-13,10],[13,10],[13,0]],{fillColor:\"#EBACA2\",opacity:0.9,highlight:false,vertices:{visible:false}});\r\n  board2.create('polygon',[[-13,0],[-13,-10],[13,-10],[13,0]],{fillColor:\"#BED3C3\",opacity:0.9,highlight:false,vertices:{visible:false}});\r\n\r\n  \/\/images\r\n  var im0 = board1.create('image', ['.\/personnalisation\/images\/femmegot.png', [-1,2.5], [2,2]],{anchorX:'middle',anchorY:'middle'});   \r\n  var im01 = board1.create('image', ['.\/personnalisation\/images\/des.png', [-1,2.5], [2,2]],{anchorX:'middle',anchorY:'middle',visible:false});   \r\n\r\n  var im1 = board3.create('image', ['.\/personnalisation\/images\/hommegot.png', [-1,2.5], [2,2]],{anchorX:'middle',anchorY:'middle'});   \r\n\r\n  const  textb10 =  board1.create('text',[-2.5,0,\"\\\\(\\\\begin{matrix}\\\\textrm{Score de la}\\\\\\\\ \\\\textrm{confrontation}\\\\end{matrix} \\\\)\"],{fixed:true,highlight:false,anchorX:'middle',anchorY:'middle',color:'Navy'});\r\n  const  score1_conf =  board1.create('text',[-2.5,-1.5,\"\\\\(0\\\\)\"],{fontSize:16,fixed:true,highlight:false,anchorX:'middle',anchorY:'middle',color:'Navy'});\r\n  const  textb11 =  board1.create('text',[2.5,0,\"\\\\(\\\\begin{matrix}\\\\textrm{Scores cumul\u00e9s}\\\\\\\\ \\\\textrm{de la partie}\\\\end{matrix} \\\\)\"],{fixed:true,highlight:false,anchorX:'middle',anchorY:'middle',color:'Navy'});\r\n  const  score1_Cumul =  board1.create('text',[2.5,-1.5,\"\\\\(0\\\\)\"],{fontSize:16,fixed:true,highlight:false,anchorX:'middle',anchorY:'middle',color:'Navy'});\r\n\/\/tableau central\r\nconst p0 = board2.create('point', [-11, 0],{visible:false});\r\nconst p1 = board2.create('point', [11, -0],{visible:false});\r\nconst  l0 = board2.create('line', [p0, p1],{highlight:false,fixed:true,shadow:true});\r\nvar ineq0 = board2.create('inequality', [l0],{inverse: false, fillColor: '#EBACA2',opacity:0.1});\r\nvar ineq1 = board2.create('inequality', [l0],{inverse: true, fillColor: '#BED3C3',opacity:0.1});\r\n\r\nvar pc10 = board2.create('point',[-5.5,5],{visible:false});\r\nvar pc10_A = board2.create('point',[-5.5,2.5],{visible:false});\r\nvar circCurseur10 =  board2.create('circle',[pc10,2.5],{fixed:true,shadow:true,strokeColor:'darkgreen',fillColor:'#AE181E',opacity:0.0});\r\n\/\/ varie de -0.25 \u00e0 0.75 \r\nvar pc10_Glider = board2.create('glider',[circCurseur10],{visible:true,color:\"#EBACA2\", label:{visible:false}});\r\nbeta = board2.create('angle', [ pc10_A,pc10, pc10_Glider], {\r\n        type: 'sector',\r\n        layer:11,\r\n        label:{visible:false},\r\n        orthoType: 'square',\r\n        fillColor:\"red\",\r\n        opacity:0.7,\r\n        radius: 2.5\r\n    });\r\npc10_Glider.setGliderPosition(-0.25);\r\nvar circ10 =  board2.create('circle',[pc10,2],{layer:10,fixed:true,shadow:true,strokeColor:'darkgreen',fillColor:'#AE181E',opacity:0.1});\r\nvar imb0 = board2.create('image', ['.\/personnalisation\/images\/poignee.png', [-6.9,3.6], [3,3]],{layer:15,fixed:true,anchorX:'middle',anchorY:'middle',opacity:1});\r\n\r\n\r\nvar pc11 = board2.create('point',[5.5,5],{visible:false});\r\nvar pc11_A = board2.create('point',[5.5,2.5],{visible:false});\r\nvar circCurseur11 =  board2.create('circle',[pc11,2.5],{fixed:true,shadow:true,strokeColor:'darkgreen',fillColor:'#AE181E',opacity:0.0});\r\n\/\/ varie de -0.25 \u00e0 0.75 \r\nvar pc11_Glider = board2.create('glider',[circCurseur11],{visible:true,color:\"#EBACA2\",label:{visible:false}});\r\nboard2.create('angle', [ pc11_A,pc11, pc11_Glider], {\r\n        type: 'sector',\r\n        layer:11,\r\n        label:{visible:false},\r\n        orthoType: 'square',\r\n        fillColor:\"red\",\r\n        opacity:0.7,\r\n        \/*orthoSensitivity: 2,*\/\r\n        radius: 2.5\r\n    });\r\npc11_Glider.setGliderPosition(-0.25);\r\nvar circ11 =  board2.create('circle',[pc11,2],{layer:10,fixed:true,shadow:true,strokeColor:'darkgreen',fillColor:'#AE181E',opacity:0.2});\r\nvar imb1 = board2.create('image', ['.\/personnalisation\/images\/couteau.png', [4,3.6], [3,3]],{layer:15,fixed:true,anchorX:'middle',anchorY:'middle'});\r\n\r\nvar pc20 = board2.create('point',[-5.5,-5],{visible:false});\r\nvar pc20_A = board2.create('point',[-5.5,-7.5],{visible:false});\r\nvar circCurseur20 =  board2.create('circle',[pc20,2.5],{fixed:true,shadow:true,strokeColor:'darkgreen',fillColor:'#AE181E',opacity:0.0});\r\n\/\/ varie de -0.25 \u00e0 0.75 \r\nvar pc20_Glider = board2.create('glider',[circCurseur20],{visible:true,color:\"#BED3C3\", label:{visible:false}});\r\nboard2.create('angle', [ pc20_A,pc20, pc20_Glider], {\r\n        type: 'sector',\r\n        layer:11,\r\n        label:{visible:false},\r\n        orthoType: 'square',\r\n        fillColor:\"lightgreen\",\r\n        opacity:0.7,\r\n        \/*orthoSensitivity: 2,*\/\r\n        radius: 2.5\r\n    });\r\npc20_Glider.setGliderPosition(-0.25);\r\nvar circ20 =  board2.create('circle',[pc20,2],{layer:10,fixed:true,shadow:true,strokeColor:'darkgreen',fillColor:'#BED3C3',opacity:0.2});\r\n\/\/var text20 =  board2.create('text',[-5.5,-5,\"\\\\(\\\\textrm{C} \\\\)\"],{fixed:true,highlight:false,anchorX:'middle',anchorY:'middle',fontSize:16,color:'Navy'});\r\nvar imb3 = board2.create('image', ['.\/personnalisation\/images\/poignee.png', [-6.9,-6.5], [3,3]],{layer:15,fixed:true,anchorX:'middle',anchorY:'middle'});\r\n\r\nvar pc21 = board2.create('point',[5.5,-5],{visible:false});\r\nvar pc21_A = board2.create('point',[5.5,-7.5],{visible:false});\r\nvar circCurseur21 =  board2.create('circle',[pc21,2.5],{fixed:true,shadow:true,strokeColor:'darkgreen',fillColor:'#AE181E',opacity:0.0});\r\n\/\/ varie de -0.25 \u00e0 0.75 \r\nvar pc21_Glider = board2.create('glider',[circCurseur21],{visible:true,color:\"#BED3C3\",label:{visible:false}});\r\nboard2.create('angle', [ pc21_A,pc21, pc21_Glider], {\r\n        type: 'sector',\r\n        layer:11,\r\n        label:{visible:false},\r\n        orthoType: 'square',\r\n        fillColor:\"lightgreen\",\r\n        opacity:0.7,\r\n        \/*orthoSensitivity: 2,*\/\r\n        radius: 2.5\r\n    });\r\npc21_Glider.setGliderPosition(-0.25);\r\nvar circ21 =  board2.create('circle',[pc21,2],{layer:10,fixed:true,shadow:true,strokeColor:'darkgreen',fillColor:'#BED3C3',opacity:0.2});\r\n\/\/var text21 =  board2.create('text',[5.5,-5,\"\\\\(\\\\textrm{T} \\\\)\"],{fixed:true,highlight:false,anchorX:'middle',anchorY:'middle',fontSize:16,color:'Navy'});\r\nvar imb4 = board2.create('image', ['.\/personnalisation\/images\/couteau.png', [4,-6.5], [3,3]],{layer:15,fixed:true,anchorX:'middle',anchorY:'middle'});\r\n\r\n\/\/listes des strat\u00e9gies (board1 et bord3)\r\nconst htmlSelect1 = board1.create(\"text\", [0, 1.8,\r\n  '<div class=\"droplist\" id=\"myDroplist-User1\"><div class=\"droplist-header\"><div class=\"droplist-header-content\" id=\"selectedValue-User1\">\\\\(\\\\textrm{S\u00e9lectionnez une strat\u00e9gie}\\\\)<\/div><div class=\"droplist-arrow\"><\/div><\/div><div class=\"droplist-list\" id=\"droplist-User1\"><\/div><\/div>'\r\n  ], { fixed: true,anchorX:'middle' });\r\n\/\/\r\nconst  textb30 =  board3.create('text',[-2.5,0,\"\\\\(\\\\begin{matrix}\\\\textrm{Score de la}\\\\\\\\ \\\\textrm{confrontation}\\\\end{matrix} \\\\)\"],{fixed:true,highlight:false,anchorX:'middle',anchorY:'middle',color:'Navy'});\r\nconst  score2_conf =  board3.create('text',[-2.5,-1.5,\"\\\\(0\\\\)\"],{fontSize:16,fixed:true,highlight:false,anchorX:'middle',anchorY:'middle',color:'Navy'});\r\nconst  textb31 =  board3.create('text',[2.5,0,\"\\\\(\\\\begin{matrix}\\\\textrm{Scores cumul\u00e9s}\\\\\\\\ \\\\textrm{de la partie}\\\\end{matrix} \\\\)\"],{fixed:true,highlight:false,anchorX:'middle',anchorY:'middle',color:'Navy'});\r\nconst  score2_Cumul =  board3.create('text',[2.5,-1.5,\"\\\\(0\\\\)\"],{fontSize:16,fixed:true,highlight:false,anchorX:'middle',anchorY:'middle',color:'Navy'});\r\n\r\nconst htmlSelect2 = board3.create(\"text\", [0, 1.8,\r\n  '<div class=\"droplist\" id=\"myDroplist-User2\"><div class=\"droplist-header\"><div class=\"droplist-header-content\" id=\"selectedValue-User2\">\\\\(\\\\textrm{S\u00e9lectionnez une strat\u00e9gie}\\\\)<\/div><div class=\"droplist-arrow\"><\/div><\/div><div class=\"droplist-list\" id=\"droplist-User2\"><\/div><\/div>'\r\n], { fixed: true,anchorX:'middle' });\r\n\r\n\/\/ ecriture des strat\u00e9gies retenus et en cours \r\nconst  Strateg1 =  board2.create('text',[-8,8,\"\\\\(\\\\textrm{Strat\u00e9gie joueur 1}\\\\)\"],{fontSize:16,fixed:true,highlight:false,opacity:1,anchorX:'middle',anchorY:'middle',color:'red'});\r\nconst  Strateg2 =  board2.create('text',[6,-9,\"\\\\(\\\\textrm{Strat\u00e9gie joueur 2}\\\\)\"],{fontSize:16,fixed:true,highlight:false,anchorX:'middle',anchorY:'middle',color:'red'});\r\n\r\n\/\/const comments = {\"ZD-Good\":{\"texte\": \"\\\\(\\\\textrm{blablabla}\\\\)\",\"audio\": \"path du fichier\"},\r\n\/\/                                \"ZD-Extort-2\":{\"texte\": [\"\\\\(blablabla\\\\)\",\"\\\\(blablabla\\\\)\"],\"audio\": \"path du fichier\"}};\r\n\r\n\/\/board4\r\n\/\/ r\u00e9mun\u00e9rations\r\nvar i00 = board4.create('input', [-27, 2, \"3\", \"\"], {name: '',cssStyle: 'width: 25px;',value: '1'});\r\nvar i01 = board4.create('input', [-25, 2, \"3\", \"\"], {name: '',cssStyle: 'width: 25px;',value: '1'});\r\nvar i10 = board4.create('input', [-22, 2, \"0\", \"\"], {name: '',cssStyle: 'width: 25px;',value: '5'});\r\nvar i11 = board4.create('input', [-20, 2, \"5\", \"\"], {name: '',cssStyle: 'width: 25px;',value: '0'});\r\nvar i20 = board4.create('input', [-27, 0, \"5\", \"\"], {name: '',cssStyle: 'width: 25px;',value: '0'});\r\nvar i21 = board4.create('input', [-25, 0, \"0\", \"\"], {name: '',cssStyle: 'width: 25px;',value: '5'});\r\nvar i30 = board4.create('input', [-22, 0, \"1\", \"\"], {name: '',cssStyle: 'width: 25px;',value: '1'});\r\nvar i31 = board4.create('input', [-20, 0, \"1\", \"\"], {name: '',cssStyle: 'width: 25px;',value: '1'});\r\n\/\/ nb de parties \r\nvar i32 = board4.create('input', [17, 4, \"100\", \"\"], {name: '',cssStyle: 'width: 75px;',value: '100'});\r\n\r\nvar q40 = board4.create('point',[-27,3],{visible:false});\r\nvar q41 = board4.create('point',[-16.5,3],{visible:false});\r\nvar q42 = board4.create('point',[-27,-1],{visible:false});\r\nvar q43 = board4.create('point',[-16.5,-1],{visible:false});\r\nvar q44 = board4.create('point',[-27,1],{visible:false});\r\nvar q45 = board4.create('point',[-16.5,1],{visible:false});\r\nvar l40 = board4.create('segment',[q44,q45]);\r\nvar q46 = board4.create('point',[-21.75,3],{visible:false});\r\nvar q47 = board4.create('point',[-21.75,-1],{visible:false});\r\nvar l41 = board4.create('segment',[q46,q47]);\r\n\r\nvar poly40 = board4.create('polygon',[q40,q41,q43,q42],{highlight:false,fixed:true,shadow:true,fillColor:'#BEBCC8',strokeColor:'darkblue'});\r\n\r\nvar im45 = board4.create('image', ['.\/personnalisation\/images\/poignee.png', [-29.2,1.2], [1.6,1.6]],{fixed:true,anchorX:'middle',anchorY:'middle'});\r\nvar im46 = board4.create('image', ['.\/personnalisation\/images\/couteau.png', [-19.6,3.4,], [1.5,1.5]],{fixed:true,anchorX:'middle',anchorY:'middle'});\r\nvar im47 = board4.create('image', ['.\/personnalisation\/images\/couteau.png', [-29.2,-1.3], [1.6,1.6]],{fixed:true,anchorX:'middle',anchorY:'middle'});\r\nvar im48 = board4.create('image', ['.\/personnalisation\/images\/poignee.png', [-24.9,3.3], [1.5,1.5]],{fixed:true,anchorX:'middle',anchorY:'middle'});\r\n\/\/var im49 = board4.create('image', ['.\/couteau.png', [-19.6,4.4,], [1.5,1.5]],{anchorX:'middle',anchorY:'middle'});\r\n\r\nvar radio40 = board4.create('text', [15, -1.7, `\r\n<input type=\"radio\" name=\"myradio\" value=\"1\" onchange=\"change(this);\" checked>1<br\/>\r\n<input type=\"radio\" name=\"myradio\" value=\"2\" onchange=\"change(this);\">2<br\/>\r\n<input type=\"radio\" name=\"myradio\" value=\"3\" onchange=\"change(this);\">3<br\/>\r\n`], {fixed: true, frozen: true});\r\n\r\nconst im40 = board4.create('image', ['.\/personnalisation\/images\/femmegot.png', [18,-2.9], [2.5,2.5]],{anchorX:'middle',anchorY:'middle',shadow:true});   \r\nconst im41 = board4.create('image', ['.\/personnalisation\/images\/hommegot.png', [18,-2.9], [2.5,2.5]],{anchorX:'middle',anchorY:'middle',shadow:true,visible:false});   \r\nconst im42 = board4.create('image', ['.\/personnalisation\/images\/des.png', [18,-2.9], [2.5,2.5]],{anchorX:'middle',anchorY:'middle',shadow:true,visible:false});   \r\n\r\nfunction change(radio) {\r\n  const value = radio.value;\r\n  \/\/ cacher d'abord toutes les images\r\n  im0.setAttribute({ visible: false });\r\n  im01.setAttribute({ visible: false });\r\n  im40.setAttribute({ visible: false });\r\n  im41.setAttribute({ visible: false });\r\n  im42.setAttribute({ visible: false });\r\n  if (value === \"1\") {\r\n    premier=1;\r\n    im0.setAttribute({ visible: true });\r\n    im40.setAttribute({ visible: true });\r\n  } else if (value === \"2\") {\r\n    premier=2;\r\n    im0.setAttribute({ visible: true });\r\n    im41.setAttribute({ visible: true });\r\n  } else if (value === \"3\") {\r\n    premier=3;  \/\/ automate \r\n    im42.setAttribute({ visible: true });\r\n    im01.setAttribute({ visible: true }); \/\/ image sp\u00e9ciale du d\u00e9\r\n    select1.innerHTML= \"\\\\(\\\\textrm{Choix automatique}\\\\)\";\r\n    select1.setAttribute(\"data-value\",\"\");\r\n    MathJax.typesetPromise();\r\n  }\r\n  board4.update();\r\n  board1.update();\r\n}\r\n\r\nvar t44 = board4.create('text',[15,1,'\\\\(\\\\textrm{Joue en premier}\\\\)'],{fixed:true,strokeColor:'navy'});\r\nvar t45 = board4.create('text',[8,4,'\\\\(\\\\textrm{Nb de confrontations par partie}\\\\)'],{fixed:true,strokeColor:'navy'});\r\n\r\n\/\/ boutons de controle \r\nconst im50 = board4.create('image', ['.\/personnalisation\/images\/start.png', [-3,3], [1.5,1.5]],{anchorX:'middle',anchorY:'middle',shadow:true,visible:true});   \r\nconst im51 = board4.create('image', ['.\/personnalisation\/images\/pause.png', [0,3], [1.5,1.5]],{anchorX:'middle',anchorY:'middle',shadow:true,visible:true});\r\nconst im52 = board4.create('image', ['.\/personnalisation\/images\/stop.png', [3,3], [1.5,1.5]],{anchorX:'middle',anchorY:'middle',shadow:true,visible:true});   \r\n\/\/ debut de la gestion du jeu \r\n\r\nim50.on(\"up\",function() {\r\n  game_start(); \r\n});\r\nim51.on(\"up\",function() {\r\n  game_pause();\r\n});\r\nim52.on(\"up\",function() {\r\n  game_stop();\r\n});\r\n\r\n\r\n\r\n\r\nconst checkbox0 = board4.create('checkbox', [-4.5, 0,'\\\\(\\\\,\\\\,\\\\,\\\\textrm{Explications}\\\\)'], {fixed:true,highlight:true});\r\n\/\/const checkbox1 = board4.create('checkbox', [1, 4,'\\\\(\\\\,\\\\,\\\\,\\\\textrm{Jeu Face \u00e0 Face}\\\\)'], {fixed:true,highlight:true,checked:true});\r\n\/\/const checkbox2 = board4.create('checkbox', [1, 2,'\\\\(\\\\,\\\\,\\\\,\\\\textrm{Tournoi Round-Robin}\\\\)'], {fixed:true,highlight:true});\r\n\/\/const checkbox3 = board4.create('checkbox', [1, 0,'\\\\(\\\\,\\\\,\\\\,\\\\textrm{Tournoi par \u00c9limination directe}\\\\)'], {fixed:true,highlight:true});\r\n\/\/ const hrefbox3 = board4.create('text', [1, 0,'<a href=\"https:\/\/spgoo.org\/?page_id=10751\">\\\\(\\\\,\\\\,\\\\,\\\\textrm{Tournoi par \u00c9limination directe}\\\\)<\/a>'], \r\n\/\/\t\t\t\t\t\t   {fixed:true,highlight:true,mathJax:false});\r\n\r\n\/* === FEN\u00caTRE D\u2019EXPLICATIONS (AXELROD) === *\/\r\n\r\n\/\/ Contenu HTML avec texte + images\r\nconst explanations = {\r\n  \"Axelrod\": `\r\n    <h3 style=\"color:#AE181E; text-align:center; margin-top:0;\">Robert Axelrod \u2013 Les tournois du dilemme du prisonnier<\/h3>\r\n    <p>\r\n      Dans les ann\u00e9es 1980, Robert Axelrod organisa deux c\u00e9l\u00e8bres tournois informatiques\r\n      pour \u00e9tudier la coop\u00e9ration entre strat\u00e9gies dans le dilemme du prisonnier it\u00e9r\u00e9.\r\n    <\/p>\r\n    <p>\r\n      Le r\u00e9sultat marquant fut la victoire de <b>Tit for Tat<\/b> (\u0153il pour \u0153il),\r\n      d\u00e9montrant que la bienveillance, la r\u00e9ciprocit\u00e9 et la clart\u00e9 favorisent la coop\u00e9ration.\r\n    <\/p>\r\n    <div style=\"text-align:center;\">\r\n      <img decoding=\"async\" src=\".\/axelrod.jpg\" alt=\"Robert Axelrod\" style=\"width:120px; border-radius:10px; margin:8px;\">\r\n      <img decoding=\"async\" src=\".\/dilemme.png\" alt=\"Diagramme du dilemme\" style=\"width:160px; margin:8px;\">\r\n    <\/div>\r\n    <p style=\"font-style:italic; text-align:center;\">\r\n      \u00ab La coop\u00e9ration peut \u00e9merger m\u00eame dans un monde d\u2019individus \u00e9go\u00efstes. \u00bb\r\n    <\/p>\r\n  `\r\n};\r\n\r\n\/\/ === Cr\u00e9e une fen\u00eatre flottante superpos\u00e9e au-dessus du board4  ===\r\nconst expDiv = document.createElement(\"div\");\r\nexpDiv.id = \"explicationsBoard\";\r\nexpDiv.setAttribute(\"class\",\"explicationsBoard\");\r\ndocument.body.appendChild(expDiv);\r\n\r\n\/\/ Afficher \/ cacher au clic sur la checkbox\r\ncheckbox0.rendNodeCheckbox.addEventListener('change', function() {\r\n  const isChecked = this.checked;\r\n  if (isChecked) {\r\n    expDiv.innerHTML = explanations[\"Axelrod\"];\r\n    expDiv.style.display = \"block\";\r\n    if (window.MathJax?.typesetPromise) MathJax.typesetPromise([expDiv]);\r\n  } else {\r\n    expDiv.style.display = \"none\";\r\n  }\r\n});\r\n\/\/ Double clic sur la fen\u00eatre \u2192 la fermer\r\nexpDiv.addEventListener('dblclick', () => {\r\n  expDiv.style.display = \"none\";\r\n  checkbox0.rendNodeCheckbox.checked = false;\r\n});\r\n\r\n\r\n\/\/ === Cr\u00e9ation de la fen\u00eatre de commentaire (overlay) ===\r\n(function createCommentOverlay(){\r\n  if (document.getElementById('commentBoard')) return; \/\/ \u00e9vite doublons\r\n  const cb = document.createElement('div');\r\n  cb.id = 'commentBoard';\r\n  cb.setAttribute(\"class\",\"commentBoard\");\r\n  \/\/ contenu (un container HTML simple, pas de JSXGraph \u00e0 l'int\u00e9rieur)\r\n  const contentUser1 = document.createElement('div');\r\n  contentUser1.id = 'commentBoardContentUser1';\r\n  contentUser1.style.lineHeight = '1.4';\r\n  contentUser1.style.fontSize = '14px';\r\n  contentUser1.innerHTML = ''; \/\/ rempli plus tard\r\n  cb.appendChild(contentUser1);\r\n  document.body.appendChild(cb);\r\n  \/\/ ferme au double-clic (sur la div enti\u00e8re)\r\n  cb.addEventListener('dblclick', (ev) => {\r\n    ev.stopPropagation();\r\n    cb.style.display = 'none';\r\n  });\r\n  \/\/ emp\u00eacher la fermeture si on clique *dans* la fen\u00eatre\r\n  cb.addEventListener('click', (ev) => ev.stopPropagation());\r\n  \/\/ fermer \u00e0 \u00c9chap\r\n  document.addEventListener('keydown', (ev)=> {\r\n    if (ev.key === 'Escape') cb.style.display = 'none';\r\n  });\r\n\r\n})();\r\n\r\n\/\/ === Fonction qui affiche le commentaire ===\r\nfunction showCommentOverlay(strategyKey) {\r\n  const entry = comments[strategyKey];\r\n  if (!entry) return;\r\n  const cb = document.getElementById('commentBoard');\r\n  const content = document.getElementById('commentBoardContentUser1');\r\n  if (!cb || !content) return;\r\n  const headerHTML = `<div style=\"color:#b30000;font-weight:700;margin-bottom:6px;font-size:15px;\">${entry.title}<\/div>`;\r\n  const parasHTML = entry.text.map(p => `<div style=\"margin-bottom:8px;\">${p}<\/div>`).join('');\r\n  content.innerHTML = headerHTML + parasHTML;\r\n  cb.style.display = 'block';\r\n  if (window.MathJax && MathJax.typesetPromise) {\r\n    MathJax.typesetPromise([content]).catch((err)=>console.warn('MathJax error', err));\r\n  }\r\n}\r\n  \r\n  \/\/ chargement des droplists \r\n  const charge_structure=function(user, strateg) {\r\n      const zone=document.getElementById(\"droplist-\"+user);\r\n      \/\/ on ajoute les items dans la liste correspondante\r\n      Object.keys(tableau_strategies).forEach(groupe=> {\r\n        \/\/ on affiche le nom du groupe des strat\u00e9gies \r\n        const div_groupe=document.createElement(\"div\"); \r\n        div_groupe.setAttribute(\"class\",\"droplist-groupe\");\r\n        div_groupe.setAttribute(\"data-value\",groupe);\r\n        div_groupe.innerHTML=\"\\\\(\\\\textrm{\"+ groupe+ \"}\\\\)\";\r\n        zone.appendChild(div_groupe);\r\n        tableau_strategies[groupe].forEach(item=> {\r\n          const div_item=document.createElement(\"div\"); \r\n          div_item.setAttribute(\"class\",\"droplist-item\");\r\n          div_item.setAttribute(\"data-value\",item.key);\r\n          div_item.setAttribute(\"data-text\",item.text);\r\n          div_item.item=item;\r\n          div_item.innerText=\"\\\\(\\\\textrm{\"+item.text+ \"}\\\\)\";\r\n          zone.appendChild(div_item);\r\n          div_item.addEventListener(\"mouseover\", function(event) {\r\n              const value= this.getAttribute(\"data-value\");\r\n              showCommentOverlay(value);\r\n          })\r\n          div_item.addEventListener(\"mouseleave\", function(event) {\r\n              const value= this.getAttribute(\"data-value\");\r\n              \/\/ document.getElementById(\"commentBoard\").style.display=\"none\";\r\n          })\r\n          div_item.addEventListener(\"click\", function(event) {\r\n              const value= this.getAttribute(\"data-text\");\r\n              \/\/ on compl\u00e8te l'affichage \r\n              strateg.setText(value);\r\n              document.getElementById(\"commentBoard\").style.display=\"none\";\r\n          })\r\n\r\n        });\r\n      })\r\n      MathJax.typesetPromise(); \r\n  }\r\n  const charge_comportement_structure=function(lbl) {\r\n      const droplist = document.getElementById('myDroplist-'+lbl);\r\n      const selectedValue = document.getElementById('selectedValue-'+lbl);\r\n      \r\n      const header = droplist.querySelector('.droplist-header');\r\n      const arrow = droplist.querySelector('.droplist-arrow');\r\n      const list = droplist.querySelector('.droplist-list');\r\n      const items = droplist.querySelectorAll('.droplist-item');\r\n      \/\/ Ouvrir\/fermer la liste\r\n      header.addEventListener('click', () => {\r\n          list.classList.toggle('open');\r\n          arrow.classList.toggle('rotate');\r\n          header.classList.toggle('active');\r\n      });\r\n      \/\/ S\u00e9lectionner un \u00e9l\u00e9ment\r\n      items.forEach(item => {\r\n          item.addEventListener('click', (e) => {\r\n              e.stopPropagation();              \r\n              items.forEach(i => i.classList.remove('selected'));\r\n              item.classList.add('selected');\r\n              const mathContent = item.innerHTML;\r\n              const value = item.getAttribute('data-value');\r\n              selectedValue.innerHTML = mathContent;\r\n              selectedValue.setAttribute(\"data-value\",value);   \r\n              selectedValue.item=item.item; \/\/ pour recup\u00e8rer les infos complets sur la strategie\r\n\r\n              list.classList.remove('open');\r\n              arrow.classList.remove('rotate');\r\n              header.classList.remove('active');\r\n          });\r\n      });\r\n  }\r\n  charge_structure(\"User1\", Strateg1); \r\n  charge_structure(\"User2\", Strateg2);\r\n  charge_comportement_structure(\"User1\");\r\n  charge_comportement_structure(\"User2\");\r\n\r\n\/\/ ---------------------------------------------------------------------------\r\n\/\/ effectue un choix al\u00e9atoire dans la liste des strat\u00e9gies dans chaque serie \r\n\/\/ ---------------------------------------------------------------------------\r\nconst choix_strateg=function() {\r\n  \/\/ plusieurs series : 3 Premier tournoisn,s econd tournois et tournois uletrieurs \r\n  \/\/ on choisit parmis 3 la s\u00e9rie \r\n  let numserie = parseInt(Math.random()*0); \r\n  \/\/ et ensuite dans cette serie la strat\u00e9gie en fonction du nombre\r\n  const serie= Object.keys(tableau_strategies)[numserie];\r\n  const nb=tableau_strategies[serie].length;\r\n  const num_strateg= parseInt(Math.random()*nb);\r\n  return  tableau_strategies[serie][num_strateg];\r\n}\r\n\r\n  \/\/ variables d\u00e9di\u00e9es \u00e0 la gestion des parties  \r\n  let Game_encours=null; \r\n  let strateg1=null,strateg2=null;\r\n  let premier=1;\r\n\r\n  const select1=document.getElementById(\"selectedValue-User1\");\r\n  const select2=document.getElementById(\"selectedValue-User2\");\r\n  let histo1=[];\r\n  let histo2=[];\r\n  let declenche=null;\r\n  let fct1=null, fct2=null; \r\n\r\n  var choix1=\"T\";\r\n  var choix2=\"\";\r\n  let score1=0;\r\n  let score2=0;\r\n  let Cscore1=0, Cscore2=0;\r\n  let CptC1=0, CptT1=0;  \/\/ compteurs de C et de T pour user 1\r\n  let CptC2=0, CptT2=0; \/\/ compteurs de C et de T pour user 1 \r\n  let nb_pas=parseInt(i32.Value());\r\n  let pas_score=1\/nb_pas;\r\n  \/\/ ---------------------------------------------------\r\n  \/\/ gestion des parties: \r\n  \/\/ ---------------------------------------------------\r\n  const game_start=function() {\r\n    histo1=[];\r\n    histo2=[];\r\n    choix1=\"T\";\r\n    choix2=\"\";\r\n    score1=0;\r\n    score2=0;\r\n    Cscore1=0;\r\n    Cscore2=0;\r\n    CptC1=0, CptT1=0;\r\n    CptC2=0, CptT2=0;\r\n    \r\n    nb_pas=parseInt(i32.Value());\r\n    \/\/ on v\u00e9rifie si on a bien deux strat\u00e9gies choisies pour les joueurs \r\n    \/\/ qu'iol n'y a pas une partie en cours \r\n    \/\/ femme \r\n    strateg1=select1.getAttribute(\"data-value\");\r\n    \/\/ homme \r\n    strateg2=select2.getAttribute(\"data-value\");\r\n    if (Game_encours!=null)\r\n      alert(\"Attention une partie est d\u00e9j\u00e0 en cours\");\r\n    if (premier!=3 && (strateg1==null || strateg2==null)) {\r\n      alert(\"il faut d\u00e9finir les strat\u00e9gi\u00e9s de chaque joueur\");\r\n    }\r\n    if (premier==3 && strateg2==null) {\r\n      alert(\"il faut d\u00e9finir la strat\u00e9gie du joueur \");\r\n    }\r\n       \r\n    if (premier==1) {  \/\/ partie femme commence\r\n        fct1=select1.item.signature;\r\n        fct1=fct1.replace(\"choixAdv\",\"choix2\").replace(\"HistoAdv\",\"histo2\").replace(\"HistoMe\",\"histo1\");\r\n        fct2=select2.item.signature;\r\n        fct2=fct2.replace(\"choixAdv\",\"choix1\").replace(\"HistoAdv\",\"histo1\").replace(\"HistoMe\",\"histo2\");\r\n      } else if (premier==2) { \/\/ partie homme commence\r\n        fct1=select2.item.signature;\r\n        fct1=fct1.replace(\"choixAdv\",\"choix1\").replace(\"HistoAdv\",\"histo1\").replace(\"HistoMe\",\"histo2\");\r\n        fct2=select1.item.signature;\r\n        fct2=fct2.replace(\"choixAdv\",\"choix2\").replace(\"HistoAdv\",\"histo2\").replace(\"HistoMe\",\"histo1\");\r\n      } else { \r\n        \/\/ partie automatique choix random de l'automate\r\n        \/\/ c'est la machine qui joue en premier \r\n        const strategA= choix_strateg();\r\n        fct1=strategA.signature;\r\n        select1.innerHTML= \"\\\\(\\\\textrm{\"+strategA.key+\"}\\\\)\";\r\n        select1.setAttribute(\"data-value\",\"\");\r\n        \/\/ met \u00e0 jour la selecteur pour indiquer la strat\u00e9gie choisie \r\n        fct1=fct1.replace(\"choixAdv\",\"choix2\").replace(\"HistoAdv\",\"histo2\").replace(\"HistoMe\",\"histo1\");\r\n        fct2=select2.item.signature;\r\n        fct2=fct2.replace(\"choixAdv\",\"choix1\").replace(\"HistoAdv\",\"histo1\").replace(\"HistoMe\",\"histo2\");\r\n\r\n      }\r\n      console.log(\"fct1:\" ,  fct1);\r\n      console.log(\"fct2:\" ,  fct2);\r\n      declenche = setInterval(execute,200);\r\n\r\n  }\r\n  \r\n  let pas=0;\r\n  const resultat={\"C-T\":[0,5],\"C-C\":[3,3],\"T-T\":[1,1],\"T-C\":[5,0]}\r\n  function execute() {\r\n    pas_score=1\/nb_pas;\r\n    if (pas<nb_pas) {\r\n      if (premier==1 || premier==3) {\r\n          eval(\"choix1=\"+fct1);\r\n          histo1.push(choix1);\r\n          eval(\"choix2=\"+fct2);\r\n          histo2.push(choix2);\r\n          \/\/ calcul des scores score1 et score2 \r\n          [score1,score2]=resultat[choix1+\"-\"+choix2];\r\n          \/\/ calcul des cumuls Cscore1 et Cscore2\r\n          Cscore1+=score1;Cscore2+=score2;\r\n          score2_conf.setText(\"\\\\(\"+score2+\"\\\\)\"); \r\n          score1_conf.setText(\"\\\\(\"+score1+\"\\\\)\"); \r\n          score2_Cumul.setText(\"\\\\(\"+Cscore2+\"\\\\)\"); \r\n          score1_Cumul.setText(\"\\\\(\"+Cscore1+\"\\\\)\"); \r\n          if (choix1==\"C\")  {CptC1++;pc10_Glider.setGliderPosition(-0.25+CptC1*pas_score);}\r\n          if (choix1==\"T\")  {CptT1++;pc11_Glider.setGliderPosition(-0.25+CptT1*pas_score);}\r\n          if (choix2==\"C\")  {CptC2++;pc20_Glider.setGliderPosition(-0.25+CptC2*pas_score);}\r\n          if (choix2==\"T\")  {CptT2++;pc21_Glider.setGliderPosition(-0.25+CptT2*pas_score);}\r\n\r\n          MathJax.typesetPromise();\r\n        } if (premier==2) {   \/\/ cas homme en premier\r\n          chaine=\"choix2=\"+fct1;\r\n          eval(chaine); \r\n          circ10.setAttribute({\"opacity\":\"0.6\"});\r\n          histo2.push(choix2);        \r\n          chaine=\"choix1=\"+fct2;\r\n          eval(chaine);\r\n          circ20.setAttribute({\"opacity\":\"0.6\"});\r\n          histo1.push(choix1);\r\n          [score2,score1]=resultat[choix2+\"-\"+choix1];\r\n          Cscore1+=score1;Cscore2+=score2;\r\n          score2_conf.setText(\"\\\\(\"+score2+\"\\\\)\"); \r\n          score1_conf.setText(\"\\\\(\"+score1+\"\\\\)\"); \r\n          score2_Cumul.setText(\"\\\\(\"+Cscore2+\"\\\\)\"); \r\n          score1_Cumul.setText(\"\\\\(\"+Cscore1+\"\\\\)\"); \r\n          MathJax.typesetPromise();\r\n          if (choix1==\"C\")  {CptC1++;pc10_Glider.setGliderPosition(-0.25+CptC1*pas_score);}\r\n          if (choix1==\"T\")  {CptT1++;pc11_Glider.setGliderPosition(-0.25+CptT1*pas_score);}\r\n          if (choix2==\"C\")  {CptC2++;pc20_Glider.setGliderPosition(-0.25+CptC2*pas_score);}\r\n          if (choix2==\"T\")  {CptT2++;pc21_Glider.setGliderPosition(-0.25+CptT2*pas_score);}\t\t\t\r\n        } else { \/\/ contre la machine \r\n\r\n        }\r\n        pas++;\r\n    } else {\r\n      clearInterval(declenche);\r\n    }\r\n    \r\n  }\r\n\r\n\r\n  const game_pause=function() {\r\n    \/\/ on v\u00e9rifie que l'on a bienn une partie en cours \r\n    if (Game_encours==null)\r\n      alert(\"Veuillez d\u00e9marrer uine partie\");\r\n\r\n  }\r\n\r\n  const game_stop=function() {\r\n  \/\/ on v\u00e9rifie que l'on a bienn une partie en cours \r\n    circ10.setAttribute({\"opacity\":\"0.2\"});\r\n    circ20.setAttribute({\"opacity\":\"0.2\"});\r\n    score2_conf.setText(\"\\\\(0\\\\)\"); \r\n    score1_conf.setText(\"\\\\(0\\\\)\"); \r\n    score2_Cumul.setText(\"\\\\(0\\\\)\"); \r\n    score1_Cumul.setText(\"\\\\(0\\\\)\"); \r\n    \r\n    pc10_Glider.setGliderPosition(-0.25);\r\n    pc11_Glider.setGliderPosition(-0.25);\r\n    pc20_Glider.setGliderPosition(-0.25);\r\n    pc21_Glider.setGliderPosition(-0.25);\r\n    MathJax.typesetPromise();\r\n    pas=0;\r\n\r\n  }\r\n\r\n\r\n\r\n<\/script>\r\n\r\n\r\n\n\n<script type='text\/javascript'>\nvar id = \"10665\";<\/script>\n<script type='text\/javascript' src='https:\/\/spgoo.org\/wp-content\/uploads\/winp-css-js\/10665.js?ver=1761576421'><\/script>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-10669","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/pages\/10669","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/spgoo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10669"}],"version-history":[{"count":5,"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/pages\/10669\/revisions"}],"predecessor-version":[{"id":10857,"href":"https:\/\/spgoo.org\/index.php?rest_route=\/wp\/v2\/pages\/10669\/revisions\/10857"}],"wp:attachment":[{"href":"https:\/\/spgoo.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}