FIBS Board backgammon forum

Bots & other tech stuff => Other bots & tech stuff. => Topic started by: stog on March 10, 2009, 11:45:36 PM

Title: a non backgammon coding puzzle involving tarot cards
Post by: stog on March 10, 2009, 11:45:36 PM
A coding puzzle for someone.............http://www.fibsboard.com/tarot.php (http://www.fibsboard.com/tarot.php)

hi this is an experiment using the random image folder (used on the front page for images) - this time to provide a random tarot card reading-take with a pinch of salt though :) --

only problem is, i ended up in effect, using 10 packs of cards: ie duplicates will appear :) ....some work to do then!

for the computer literate among you - perhaps you could provide a solution - i would probably use filemaker where i could script a solution,

load card 1first from random, then card 2, also from random less whatever card 1 was (scripted as 'if card 1 =x, then don't use x for random card pool..etc

but i suspect there must be an elegant php or web java type solution....can you help? can we be bothered even:) it looks pretty though and the more of the those frightening cards that appear, the better methinks! (i should have been doing the cleaning today.............
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: playBunny on March 12, 2009, 02:14:35 AM
I don't understand the problem yet. Why are you "in effect, using 10 packs of cards"?
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: stog on March 12, 2009, 07:23:58 PM
i thought i could just have the 10 cards(from the 21 pack) represented by 10 random folders, forgetting that when the first one is chosen, my next choice is then from 20 cards. My random folder won't work with such unless i use "fields and scripting, and an ordered sequence....in php i  wouldn't know how to let the second card pack know which card had been chosen by the card 1 pack - if u get my drift.

in effect i must draw a random card from pack1 =card1, from pack2 draw a second card from a pack of 20 (sameas pack 1 but less the already chosen random card, and so on........

clear as mud :)
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: playBunny on March 16, 2009, 02:32:51 AM
clear as mud :)

Erm........ yes! ;)

Quote
can you help? can we be bothered even:)

It's not heading in the right direction ..... :laugh:
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: stog on March 16, 2009, 09:50:40 AM
10 cards are drawn, one at a time, from a 21 card pack. At present i can only produce random cards from a full pack (a folder of 21 cards).

so far in php/mysql, i cannot draw from subsequent diminishing packs..........in the 10 positions required..each postion needs a folder of cards ----hence the 10 packs.........

i could achieve  what i want from scripting using the software i am familiar with, but i wonder if it is possible to achieve using java, mysql/php?
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: spielberg on March 16, 2009, 11:01:24 AM
Given the speed PCs run it won't be optimal but it's a perfectly good solution just to do this with random numbers. Set up two arrays, one with your 21 cards in and one for your 10 selected cards. Pick a card at random from the first array. Check that card is not in the second array. If it isn't put it in , if it is pick another card. It's by no means an efficient solution but given modern computer speeds it's perfectly good and MUCH easier to code than selecting from a diminishing population.
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: stog on March 16, 2009, 11:14:32 AM
it's the auto setting up of 'recognising' an already chosen card, "checking that card is not in the second array" as you describe that i have no experience in - in this environment.

if anyone has any links to some scripts that do similiar stuff i'd be very interested.

my experience is with 'fields' where i can script 'if this is etc"  - i am unfortunately still learning this particular environment and mostly by trial/editing and augmentation of existing material..

thx anyhow :)

19/3/2009 hi
ive finally put together a solution - but it's a whopping 70mb for macos x
will upload a windows solution tomorrow -- now uploaded (11 mb)
links are at http://www.fibsboard.com/tarot.php (http://www.fibsboard.com/tarot.php)
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: stog on March 19, 2009, 02:41:36 PM
19/3/2009 hi
ive finally put together a desktop solution -windows is 11mb, but it's a whopping 70mb for macos x
links are at http://www.fibsboard.com/tarot.php (http://www.fibsboard.com/tarot.php)
oh and there are 22 cards, from which 10 are drawn.........
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: garp_02 on March 19, 2009, 05:17:15 PM
No offence - but may I ask why?
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: stog on March 19, 2009, 07:04:57 PM
:) u may...u r quite right..madness;

but i wanted to try an exercise to see if i could use some of the software which the board is built on and uses -- and then, when the need or occasion arose, we could perhaps have something new quirky or even interesting.

i actually produce desktop software and so i returned to the software i use to build my programs, that which i am happiest/ most familiar with, and have posted a link to the solution for any coders who might be interested.

i should still though really like for someone to point me to a mysql/php/javascript solution.
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: garp_02 on March 19, 2009, 11:27:32 PM
Sorry - thought it was some acary tarot thing :ohmy:
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: stog on March 19, 2009, 11:43:35 PM
i must admit that i had always had a sneaky desire to know more about the cards, and yes interpretation is everything, but if u take note of the advice on the site where i got the info (referenced on the page and in the prog) it can lead into an examination of someone's hopes and fears albeit by referencing the things vital and immediate to us all :) scary :)

anyhow i knew nothing about it a few days ago and now know a little bit ......
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: playBunny on March 22, 2009, 04:15:27 PM
i should still though really like for someone to point me to a mysql/php/javascript solution.

I could do you something in javascript with ease but I simply don't understand the problem as you describe it! You say that you write desktop software? What language do you use? Could you code a solution in that? Or just in pseudo code?
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: stog on March 22, 2009, 06:28:23 PM
pseudocode sounds good! i use filemaker! id love to see a javascript solution - helps me learn more. to see the problem --see the desktop solution only 11mblats in windose! thx :)
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: playBunny on March 29, 2009, 04:02:51 AM
I'm sorry, stog, but this is going nowhere. I've got no idea what Filemaker is and the 11mb solution is an exe file. I'm not going to install some program when all I'm asking for is a clear spec of the problem. :huh:
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: stog on March 29, 2009, 10:18:13 AM
don't worry yourself this was not a military exercise, although i am sure google would help with filemaker!
on a more serious note i see you are advertising a site with your avatar -- we prefer members ask before advertising and have at least donated to the cause ----.donate.php (http://www.fibsboard.com/donate.php)
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: playBunny on April 03, 2009, 03:05:01 PM
don't worry yourself this was not a military exercise, although i am sure google would help with filemaker!

That's not the point, stog. Is it reasonable that I should have to learn a new product and install an executable in order to understand what you are saying? I'm willing to help but am frustrated in that endeavour.

Quote
on a more serious note i see you are advertising a site with your avatar -- we prefer members ask before advertising and have at least donated to the cause ----.donate.php (http://www.fibsboard.com/donate.php)

I acknowledge the frustration that you also feel in being unable to avail yourself of my scripting expertise. Your seriousness about my avatar link is noted, as is your choice of when to express it.

That link has been there since I joined the forum and I've always considered it more a personal statement than advertising. As a person of extremely limited means (long story, wouldn't need exaggeration), donations are not possible. Removal of the link is, so at least we have one issue dealt with.
Title: Re: a non backgammon coding puzzle involving tarot cards
Post by: dropper on April 04, 2009, 11:09:45 AM
I recently made a spreadsheet that randomly shuffled the order of a list of names. I did it by creating a column with random numbers and a second column containing the names. Then I sort the array in order by the numbers in the first column. Something like that might work for you?
TinyPortal © 2005-2018