主题:求代写foxpro程式,付酬
kowloonfan
[专家分:0] 发布于 2008-08-24 01:25:00
Hi,我想找人代写foxpro程式。
是用来计算纸牌的概率,不太复杂。
我想到的是...程式公开,人人可以写,由一人整理。我会有报酬赞助给本论坛。
报酬以字数计。
不知道这个主意如何?请给些意见。
回复列表 (共9个回复)
沙发
wuzhouhong [专家分:10890] 发布于 2008-08-24 23:30:00
要求说来听听。
板凳
moz [专家分:37620] 发布于 2008-08-25 00:26:00
嗯,老姚已经不需要赞助了。
不过,不管报酬怎样,只要要求不过份,这里的高手如云,总会如你所愿的。
3 楼
kowloonfan [专家分:0] 发布于 2008-08-25 01:17:00
首先谢谢各位关注。
因为要做一些赌业研究报告,我需要一些程式,用来计算纸牌游戏概率
有一种叫[百家乐]的赌場纸牌游戏,是用8副52张的标准扑克纸牌
我需要做幾个程式,用来计算游戏的概率
1. 输入已出牌,计算概率,需要用上 combinatorial analysis
2. simulation program 统计各级概率分布
另外有一种叫[算牌,card counting]的方法,给每张牌一个固定值
3. 模拟,统计各级出牌总值与胜出率的关系。
其实我也有写这类模拟程式,但我是自学的,半桶水,也是古代foxpro2.6,写起来困难重重。也不懂
得combinatorial analysis,所以希望有能人士帮助。
4 楼
kowloonfan [专家分:0] 发布于 2008-08-25 01:22:00
这里有一个程式源
http://www.koniaris.com/math/baccarat/baccarat.lisp
;;; -*-Lisp-*-
(in-package :user)
(use-package :kgk)
;;; ----------------------------------------------------------------------
(defun make-shoe (decks)
(let* ((size (* decks 52))
(v (make-array size))
(index size)
(cards
(make-periodic
'(1 ; ace
2 3 4 5 6 7 8 9 0 ; 2 through 10
0 0 0))) ; :j, :q, :k
)
(dotimes (i size)
(setf (aref v i) (pop cards)))
#'(lambda (&optional shuffle)
(when (or shuffle (= index size))
(setf index 0)
(shuffle! v))
(unless shuffle
(prog1 (aref v index)
(incf index))))))
(defun sum (a b)
"Determine the value of a Baccarat hand (either two or three cards)"
(mod (+ a b) 10))
(defun trial (hit)
(let* ((p (sum (funcall hit) (funcall hit))) ; player
(d (sum (funcall hit) (funcall hit))) ; dealer (bank)
)
;; pick more cards unless one or both sides has a "natural"
(unless (or (>= p 8) ; a "natural" for the player
(>= d 8) ; a "natural" for the dealer
)
;; consider drawing a third card for the player
(let ((p3 nil))
(when (<= p 5)
(setf p3 (funcall hit))
(setf p (sum p p3)))
;; consider drawing a third card for the dealer
(when (if (null p3)
(<= d 5)
(or
(<= d 2)
(and (= d 3)
(/= p3 8))
(and (= d 4)
(<= 2 p3 7))
(and (= d 5)
(<= 4 p3 7))
(and (= d 6)
(<= 6 p3 7))))
(setf d (sum (funcall hit) d)))))
;; pick the winner
(cond ((= p d) :tie)
((< p d) :bank)
(t :player))))
(defun play-hands (&optional (n 10000000))
"Play a million hands of Baccarat and count the winners."
(let ((player-wins 0)
(bank-wins 0)
(tie 0)
(shoe (make-shoe 8)))
(dotimes (i n)
(ecase (trial shoe)
(:tie (incf tie))
(:bank (incf bank-wins))
(:player (incf player-wins))))
;; report the results
(values (float (/ bank-wins n))
(float (/ player-wins n))
(float (/ tie n)))))
;;; ----------------------------------------------------------------------
5 楼
kowloonfan [专家分:0] 发布于 2008-08-25 01:23:00
;;; ----------------------------------------------------------------------
(defun estimate-losses (&key
(commission 0.05)
;; these values came by running play-hands for 50M hands
(tie-return 9)
(p-bank 0.4586346)
(p-player 0.4461371)
(p-tie 0.0952283))
"Figure out the losses in Baccarat"
(labels ((note (situation &key (player-return 0) (bank-return 0) (tie-return 0))
(format t "Select ~A and lose ~A%.~&"
situation
(* 100 (+ (* p-bank bank-return)
(* p-player player-return)
(* p-tie tie-return))))))
(note "player" :player-return 1 :bank-return -1 :tie-return 0)
(note "bank" :player-return -1 :bank-return (- 1 commission) :tie-return 0)
(note "tie" :player-return -1 :bank-return -1 :tie-return tie-return)))
;;; ----------------------------------------------------------------------
***
6 楼
kowloonfan [专家分:0] 发布于 2008-08-27 20:21:00
高手都走了?
7 楼
moz [专家分:37620] 发布于 2008-08-28 15:24:00
哈哈,我也是用FOX2.6
自问不是高手,所以被你吓跑了.
8 楼
kowloonfan [专家分:0] 发布于 2008-08-28 23:07:00
大哥们可否将上面的程式翻译成foxpro?
9 楼
kowloonfan [专家分:0] 发布于 2008-09-12 18:27:00
呢十日来,我亦做了一部分功夫,由这里开始。。。
baccarat example
8 decks, 2 cards to player, 2 cards to banker (both first 2 cards only)
=> p1,p2,b1,b2
0000
0001
0002
...
0089
0099
...
0100
0101
0102
...
9989
9999
***
all=55*55=3025 groups
我来回复