 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
PST Guest
|
Posted: Wed May 09, 2007 11:20 pm Post subject: java to vba |
|
|
bonjour
Est ce que quelqu'un sait traduire ce code en vba
merci
declare partial_results as structure of
min = array of numbers[ 4 ]; //min[0] is match in six numbers,
min[1] is match in five numbers, etc
max = array of numbers[ 4 ];
comboCount as number;
end declare
function main
declare final_results as list;
for each c=1,2,3,4,5,6 to 44,45,46,47,48,49 do
results = new partial_results;
for each d=(tickets being tested) do
match = how_many_numbers_match( c, d );
increment( results, match );
end for
similar = find_similar_results( final_results, results );
if similar is NULL then
add results to final_results;
else
add( results, similar );
end if
end for
//now the final_results list contains all data for the coverage report
//the following applies to each item in this list:
//"comboCount tested combinations produce min[0] to max[0] of
jackpot hits,
//and min[1] to max[1] of 'match 5' hits and min[2] to max[2] of
'match 4' hits
//and min[3] to max[3] of 'match 3' hits
end function
function increment( res as partial_results, match as number )
index_to_increment = 4 - (match-2); //reverse the match index to
have highest match at index '0'
min[ index_to_increment ] = min[ index_to_increment ] + 1;
max[ index_to_increment ] = max[ index_to_increment ] + 1;
comboCount = comboCount+1;
end function
function add( res1 as partial_results, res2 as partial_results )
res2.comboCount = res2.comboCount + res1.comboCount;
for i=0 to 3 do
if res1.min[ i ] < res2.min[ i ] then
res2.min[ i ] = res1.min[ i ];
end if
if res1.max[ i ] > res2.max[ i ] then
res2.max[ i ] = res1.max[ i ];
end if
end for
end function
function find_similar_results( list, results )
for each r=partial_results from the list do
for i=0 to 3 do
if results.max[ i ] > 0 then
if results.max[i] = r.max[ i ] then
return r;
else
break;
end if
else if r.max[ i ] > 0 then
break;
end if
end for
end for
return NULL;
end function |
|
| Back to top |
|
 |
Mihamina (R12y) Rakotoman Guest
|
Posted: Thu May 10, 2007 1:46 am Post subject: Re: java to vba |
|
|
PST - <4641f2b6$0$5065$ba4acef3 (AT) news (DOT) orange.fr> :
| Quote: | Est ce que quelqu'un sait traduire ce code en vba
|
1) Tu prends Usenet pour quoi?
2) C'est du Java ton "truc", là? |
|
| Back to top |
|
 |
PST Guest
|
Posted: Thu May 10, 2007 6:55 am Post subject: Re: java to vba |
|
|
1) Tu prends Usenet pour quoi? Precise
2) C'est du Java ton "truc", là? Je croyais
j'ai trouvé ce code j'en ai besoin, cherché des logiciel traducteurs pas
trouvé
Mihamina (R12y) Rakotomandimby a écrit :
| Quote: | PST - <4641f2b6$0$5065$ba4acef3 (AT) news (DOT) orange.fr> :
Est ce que quelqu'un sait traduire ce code en vba
1) Tu prends Usenet pour quoi?
2) C'est du Java ton "truc", là? |
|
|
| Back to top |
|
 |
giganet Guest
|
Posted: Thu May 10, 2007 7:13 am Post subject: Re: java to vba |
|
|
PST a écrit :
| Quote: | bonjour
Est ce que quelqu'un sait traduire ce code en vba
merci
declare partial_results as structure of
min = array of numbers[ 4 ]; //min[0] is match in six numbers,
min[1] is match in five numbers, etc
max = array of numbers[ 4 ];
comboCount as number;
end declare
function main
declare final_results as list;
for each c=1,2,3,4,5,6 to 44,45,46,47,48,49 do
results = new partial_results;
for each d=(tickets being tested) do
match = how_many_numbers_match( c, d );
increment( results, match );
end for
similar = find_similar_results( final_results, results );
if similar is NULL then
add results to final_results;
else
add( results, similar );
end if
end for
//now the final_results list contains all data for the coverage report
//the following applies to each item in this list:
//"comboCount tested combinations produce min[0] to max[0] of
jackpot hits,
//and min[1] to max[1] of 'match 5' hits and min[2] to max[2] of
'match 4' hits
//and min[3] to max[3] of 'match 3' hits
end function
function increment( res as partial_results, match as number )
index_to_increment = 4 - (match-2); //reverse the match index to
have highest match at index '0'
min[ index_to_increment ] = min[ index_to_increment ] + 1;
max[ index_to_increment ] = max[ index_to_increment ] + 1;
comboCount = comboCount+1;
end function
function add( res1 as partial_results, res2 as partial_results )
res2.comboCount = res2.comboCount + res1.comboCount;
for i=0 to 3 do
if res1.min[ i ] < res2.min[ i ] then
res2.min[ i ] = res1.min[ i ];
end if
if res1.max[ i ] > res2.max[ i ] then
res2.max[ i ] = res1.max[ i ];
end if
end for
end function
function find_similar_results( list, results )
for each r=partial_results from the list do
for i=0 to 3 do
if results.max[ i ] > 0 then
if results.max[i] = r.max[ i ] then
return r;
else
break;
end if
else if r.max[ i ] > 0 then
break;
end if
end for
end for
return NULL;
end function
|
Tu veux pas plutôt que ce soit traduit en Java?? |
|
| Back to top |
|
 |
