Welcome to Deadbeef.com
Articles and tips on software from authored by Jeremy Bettis.

Search

XML Feed RSS

What is RSS?

Who's Online?

  • Guest Users: 8

Yet Another Double Fanucci Calculator (YADFC) improved

06/14/10

Permalink 10:00:00 am, by Jeremy Email , 295 words, 1261 views   English (US)
Categories: Software, Java

Yet Another Double Fanucci Calculator (YADFC) improved

I'm embarrassed to admit it, but I have become quite attached to a web based game called Legends of Zork. It is slow, repetitive, and requires little skill. In other words it is just my game playing speed.

One of the puzzles in the game is to arrange your Double Fanucci cards to get the most points so that you can win more encounters. I found a very nice Java based calculator called Yet Another Double Fanucci Calculator. It works like a charm, but is it a bit slow, and the genetic algorithm doesn't always find an optimal solution.

I have profiled the program, and improved it in several ways.

  • I made the calculation run in the background with a cancel button. This way, if the calculation takes a long time, and you change your mind, you can cancel it and do something else.
  • I added a recursive calculator also. It always finds an optimal solution, but sometimes takes longer than the genetic algorithm.
  • I sped up the genetic algorithm.
  • I replaced several of the classes with optimized versions that take less memory, and run faster.
  • Hands are precalculated and saved to a file. So the second time you calculate your cards, the software only needs to consider any new cards you have added.

Download a runnable jar: yadfc-v2.3B-deadbeef.jar
Checkout the source code from svn: http://svn.deadbeef.com/double-fanucci/trunk

I'll keep this page up to date as new versions are released, post any issues to the comments here.

Update 6/14/2010

  • I added the ability to precalculate from the menu.
  • Fixed some bugs that were making the precalculated hands not read back from the file.
  • Fixed some bugs that prevented the recursive calc from working when you had a small number of cards.

Comments, Pingbacks:

Comment from: Joe [Visitor] Email
forgive me beeing a noob, but how do you run this program?
PermalinkPermalink 03/15/10 @ 08:21
Comment from: rajen [Visitor] Email · http://URL not found
Pl. give the download link again. not working.
PermalinkPermalink 06/14/10 @ 04:24
Comment from: Jason [Visitor] Email
My problem is that it seems to think that it needs to put stuff into my sidekicks.

Right now my Spirit is 7 with
Lamps-0 / Faces-0 / Faces-1

But it's telling me that I should put Bugs-0 / Clocks-0 for a total of 4 in Spirit and putting 3 into sidekicks.
Ran it several times and same results

Tried the original one, and it's giving me the correct 7...think i'm going with what the original says....
PermalinkPermalink 06/23/10 @ 15:25
Comment from: Jeremy [Member] Email · http://www.deadbeef.com
I just ran v2.3B and put in Bugs-0, Lamps-0, Time-0, Faces-0 & 1; 5 cards total. Then I selected Simulator->Run Recursive... and it gave me:

7: Lamp-0, Face-0, Face-1
4: Bug-0, Time-0

Seems right to me.
PermalinkPermalink 06/23/10 @ 17:32
Comment from: Jason [Visitor] Email
I dropped the ball on this. If i'd remember to check back I would have been able to send you the exact cards I had. I've gotten several more since, and don't know which ones i had at that time.
All i know is what I said, with what i had at the time (about 20 cards), it was giving me less Spirit than the original calc.
I've been running both whenever I've gotten a new card, and the #'s have been consistently the same on both.
I'll try experimenting and see if i can replicate it. (my luck, i wont)
PermalinkPermalink 07/01/10 @ 16:07
Comment from: Jason [Visitor] Email
Ok, tried something...on the original I set up several cards
0 bug
0 lamp
0 maze
0 hive
0-3 inkblot
0 ear
0-1 time
0 scythe
0 zurf
0 plunger
0-1 face

ran it 5 times. and Sidekick would change in the "Best solution"
1st time 0 scythe for a 2
2nd time 0 Lamp for a 2
3rd time 0 lamp AND 0 scythe for a *3*
4th time 0 Maze for a 2
5th time 0 lamp AND 0 scythe for a *3* again

