[Jprogramming] Minority Game
Miller, Raul D
rdmiller at usatoday.com
Tue Oct 10 00:03:42 HKT 2006
Alistair Tucker wrote:
> Don't know if any of you have come across the minority game before?
I have not.
So, I spent some very brief time at
http://www.unifr.ch/econophysics/minority/
but I think I'll need some time to digest all the issues (and I'm
not sure I have that time free).
> 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?
Using " is perfectly hunky-dory, except where it's unnecessary.
> 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?
Yes, with some (hopefully trivial) loss of efficiency.
For example:
bid1=: 3 :0
'a q'=. y
p=. q - ({: a) * (#. 0.5 * 1 + * }: (- >: M) {. a) { R
b=. (p i. " 1 0 >./ " 1 p) { " 0 1 (#. 0.5 * 1 + * (- M) {. a) { R
(a , (+/ b) % %: N); p
)
Then replace
(bid ^: (2 ^ 14)) A
with
(bid1 ^: (2^14)) A;p
Or, even better, replace p with P here (to avoid confusion
between the local and global p).
There are even more functional ways of doing this, but I should
study what you are doing before I make any further suggestions.
> 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 :)
Then allow me to point you at the 13 :'expression in x and y'
translator, which lets you write tacit code without requiring
you understand tacit code. (Hypothetically, you should use
it as a tool for learning tacit code, but either way: have fun!)
--
Raul
More information about the Programming
mailing list