Mihamina Rakotomandimby ( Guest
|
Posted: Thu May 10, 2007 12:47 pm Post subject: Re: java to vba |
|
|
PST wrote:
| Quote: | 1) Tu prends Usenet pour quoi?
Precise
|
Ok. Puisqu'il faut préciser.
- On ne répond ni au dessus, ni sur la meme ligne, mais en dessous, sans
tout citer. Lire: http://www.bisounours.org/usenet-fr/repondre.html#2
- On n'est pas là pour faire le boulot des autres, mais pour _discuter_.
La différence est subtile. Si tu cherches un traducteur "java to vba", tu
demande un traducteur, et non qu'on te traduise une portion de code.
| Quote: | 2) C'est du Java ton "truc", là?
Je croyais
|
Pour t'en convaincre, fais tourner le code en question sur _ta_ machine! |
|
| Back to top |
|
 |
Christophe Franco Guest
|
Posted: Thu May 10, 2007 4:49 pm Post subject: Re: java to vba |
|
|
PST <pgjignorez (AT) wanadoo (DOT) fr> wrote:
| Quote: | bonjour
Est ce que quelqu'un sait traduire ce code en vba
merci
|
Visiblement, ça vient de là :
http://mathforum.org/kb/plaintext.jspa?messageID=4492842
Ce n'est pas du Java, ce n'est même pas écrit dans un quelconque langage
de programmation, c'est du pseudo-code pour décrire l'algorithme ("The
algorithm in plain English [...]")
Si tu sais programmer en VBA, tu devrais être capable de réécrire cet
algorithme dans ce langage. Sans quoi, commence par apprendre VBA si
c'est dans ce langage que tu es obligé de programmer. En tout état de
cause, vu que cela n'a aucun lien avec Java, tu ne trouveras aucune aide
sur ce groupe. Adresse-toi à un groupe sur VBA éventuellement si tu as
besoin de conseils pour apprendre le langage.
--
Christophe Franco |
|
| Back to top |
|
 |
Lionel Guest
|
Posted: Thu May 10, 2007 5:31 pm Post subject: Re: java to vba |
|
|
Christophe Franco wrote:
| Quote: | Adresse-toi à un groupe sur VBA éventuellement si
tu as besoin de conseils pour apprendre le langage.
|
Faudrait pas polluer tous les groupes non plus, il a déjà multiposté dans:
- fr.comp.lang.javascript
- comp.lang.java.programmer
- microsoft.public.fr.excel
- microsoft.public.excel.misc
- microsoft.public.excel.programming |
|
| Back to top |
|
 |
TestMan Guest
|
Posted: Sun May 13, 2007 3:08 pm Post subject: Re: java to vba |
|
|
Lionel a écrit :
| Quote: | Christophe Franco wrote:
Adresse-toi à un groupe sur VBA éventuellement si
tu as besoin de conseils pour apprendre le langage.
Faudrait pas polluer tous les groupes non plus, il a déjà multiposté dans:
- fr.comp.lang.javascript
- comp.lang.java.programmer
- microsoft.public.fr.excel
- microsoft.public.excel.misc
- microsoft.public.excel.programming
|
Faut être partageur, il n'y a pas de raison que les autres groupes n'en
"profitent" pas aussi. Pas de jaloux comme ça, hein  |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|