and i just kept refreshing and kept happening...
Interestingly the Mind/Body/Spirit/Gambit values never changed. (8/8/4/28)
So, the original is definitely flawed.

Ran the same card combo on your version and always got the same result.

Now...if only i could figure out what i DID have that was giving me less spirit in yours :(
Oh well...guess it don't really matter.
PermalinkPermalink 07/01/10 @ 16:22
Comment from: Jason [Visitor] Email
Using your version

Copy and pasted the cards from Zork, so it don't mean I have the 6 face card, i have 0-5 for a total of 6....etc.

You currently own 30 Fanucci cards
Suit-faces 6
Suit-bugs 1
Suit-lamps 1
Suit-mazes 3
Suit-fromps 1
Suit-hives 1
Suit-inkblots 5
Suit-ears 2
Suit-time 4
Suit-scythes 1
Suit-zurfs 1
Suit-books 1
Suit-plungers 2
Suit-tops 1

Run using Genetic

This is with the standard options that comes with it.
Run 1: M-48/B-28/S-16/SK-10/FG-50
Run 2: M-48/B-28/S-16/SK-9/FG-50
Run 3: M-48/B-28/S-16/SK-9/FG-50
Run 4: M-48/B-28/S-16/SK-10/FG-50
Run 5: M-48/B-28/S-16/SK-10/FG-50
Mind, Body, Spirit, and Gambit never change #'s (tho the cards DO change a few times) and Sidekick floats from 9 to 10

Decided to up the ante and take a chance, so upped everything in the options because i have NO idea what they are and there's no manual :)
Pop Size 4096
Elitism Rate 100%
Mutation rate 100%
Iterations 512
Sets 5
Maxima 64

Run 1: M-46/B-28/S-18/SK-10/FG-49
Run 2: M-46/B-30/S-17/SK-10/FG-47
Run 3: M-47/B-28/S-16/SK-14/FG-48
Run 4: M-40/B-28/S-25/SK-10/FG-50
Run 5: M-39/B-29/S-27/SK-10/FG-50

Everything changed at least once

I also ran these tests with Recursive and got the various ones as well.
Honestly, don't know the difference between the 2...but don't seem to be any
PermalinkPermalink 07/01/10 @ 19:31
Comment from: Jeremy [Member] Email · http://www.deadbeef.com
The Genetic algorithm has some randomness in there. It picks a random starting point and hill-climbs to a solution. The Recursive algorithm, on the other hand, considers all cases and should come up with the same solution every time. Once the recursive one has proven to be stable and fast, I plan to delete the other.
PermalinkPermalink 07/06/10 @ 09:42
Comment from: Aquila76 [Visitor] · http://legendsofzork.com/heroes/359624-aquila76
This is great! Thanks for keeping this DFC project alive. Working great for me (68 cards).
PermalinkPermalink 07/17/10 @ 10:48
Comment from: Josh R [Visitor] Email
I'm sorry, but I'm confused here. When I found this site, I had already found and downloaded the YADFC program. I understand your intentions, but do not do any programming or development. When I downloaded your "runnable jar" the compressed file simply had three folders named "META-INF" "com" and "net" looking at the download there were no instructions included and it appeared if I looked at the source code, it did mot make it clear how this was set up, whether something needed to be compiled manually, if running the original JAW would do anything with the files, where those downloaded files should be (should they be placed with the original program in their folders or extracted differently) etc?

While I do have technical skills, program compilation and development are not two of them. If you'd gladly guide me and the other user Joe the visitor, could you advise us how we are to set up the program once we downloaded the compressed file. Then since I am familiar more with statistics and algorithms, perhaps my feedback will be more productive next post.
PermalinkPermalink 07/25/10 @ 02:30
Comment from: Josh R [Visitor] Email
D'OH! My download was tanslating it as a compressed .zip and manually downloading it as a jar fixed that. Wiping egg off my face and noticing no edit on the post site :)
PermalinkPermalink 07/25/10 @ 02:56

Leave a comment:

Your email address will not be displayed on this site.
Your URL will be displayed.

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
(Line breaks become <br />)
(Set cookies for name, email and url)
(Allow users to contact you through a message form (your email will NOT be displayed.))

July 2010
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

Categories

powered by
b2evolution