PDA

View Full Version : a greater challenge



ito
08-29-2006, 03:58 AM
hi jhon and everyone.

I was thinking about something...

if the code that you help me whith before, is replaced in a table (1 row 3 column ), is it possible to do a random code but now in a multi cell table such in this picture?

ito
http://www.5-elements.co.il/imgs/Uploads/random/multi.jpg

jscheuer1
08-29-2006, 05:01 AM
What picture?

ito
08-29-2006, 09:56 AM
sorry about that.
above you can see the picture again.

ito

jscheuer1
08-29-2006, 05:05 PM
No. Your picture shows 3 rows and 3 columns (not as you typed - 1 row 3 column). Other than that, the layout shown by your picture could be populated by a script similar to the one we were using for the simpler layout, yes.

What about the descriptions (card names)? In your image they are gone. Did you decide you didn't want these any longer, or did you simply not include them in the image?

BTW, this is starting to look like a Tarot layout, is that what you are going for?

Twey
08-29-2006, 05:29 PM
if the code that you help me whith beforeYou expect us to remember every question we answer? :-\

ito
08-29-2006, 06:51 PM
hi jhon.

i simply draw the pic with graphic software for the example.

you are right about the cause- its for tarot category i have in my newage website.

i'm trying for a long time to solve the code problem-and thanks to you,
it works great!!!!

i'm an autodidact, i'm trying to learn things my self for the web needs.

after we had succeed with the firt code i've been thinking about other table options.
i understand that is possible to do so.
i hope to learn to do so my self ,i wont need any help in the future.

is it making difficult for you to know that its for tarot cards,jhon?
is o.k with you to help me with this one too?

ito

ito
08-29-2006, 08:25 PM
sorry,
thats the code i was talking about :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
.cent td {
text-align:center;
}
</style>
<script type="text/javascript">
var check=[];

function populate(){
var ims, txt, cards=[];
cards[0]=["01.jpg", "1"];
cards[1]=["02.jpg", "2"];
cards[2]=["03.jpg", "3"];
cards[3]=["04.jpg", "4"];
cards[4]=["05.jpg", "5"];
cards[5]=["06.jpg", "6"];
cards[6]=["07.jpg", "7"];
cards[7]=["08.jpg", "8"];
cards[8]=["09.jpg", "9"];
cards[9]=["10.jpg", "10"];
cards[10]=["11.jpg", "11"];
cards[11]=["12.jpg", "12"];
cards[12]=["13.jpg", "13"];
cards[13]=["14.jpg", "14"];
cards[14]=["15.jpg", "15"];
cards[15]=["16.jpg", "16"];
cards[16]=["17.jpg", "17"];
cards[17]=["18.jpg", "18"];
cards[18]=["19.jpg", "19"];
cards[19]=["20.jpg", "20"];
cards[20]=["21.jpg", "21"];
cards[21]=["22.jpg", "22"];
cards[22]=["23.jpg", "23"];
cards[23]=["24.jpg", "24"];
cards[24]=["25.jpg", "25"];
cards[25]=["26.jpg", "26"];
cards[26]=["27.jpg", "27"];
cards[27]=["28.jpg", "28"];
cards[28]=["29.jpg", "29"];
cards[29]=["30.jpg", "30"];
cards[30]=["31.jpg", "31"];
cards[31]=["32.jpg", "32"];
cards[32]=["33.jpg", "33"];
cards[33]=["34.jpg", "34"];
cards[34]=["35.jpg", "35"];
cards[35]=["36.jpg", "36"];
cards[36]=["37.jpg", "37"];
cards[37]=["38.jpg", "38"];
cards[38]=["39.jpg", "39"];
cards[39]=["40.jpg", "40"];
cards[40]=["41.jpg", "41"];
cards[41]=["42.jpg", "42"];
cards[42]=["43.jpg", "43"];
cards[43]=["44.jpg", "44"];
cards[44]=["45.jpg", "45"];
cards[45]=["46.jpg", "46"];
cards[46]=["47.jpg", "47"];
cards[47]=["48.jpg", "48"];
cards[48]=["49.jpg", "49"];
cards[49]=["50.jpg", "50"];
cards[50]=["51.jpg", "51"];
cards[51]=["52.jpg", "52"];
cards[52]=["53.jpg", "53"];
cards[53]=["54.jpg", "54"];
cards[54]=["55.jpg", "55"];
cards[55]=["56.jpg", "56"];
cards[56]=["57.jpg", "57"];
cards[57]=["58.jpg", "58"];
cards[58]=["59.jpg", "59"];
cards[59]=["60.jpg", "60"];
cards[60]=["61.jpg", "61"];
cards[61]=["62.jpg", "62"];
cards[62]=["63.jpg", "63"];
cards[63]=["64.jpg", "64"];
cards[64]=["65.jpg", "65"];
cards[65]=["66.jpg", "66"];
cards[66]=["67.jpg", "67"];
cards[67]=["68.jpg", "68"];
cards[68]=["69.jpg", "69"];
cards[69]=["70.jpg", "70"];
cards[70]=["71.jpg", "71"];
cards[71]=["72.jpg", "72"];
cards[72]=["73.jpg", "73"];
cards[73]=["74.jpg", "74"];
cards[74]=["75.jpg", "75"];
cards[75]=["76.jpg", "76"];
cards[76]=["77.jpg", "77"];
cards[77]=["78.jpg", "78"];


cards.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter)

