in step 2, can you tell us what J sees as the y argument for 1 command and 2+ 
commands?

it sounds like the output of that function the full sequence of moves? (using 
cached previous moves)?


----- Original Message -----
From: Brian Schott <[email protected]>
To: Programming forum <[email protected]>
Cc: 
Sent: Saturday, March 22, 2014 11:38:09 AM
Subject: Re: [Jprogramming] jhs webgl array_buffer

First the good news. Joe's idea to use alldata.push(row); to '...push the
single row to a javascript array...' works fine, except that only after
much head scratching I discovered I needed .concat in addition to .push for
turtle paths, (not for turtle avatars).

The bad news is pretty devastating. I cannot think of a way to deal with
user entries in the text field that combine multiple turtle moves/turns.
Only the first move or turn is reflected in the immediate visible result
and the system seems to think for an unduly long time.

To explain the issue, I will outline the current processing sequence of
tgsjhs, the app. ***I can think of no way to cycle repeatedly through steps
(2) to (5) when there are embedded multiple turtle moves/turns. ***

(0) The user entersĀ  a 'command' which is a turtle move or turn (and if not
for my problem, other commands with embedded multiple turns or moves). A
typical single command is `fd 20` to move the turtle(s) forward 20 steps.

(1) That 'command' is sent via js's
ev_command_enter(){jdoajax(["command"],"");} to jhs.

(2) The command is processed in jhs to produce a new or incumbent turtle
heading/position vectors and a new or incumbent turtle path.

(3) The produced vectors and paths are sent back to js by paint's jhrajax.

(4) Js receives the vectors and paths in ev_command_enter_ajax(row)

(5) The collected vectors and paths are processed by the drawing js
function draw(), which populates the canvas using webgl.

(6) The web page awaits more user inputs.

For example, there is a defined conjunction, repeats, as follows. The verb
v might be `fd` from above in a silly example to repeatedly move fd in
steps, rather than all at once.

NB. enable one-liner turtle movement sequences
repeats=: conjunction define
for. i. m
do. v y
end.
:
for. i. m
do. x v y
end.
)

Surely this can be done with minimal user knowledge of the problem. But I
cannot figure out how. Help would be appreciated.

Thank you,



>> Yes, I didn't spend the time to modify the example, but you can
>> certainly just push the single row to a javascript array
>>
>> Something like:
>>
>> var alldata=[]
>> function ev_command_enter_ajax(row)
>> alldata.push(row);
>> for(var i = 0; i < alldata.length; i++) {
>> ts = alldata[i]
>>
>> //draw logic for a single row
>> }
>>
>>
>
>
-- 
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to