| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

aide à la construction d'un prédicat ProLog

Page history last edited by denis 12 years, 11 months ago

Choisir un nom, des parametres : une signature 

 

Nom :

Paramètre 1 :

Paramètre 2 :

Paramètre 3 :

Paramètre 4 :

 

Choisir un/des cas de base

Nb de cas de base :

 

Choisir un/des cas de propagation

Nb de cas de propagation :

 

 

 

     Proposition de prédicat (à finaliser) :

 

output

 

 

 

 

Algo de production de la proposition précédente (pour les spécialistes JavaScript [éventuellement modifiable {c'est un wiki}]) :

 

var petitesListes = ['',['','[]','[E]','[E1,E2]'],['','[]','[F]','[F1,F2]'],['','[]','[G]','[G1,G2]'],['','[]','[K]','[K1,K2]']];

function construitPredicat() {

var nomFonction = document.getElementById("monInput").value;

var param1 = document.getElementById("monSelect1").selectedIndex;

var param2 = document.getElementById("monSelect2").selectedIndex;

var param3 = document.getElementById("monSelect3").selectedIndex;

var param4 = document.getElementById("monSelect4").selectedIndex;

var nbCasBase = document.getElementById("monSelectCasDeBase").selectedIndex;

var nbCasPropagation = document.getElementById("monSelectCasDePropagation").selectedIndex;

 

var textePredicat='';

var i=0;

for(i=1;i<nbCasBase+2;i++) {

  textePredicat += nomFonction+'(';

  if (param1==1) {textePredicat +='X'+i;} 

  else if (param1==2) {textePredicat += petitesListes[1][i];}

  if (param1 && param2) {textePredicat +=',';}

  if (param2==1) {textePredicat +='Y'+i;} 

  else if (param2==2) {textePredicat +=petitesListes[2][i];}

  if (param2 && param3) {textePredicat +=',';}

  if (param3==1) {textePredicat +='Z'+i;} 

  else if (param3==2) {textePredicat +=petitesListes[3][i];}

  if (param3 && param4) {textePredicat +=',';}

  if (param4==1) {textePredicat +='W'+i;}  

  else if (param4==2) {textePredicat +=petitesListes[4][i];}

  textePredicat +=').'

  textePredicat +='<br>';

  }

var i_=i;

for(var i=i_;i<(2*nbCasPropagation)+i_+2;i+=2) {

  textePredicat += nomFonction+'(';

  if (param1==1) {textePredicat +='X'+i;} 

  else if (param1==2) {textePredicat +='[E'+i+'|L'+i+']';}

  if (param1 && param2) {textePredicat +=',';}

  if (param2==1) {textePredicat +='Y'+i;} 

  else if (param2==2) {textePredicat +='[F'+i+'|M'+i+']';}

  if (param2 && param3) {textePredicat +=',';}

  if (param3==1) {textePredicat +='Z'+i;} 

  else if (param3==2) {textePredicat +='[G'+i+'|N'+i+']';}

  if (param3 && param4) {textePredicat +=',';}

  if (param4==1) {textePredicat +='W'+i;}  

  else if (param4==2) {textePredicat +='[K'+i+'|P'+i+']';}

  textePredicat +='):-'

  textePredicat += nomFonction+'(';

  if (param1==1) {textePredicat +='X'+(i+1);} 

  else if (param1==2) {textePredicat +='L'+i;}

  if (param1 && param2) {textePredicat +=',';}

  if (param2==1) {textePredicat +='Y'+(i+1);} 

  else if (param2==2) {textePredicat +='M'+i;}

  if (param2 && param3) {textePredicat +=',';}

  if (param3==1) {textePredicat +='Z'+(i+1);} 

  else if (param3==2) {textePredicat +='N'+i;}

  if (param3 && param4) {textePredicat +=',';}

  if (param4==1) {textePredicat +='W'+(i+1);}  

  else if (param4==2) {textePredicat +='P'+i;}

  textePredicat +=').'

  textePredicat +='<br>';

  }

document.getElementById("monOutput").innerHTML=textePredicat;

}

 

construitPredicat(); // pour lancement lors de l'affichage de la page

//pour les autres lancements : il y a des évènements déclencheurs de construitPredicat() sur les éléments de saisie.

 

Comments (0)

You don't have permission to comment on this page.