for (var i_tem = 0; i_tem < 3; i_tem++){
if (check[i_tem]&&cards[i_tem][1]==check[i_tem]){
ims=cards[i_tem+3][0];
txt=cards[i_tem+3][1];
}
else {
ims=cards[i_tem][0];
txt=cards[i_tem][1];
}
document.getElementById('layout').rows[0].cells[i_tem].innerHTML='<img src="'+ims+'">';
document.getElementById('layout').rows[1].cells[i_tem].innerHTML=txt;
check[i_tem]=txt;
}
}
onload=populate;
</script>
</head>
<body>
<p align="center">
<input type="button" value="deal" onclick="populate();">
</p>
<p align="center">
<table id="layout">
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="cent">
<td></td>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>

ito
08-30-2006, 12:09 AM
i ment the firts table we worked with...

jscheuer1
08-30-2006, 06:16 AM
Well, it can be worked out, and if you want to learn for yourself, I'd suggest looking for patterns in what we did in each version and taking a guess or two at what might come next for your new layout. Also, if there are terms in the code that you do not understand, try searching for them using Google.

I will also try putting this together myself when I get more time. I found a nice 54 card standard playing card deck (including 2 Jokers) that is in the public domain and have been fooling around with different ideas with it. I'm curious, are your Tarot card images in the public domain as well?

To answer your question about Tarot, I am a gifted somewhat in the occult art/sciences but, am highly skeptical about their ultimate value. However, as long as the practitioner has good intentions, to be helpful to people above other considerations, the results usually aren't that bad. I have seen many situations where too much is read into the cards or whatever is being used. People always may exercise free will and there is no such thing as fate as regards what the cards, signs or omens reveal. I have also seen where a practitioner's own fears, needs, expectations, etc. color readings to the disservice of his/her clients. I had to learn all this myself as well as the broader, often unpleasant, matter of client and practitioner projection. I've, as a result, chosen to help others mostly in more concrete ways and to confine my work with people's life choices mostly to attempts at drawing them out and exposing themselves to themselves for self inspection.

ito
08-30-2006, 07:22 AM
hi john.

i was pleased to read that you have some conection to the unknown.
i agree with you that there is a lot of manipulation in this area,but we have to remember that the card wisdom was achieved by an ancient experience some centuries ago,and survived since then.something i think we can't despise.

yet, the responsibility of the cards explanations, is ours.

in my web i let the surfers ask questions, and be answered by a proffetional person, for free....

i can lead you to the adress of the tarot page you've been helpping me with,but i doubt if you will understand the language...

