Mon 05 Jul 2010 06:12:39 AM UTC, comment #1:
I have included my modified fish.c program that does this.
feel free to use it as you wish.
I added the "-o" flag.
If you do not use it, it calculates your odds of having a specific type of hand. Pair, Trips, Straight, etc.
If you use the "-o" option, it computes the odds of one of the opponents on the table having a specific type of hand.
So, if you type:
fish -o 7 -d ac -d ks 3c 4c jc kd 2c
You are specifying that your hold cards of Ac and Ks are deleted when the odds are calculated. the -o 7 specifies there are 7 opponents playing at the table.
Note: This code requires the use of the c function pow. You need to modify the Makefile to have the following:
fish$(EXEEXT): $(fish_OBJECTS) $(fish_DEPENDENCIES)
@rm -f fish$(EXEEXT)
$(LINK) $(fish_LDFLAGS) $(fish_OBJECTS) $(fish_LDADD) $(LIBS) -lm
Notice the -lm ??? this will link in the math library from which you can get the pow function.
Also, copy your fish.c to fish.c.backup to make sure you can get it back when you need it.
Now copy my fish.c over the top of your fish.c
Now you should ( I hope ) be able to do a make.
When you get done, use the code and make sure it works.
To make sure you are running the code you just compiled, type:
./fish -o 7 -d ac -d ks 3c 4c jc kd 2c
If this works, I suggest you copy fish to your ~/bin directory.
One gotcha is you have to do:
mkdir ~/bin/.libs
cp ./.libs/fish ~/bin/.libs
cp ./.libs/lt-fish ~/bin.libs
pain in the butt that took me a while to figure out.
For your information the file ~/fish is a wrapper.
The file ~/.libs/fish is the executable.
I don't know what the file ~/.libs/lt-fish is, but things don't work if it isn't there.
have fun
(file #9434)
|