|
From: Ben Bacarisse on 4 May 2008 10:29 "Rickey" <rickey.brooks(a)comcast.net> writes: > What turned me off about your statements then was your > seemingly distain for my desire to try and come up with a strategy to > improve my odds at roulette. Misunderstandings can be particularly troublesome on Usenet so permit me to step in with some terms. To most people with a background in statistics and probability, the "odds" are determined by the rules (and possibly the physics) of the game you play. Thus you can't change your odds except by moving to a casino with either different rules (one 0 rather than two, for example) or to one with a wheel that behaves differently. The term you want is "expectation". Every betting strategy has an expected return (mostly negative). You want a program whose input is a strategy and whose output is some measure of the expected return (given some basic assumptions such as a fair wheel, independent outcomes from each spin, etc.). I say "some measure" because there are basically two ways to do this. A clever program could simply tell you the expected return by "doing the maths". The other way would be to run a number of simulations and report a summary of the results, most probably the mean of the returns. A better measure would be a graph or table showing the mean and spread of the returns You obscured this, to some extent, in your original posts by concentrating on patterns of bet targets (red-red, vs, red-black for example) rather then stressing the full betting pattern. Any strategy that has return X when the bets are all on reds, will have the same X expected return when the bets are placed alternately on red and black. The simulation part (if that is the method chosen) is relatively simple. The interesting part is designing an input specification for representing strategies. To allow full generality, I'd be tempted to have the strategy encoded in the program source, but that then removes the interesting design part! -- Ben.
From: Malcolm McLean on 4 May 2008 12:52 "Ben Bacarisse" <ben.usenet(a)bsb.me.uk> wrote in message > The simulation part (if that is the method chosen) is relatively > simple. The interesting part is designing an input specification for > representing strategies. To allow full generality, I'd be tempted to > have the strategy encoded in the program source, but that then removes > the interesting design part! > Take a look at MiniBasic. It was designed for a job like this. -- Free games and programming goodies. http://www.personal.leeds.ac.uk/~bgy1mm
From: Malcolm McLean on 4 May 2008 13:34 "Rickey" <rickey.brooks(a)comcast.net> wrote in message > > Would it be possible for me to take the pseudo-language you have layed out > and work to build it in one of the visual-oriented languages, such as C or > Basic? Assuming I had the time, would it be worth my while to try it? It is impossible to beat a fair roulette wheel (over the long term, of course). However you can beat a biased wheel. #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { int list[1024]; int N; } RLLIST; void reset(RLLIST *rl) { rl->list[0] = 1; rl->list[1] = 2; rl->list[2] = 3; rl->list[3] = 4; rl->N = 4; } int stake(RLLIST *rl) { int answer; if(rl->N == 1) answer = rl->list[0]; else answer = rl->list[0] + rl->list[rl->N-1]; return answer; } int liquidate(RLLIST *rl) { int answer = 0; int i; for(i=0;i<rl->N;i++) answer += rl->list[i]; return answer; } void lose(RLLIST *rl) { if(rl->N == 1) { rl->N = 0; } else { rl->N -= 2; memmove(&rl->list[0], &rl->list[1], rl->N * sizeof(int)); } } void addwinnings(RLLIST *rl, int amount) { rl->list[rl->N] = amount; rl->N++; } int empty(RLLIST *rl) { if(rl->N == 0) return 1; else return 0; } static int list[36] = {32,15,19,4,21,2,25,17,34,6,27,13,36,11,30,8,23,10,5,24,16,33,1,20,14,31,9,22,18,29,7,28,12,35,3,26}; int is_red(int num) { int i; for(i=0;i<36;i++) if(list[i] == num) break; return (i % 2) ? 0 : 1; } #define MAXSTAKE 1000 int main(void) { RLLIST red; RLLIST black; RLLIST even; RLLIST odd; RLLIST high; RLLIST low; int winnings =0; int loss = 60; int win; int i; int num; srand( time() ); reset(&red); reset(&black); reset(&even); reset(&odd); reset(&high); reset(&low); for(i=0;i<10000;i++) { /* you need to change this line to bias the wheel */ num = rand() % 37; if(num == 0) { num = rand() % 37; if(!is_red(num)) lose(&red); if(is_red(num) || num == 0) lose(&black); if( (num % 2) == 1 || num == 0) lose(&even); if( (num % 2) == 0) lose(&odd); if(num <= 18) lose(&high); if(num > 18 || num == 0) lose(&low); } else { if(is_red(num)) { win = stake(&red); addwinnings(&red, win); lose(&black); } else { win = stake(&black); addwinnings(&black, win); lose(&red); } if( (num % 2) == 0) { win = stake(&even); addwinnings(&even, win); lose(&odd); } else { win = stake(&odd); addwinnings(&odd, win); lose(&even); } if(num <= 18) { win = stake(&low); addwinnings(&low, win); lose(&high); } else { win = stake(&high); addwinnings(&high, win); lose(&low); } } if(empty(&red)) { reset(&red); loss += 10; } if(empty(&black)) { reset(&black); loss += 10; } if(empty(&even)) { reset(&even); loss += 10; } if(empty(&odd)) { reset(&odd); loss += 10; } if(empty(&high)) { reset(&high); loss += 10; } if(empty(&low)) { reset(&low); loss += 10; } if(stake(&red) > MAXSTAKE) { winnings += liquidate(&red); reset(&red); winnings -= 10; } if(stake(&black) > MAXSTAKE) { winnings += liquidate(&black); reset(&black); winnings -= 10; } if(stake(&even) > MAXSTAKE) { winnings += liquidate(&even); reset(&even); winnings -= 10; } if(stake(&odd) > MAXSTAKE) { winnings += liquidate(&odd); reset(&odd); winnings -= 10; } if(stake(&high) > MAXSTAKE) { winnings += liquidate(&high); reset(&high); winnings -= 10; } if(stake(&low) > MAXSTAKE) { winnings += liquidate(&low); reset(&low); winnings -= 10; } printf("%5d: %d %d\n", i, loss, winnings); } winnings += liquidate(&red); winnings += liquidate(&black); winnings += liquidate(&even); winnings += liquidate(&odd); winnings += liquidate(&high); winnings += liquidate(&low); printf("Final loss %d win %d\n", loss, winnings); } Add some bias to the wheel and when the probability of the one of the even bets goes over 0.5, plus a bit to cover the losses on the other bets, the system comes up trumps. I'll leave it to you to find out if real wheels are sufficiently biased to make money on this. -- Free games and programming goodies. http://www.personal.leeds.ac.uk/~bgy1mm
From: Ben Bacarisse on 4 May 2008 14:17 "Malcolm McLean" <regniztar(a)btinternet.com> writes: > "Ben Bacarisse" <ben.usenet(a)bsb.me.uk> wrote in message >> The simulation part (if that is the method chosen) is relatively >> simple. The interesting part is designing an input specification for >> representing strategies. To allow full generality, I'd be tempted to >> have the strategy encoded in the program source, but that then removes >> the interesting design part! >> > Take a look at MiniBasic. It was designed for a job like this. I am sure it is a fine Basic, but why would one prefer it over, say, Python? Surely if one is free to choose, a modern language is likely to the edge. I don't favour modernity for its own sake but, in general, scripting languages have come a long way. Of course, MiniBasic is also modern, but you would not have called it xBasic (for some x) if it did not refer back to that old way of thinking in some way. [Personally, I'd use a function language for this. The strategies would be very simple to implement in ML, Scheme, Haskell etc. I mention Python because it seems to be the new Basic -- simple and easy to pick up yet capable of doing complex things.] -- Ben.
From: Malcolm McLean on 4 May 2008 14:27 "Ben Bacarisse" <ben.usenet(a)bsb.me.uk> wrote in message > > I am sure it is a fine Basic, but why would one prefer it over, say, > Python? > The interpreter is one, freely available C source file of about 3000 lines. It's much easier to integrate MiniBasic into another program than, say, a Python intepreter. -- Free games and programming goodies. http://www.personal.leeds.ac.uk/~bgy1mm
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: misc: how random is 'random'?... Next: Record stack back traces efficiently on space |