about the new patterns.
well , i've tried to play with the code that you gave me- without any success i may say.
it turns out that 1 row its not enough to learn the javascript language, especially in multi table case.
also, i dont know what to ask yet in google.
it was difficult enough for me to find you...(:

how can i built a table (3r 3c)what are the rules?...

but, it was satisfied to know that its possible.

i think that you were the only one that gave me a complete code for my needs.
evreybody else i asked till i met you,gave me parts of code;that's why it took so long for me.

anyhow, you have my gratitude for that.

i'll try to mannage some how.

nice to meet some one so faraway from you...

thanks,

ito.

ito
08-31-2006, 11:16 PM
i was trying to use your clues without any success.
i also went to look out for websites but didn'nt find what i was looking for.

i give up.

could you give me a clue?

how could i build a new table from the code that i have?
how can i define the row and the column of the table and than give the random order with a button?

ito.

jscheuer1
09-01-2006, 04:09 AM
http://home.comcast.net/~jscheuer1/side/cards/cards_II_auto_t.htm

ito
09-01-2006, 05:42 AM
hi john.

thank you very much for your help.

just for beginning...is it possible to take of the reload thing?

ito

jscheuer1
09-01-2006, 06:47 AM
just for beginning...is it possible to take of the reload thing?

There is no reload thing. What do you mean by 'take of', is that supposed to be 'take off'?

If you mean, "Take off the preload thing." Yes but, the images, if not preloaded, will not show up at first, unless this is only meant to be run locally.

If you mean the bit where the cards are in motion as soon as they appear, yes, that can be easily changed to a fixed layout.

Could you please be more precise.

ito
09-01-2006, 09:45 AM
sorry about that.
i ment take off - of course

what i need is :
1.when the page reload the cards wont be shown.
i want it to be like the first layout we worked with.one time reload.
2.about the preload card - i dont want the cards to bo shown befor dealing.
3.i dont need the shuffle thing.
4.i tried to replace the cards with other deck with out success-how could i replace them?

if its not hard for you ,thank you for your help.

ito.

ito
09-04-2006, 10:02 PM
hi john.

i tried and tried but without any success...

how could i change the cards to another deck.

the deck that shown is with 55 card, and my deck is with 78 cards...
and more...
after i'm saving the table,it shows that something is loading but it stuck in the middle of the process.

what should i do?

thanks for your help,

ito

jscheuer1
09-04-2006, 11:06 PM
I've actually been fooling around with this and have a better version now. It displays only the backs of the cards at first, until the 'deal' button is clicked and is a bit better documented. I was going to make configuration of the images simpler by adding comments explaining how this is done but, haven't gotten around to that yet. When I do, I will publish here or alert you here of the new demo.

For now though, it would probably be of help to explain what this bit is about:


for (var i_tem = 1; i_tem < 55; i_tem++)
cards[i_tem-1]=[i_tem+'.png', 'card '+i_tem]

If you look in the code just a bit above that part you will see that I have already declared cards as an array by doing this:


cards=[]

Now, what the for loop does is assume certain things about the names of the card images. In this case, it assumes all of them have the extension of .png and that the filename is simply a number from 1 to 54 inclusive. So this works for images named 1.png, 2.png, 3.png, . . . 54.png - see? All it is doing is writing out the array. You could manually code the array if you want to, like so:


cards[0]=['1.png', 'card 1'];
cards[1]=['2.png', 'card 2'];

and so on. In fact, you can substitute a long list of this type of array items definitions for the two lines of loop code if your cards images filenames are each more unique than can be dealt with in this manner, or if you just can't be bothered envisioning how to automatically generate the array for your particular purposes.

ito
09-05-2006, 07:56 AM
hi john.

i tried to play with the code as you wrote.
i dafined 8 cards in .png format- and nothing happen,the page is not reloaded...
i'm waiting impatiently for your new version....

the changes i did in the code are this-what is wrong ? :
----------------------------------------------------------------
var dealing, theDeal, thePause, auto=1, check=[];

function populate(){
var ims, txt, cards=[];
for (var i_tem = 1; i_tem < 8; i_tem++)
cards[i_tem-1]=[i_tem+'.png', 'card '+i_tem]

cards=[];
cards[0]=['01.png','card 01'];
cards[1]=['02.png','card 02'];
cards[2]=['03.png','card 03'];
cards[3]=['04.png','card 04'];
cards[4]=['05.png','card 05'];
cards[5]=['06.png','card 06'];
cards[6]=['07.png','card 07'];


cards.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)

thePause=auto? 250 : 500;
for (var i_tem = 0; i_tem < 5; i_tem++){
if (check[i_tem]&&cards[i_tem][1]==check[i_tem]){
ims=cards[i_tem+5][0];
txt=cards[i_tem+5][1];
}
else {
ims=cards[i_tem][0];
txt=cards[i_tem][1];
}
theDeal=setTimeout(new Function("document.getElementById('layout').rows["+cellar[i_tem][0]+"].cells["+cellar[i_tem][1]+"].innerHTML='<img src="+ims+">';document.getElementById('layout').rows["+[cellar[i_tem][0]+1]+"].cells["+cellar[i_tem][1]+"].innerHTML='<div>"+txt+"<\/div>';"), thePause*i_tem)
check[i_tem]=txt;
}
if(auto) {
dealing=setTimeout("populate()", thePause*5);
setTimeout("document.getElementById('layout').style.visibility='visible';", thePause*5);
}
}
</script>
</head>
<body>
<div id="imgDiv">
<script type="text/javascript">
for (var i_tem = 1; i_tem < 8; i_tem++)
document.write('<img src="'+i_tem+'.png">');
</script>

jscheuer1
09-05-2006, 10:18 AM
Get rid of the red parts:


