Hi people
Don't know if any of you have come across the minority game before?
This is my first J program, and much to my surprise it seems to work!
I do have a couple of questions though:
I have used quite a few rank conjunctions " in here, I wonder is that perfectly 
hunky-dory or does it mean that I have set it up badly?
Also the central function 'bid' modifies global variable p on each iteration, 
which doesn't strike me as being very 'functional'.  Is there a better way to 
deal with this?
I'm quite liking J!  The best thing is that anyone looking over my shoulder 
won't have the faintest idea what I'm doing, and I can pretend it's something 
to do with work :)
Ali

N =: 4097                                NB. number of agents
M =: 5                                    NB. length of history
S =: 2                                    NB. strategies per agent

R =: _1 + 2 * ? ((2 ^ M) , N , S) $ 2    NB. strategy look-up tables (frozen 
disorder)
p =: +/ _0.5 + ? (12 , N , S) $ 0        NB. initial performance figures 
(approximately Gaussian)
A =: +/ _0.5 + ? (12 , M + 1) $ 0        NB. initial time sequence 
(approximately Gaussians)

bid =: 3 : 0
p =: p - ({: y) * (#. 0.5 * 1 + * }: (- >: M) {. y) { R
b =. (p i. " 1 0 >./ " 1 p) { " 0 1 (#. 0.5 * 1 + * (- M) {. y) { R
y , (+/ b) % %: N
)

L =: (_160 + i. 320) % 4
U =: (_159 + i. 320) % 4
cum =: 3 : '+/ (y > " 0 1 L) *. (y < " 0 1 U)'

load 'plot'
plot (0.5 * L + U) ; cum (bid ^: (2 ^ 14)) A

www.see.eclipse.co.uk





                
___________________________________________________________ 
The all-new Yahoo! Mail goes wherever you go - free your email address from 
your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to