[Jprogramming] "Red or Black" game simulation
David Mitchell
davidmitchell at att.net
Thu Apr 7 22:31:23 HKT 2011
For Linux, the fact that both fork_jtask_ and spawn_jtask_ wait for task
completion seems to be a known bug.
The only way I can find to start an asynchronous task in Linux is:
2!:1 'gedit &'
David Mitchell
On 4/7/2011 9:41, Devon McCormick wrote:
> Hi -
>
> I had a similar problem with "fork" a couple of months ago but it seems to
> have gone away (in Windows).
>
> I have noticed other oddities with fork since then, like a forked process
> sends some of its input back to the the parent window and some verb
> definitions seem to disappear after I fork off a process but I haven't
> nailed down the circumstances under which this happens.
>
> My definition of "fork_jtask_" looks like this:
>
> 3 : 0
> 0 fork y
> :
> ph=. CreateProcess y
> if. x do. Wait ph;x end.
> CloseHandle ph
> empty''
> )
>
> Does that match yours?
>
> Regards,
>
> Devon
>
> On Thu, Apr 7, 2011 at 8:46 AM, Aai<bradypus at xs4all.nl> wrote:
>
>> Hi Devon,
>>
>> I tried to run this interesting example in Linux. So far I had to change:
>>
>> JEXE (of course) into:
>>
>> JEXE=: jpath '~/j701/bin/jconsole '
>>
>> and the template line
>>
>> 'ni nspi'=. y [ sttime=. 6!:1 '' [ 9!:1] '''{randseed}''' [ max=.
>> 2147483647
>>
>> into
>>
>> 'ni nspi'=. y [ sttime=. 6!:1 '' [ 9!:1] {randseed} [ max=. 2147483647
>>
>> But
>>
>> fork JEXE, xflnm
>>
>> waits until finished.
>>
>> The results are ok, e.g. (params template: 10 1e5):
>>
>> 10 100000 1.45187e9 1.88214e9
>> 7.80354e8 2.0112e9 2.00163e9 6.42693e8
>> 26.5 38.5 30.0349 1.90047
>> 26.5 37.5 30.0383 1.89869
>> 26.5 37.5 30.0376 1.89592
>> 26.5 37.5 30.053 1.90099
>> 26.5 38 30.0373 1.89206
>> 26.5 38 30.0314 1.89761
>> 26.5 38 30.0401 1.89232
>> 26.5 39 30.0375 1.90335
>> 26.5 38 30.0446 1.8974
>> 26.5 38 30.0443 1.89716
>> 2.14314e9 8.169e8 1.30083e9 40.0226
>>
>>
>> What do I need to know to let 'fork xxxxx' be executed without waiting
>> until done?
>>
>> Tested also
>> fork 'kwrite'
>>
>> with the same result: wait until exit 'kwrite'.
>>
>> JVERSION
>> Engine: j701/2011-01-10/11:25
>> Library: 7.01.048
>> Platform: Linux 32
>> Installer: j701a_linux32.sh
>>
>>
>>
>>
>> TIA
>>
>>
>> Hallo Devon McCormick, je schreef op 04-04-11 06:24:
>>> I've posted some work I've done recently on calculating the score
>> obtained
>>> by using a simple strategy in the "Red or Black" game about which there
>> was
>>> some traffic on the forum a month or so ago:
>>>
>> http://www.jsoftware.com/jwiki/NYCJUG/2011-04-12/RedOrBlackGameSimulation .
>>>
>>
>> --
>> Met vriendelijke groet,
>> =@@i
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
>
More information about the Programming
mailing list