function populate(){
var ims, txt, cards=[];
for (var i_tem = 1; i_tem < 8; i_tem++)
cards[i_tem-1]=[i_tem+'.png', 'card '+i_tem]

cards=[];
cards[0]=['01.png','card 01'];
cards[1]=['02.png','card 02'];
cards[2]=['03.png','card 03'];
cards[3]=['04.png','card 04'];
cards[4]=['05.png','card 05'];
cards[5]=['06.png','card 06'];
cards[6]=['07.png','card 07'];

and make sure that 01.png, 02.png, etc. exist.

ito
09-05-2006, 11:00 AM
i did it and still nothing happen...

the corection part of the code :
----------------------------------------------------------------
var dealing, theDeal, thePause, auto=1, check=[];

function populate(){
var ims, txt, cards=[];

cards[0]=['01.png','card 01'];
cards[1]=['02.png','card 02'];
cards[2]=['03.png','card 03'];
cards[3]=['04.png','card 04'];
cards[4]=['05.png','card 05'];
cards[5]=['06.png','card 06'];
cards[6]=['07.png','card 07'];

cards.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)

thePause=auto? 250 : 500;
for (var i_tem = 0; i_tem < 5; i_tem++){
if (check[i_tem]&&cards[i_tem][1]==check[i_tem]){
ims=cards[i_tem+5][0];
txt=cards[i_tem+5][1];
}
else {
ims=cards[i_tem][0];
txt=cards[i_tem][1];
}
theDeal=setTimeout(new Function("document.getElementById('layout').rows["+cellar[i_tem][0]+"].cells["+cellar[i_tem][1]+"].innerHTML='<img src="+ims+">';document.getElementById('layout').rows["+[cellar[i_tem][0]+1]+"].cells["+cellar[i_tem][1]+"].innerHTML='<div>"+txt+"<\/div>';"), thePause*i_tem)
check[i_tem]=txt;
}
if(auto) {
dealing=setTimeout("populate()", thePause*5);
setTimeout("document.getElementById('layout').style.visibility='visible';", thePause*5);
}
}
</script>
</head>
<body>
<div id="imgDiv">
<script type="text/javascript">
for (var i_tem = 1; i_tem < 8; i_tem++)
document.write('<img src="'+i_tem+'.png">');
</script>

jscheuer1
09-08-2006, 08:44 AM
I'm not sure where you got that code from exactly. You are missing several parts from any working version I posted. The script fragment you posted makes use of the cellar array to find the appropriate table cells but, it is missing from your code:


cellar=[];
cellar[0]=[0,1];
cellar[1]=[2,0];
cellar[2]=[2,1];
cellar[3]=[2,2];
cellar[4]=[4,1];

This must be defined before this part:


for (var i_tem = 0; i_tem < 5; i_tem++){
if (check[i_tem]&&cards[i_tem][1]==check[i_tem]){
ims=cards[i_tem+5][0];
txt=cards[i_tem+5][1];
}
else {
ims=cards[i_tem][0];
txt=cards[i_tem][1];
}
theDeal=setTimeout(new Function("document.getElementById('layout').rows["+cellar[i_tem][0]+"].cells["+cellar[i_tem][1]+"].innerHTML='<img src="+ims+">';document.getElementById('layout').rows["+[cellar[i_tem][0]+1]+"].cells["+cellar[i_tem][1]+"].innerHTML='<div>"+txt+"<\/div>';"), thePause*i_tem)
check[i_tem]=txt;
}

I don't see any style, most of the preload code is missing, and all of the table markup is absent. Also, when randomizing a tableau of of 5 cards with no repetition, more than 7 card images are required. I never imagined this would be used with so few cards. I think the minimum number would be 11.

ito
09-08-2006, 05:14 PM
hi jhon.

i just put a part of the code .

i wanted you to see the changes i did, reffers what you told me to do :

"Get rid of the red parts"-...thats what i did and nothing happen.

ito

jscheuer1
09-08-2006, 05:47 PM
Right, but I hadn't signed off on the rest of your code and, in retrospect, couldn't have as, so much was missing. What I did to find the problems was to try running your code. That's when the missing 'cellar' array and other items became obvious.

ito
09-08-2006, 07:13 PM
if so,what is your suggestion?

tell me and i'll do so.

do you want me to pass the whole code so you could check it out for me?

ito.

jscheuer1
09-10-2006, 08:10 AM
Well, I had hoped that you would learn enough in the process to use the newer script which I have now annotated fairly well:

http://home.comcast.net/~jscheuer1/side/cards/cards_II_auto_t_2.htm

It seems that instead, you are getting a little defensive. However, how should I know? Maybe you can take the above and run with it now. If you have any more questions, feel free to ask.