<%@ Language=VBScript %><% option explicit %> <% Response.Buffer = FALSE %> <% '--- plan_adv.asp --- DIM ScreenWidth, ScreenHeight DIM timeout, SID DIM msg '-- for errors DIM prey_values, prey1_values DIM pred_values, pred1_values, diag_values DIM pred_angles, pred1_angles DIM prey_dist 'distance covered per 0.1 time unit DIM pred_dist DIM keyTimes1, kT1, duration1 DIM aAngle(10), a_Pred, aA, a1, a2 DIM a_x(12), x_Prey, x_Pred, x_Diag, x1, x2 DIM a_y(12), y_Prey, y_Pred, y_Diag, y1, y2 DIM i1, Step1 DIM comma1, semiColon1, space1 DIM polyLine1 DIM opt_A, opt_B DIM action '' extend the timeout to allow for long files ' timeout = Server.ScriptTimeout '' Response.Write "Initial timeout=" & timeout & "
" ' Server.ScriptTimeout = 1200 ' SID = Request.Cookies("Humble")("SID") '------------------------------------------------------------------------- IF NOT Request.QueryString("Submitted") = "true" THEN '------------------------------------------------------------------------- action = "plan_adv.asp?submitted=true" %> Rainer's research on evolution, skills, and language comprehension


Determining the optimum attribtes for each inidividual in the population

<% opt_A=90 opt_B=90 %>
> <% IF Len(msg) > 0 THEN %> <% END IF %>
Please select the single location in the attribute space that represents the optimal combination of attribute values
<%=msg%>
Optimal attributes: A = <% Response.Write "" %> Opt_B = <% Response.Write "" %>
Distance by triangulation of each individual from the optimal point
<% Response.End '----------------------------------------------------------- '------------------------------------------------------------------------- ELSE '------------------------------------------------------------------------- ' Response.ContentType = "image/svg+xml" %> <% ScreenWidth = Request.Cookies("Humble")("ScreenWidth") ScreenHeight = Request.Cookies("Humble")("ScreenHeight") opt_A = Trim(Request.Form("Opt_A")) opt_B = Trim(Request.Form("Opt_B")) ' Response.Cookies("Humble")("Opt_A")=opt_A * 10 ' Response.Cookies("Humble")("Opt_B")=opt_B * 10 prey_dist = 120 pred_dist = 169.7 'SQRT( 120^2 + 120^2) comma1 = ", " semiColon1 = "; " space1 = " " prey_values = "" pred_values = "" pred_angles = "" diag_values = "" keyTimes1 = "" '"0;.1;.2;.3;.4;.5;.6;.7;.8;.9;1;" ' diag_values = "0,1200;120,1080;240,960;360,840;480,720;600,600;720,480;840,360;960,240;1080,120;1200,0;" y_Prey = 0 duration1 = "10s" polyLine1 = "" FOR i1 = 0 TO 14 IF i1=0 THEN '--- on entry, find direction to prey --- x_Prey = 0 'initial value: 0,0 x_Pred = 0 'initial value: 0,1200 y_Pred = 1200 a_Pred = 0 'x_Prey = x_Pred, y_Prey << y_Pred x_Diag = 0 y_Diag = 1200 prey_values = prey_values & x_Prey & comma1 & y_Prey & semiColon1 pred_values = pred_values & ROUND(x_Pred,1) & comma1 & ROUND(y_Pred,1) & semiColon1 polyLine1 = polyLine1 & ROUND(x_Pred,1) & space1 & ROUND(y_Pred,1) & comma1 pred_angles = pred_angles & ROUND(a_Pred,3) & semiColon1 diag_values = diag_values & x_Diag & comma1 & y_Diag & semiColon1 ' a_x(i1) = x1 ' a_y(i1) = y1 ' aAngle(i1) = a1 '--- on exit, changes in prey and predator locations --- x_Prey = x_Prey + 120 x_Pred = 0 'move toward initial x_Prey y_Pred = y_Pred - pred_dist x_Diag = x_Diag + 120 y_Diag = y_Diag - 120 ELSEIF y_Diag >= 120 THEN '--- on entry, find direction to prey from entry positions --- a_Pred = ATN( (x_Prey-x_Pred) / y_Pred) 'angle to position prey_values = prey_values & x_Prey & comma1 & 0 & semiColon1 pred_values = pred_values & ROUND(x_Pred,0) & comma1 & ROUND(y_Pred,0) & semiColon1 polyLine1 = polyLine1 & ROUND(x_Pred,1) & space1 & ROUND(y_Pred,1) & comma1 pred_angles = pred_angles & ROUND(a_Pred,3) & semiColon1 diag_values = diag_values & x_Diag & comma1 & y_Diag & semiColon1 '--- on exit, changes in prey and predator locations --- x_Prey = x_Prey + 120 x2 = SIN( a_Pred) * pred_dist y2 = COS( a_Pred) * pred_dist x_Pred = x_Pred + x2 'new value y_Pred = y_Pred - y2 x_Diag = x_Diag + 120 y_Diag = y_Diag - 120 Step1 = i1 ELSEIF x_Pred > x_Prey THEN EXIT FOR ELSEIF (y_Pred - y_Prey) < 10 THEN prey_values = prey_values & x_Prey & comma1 & 0 & semiColon1 pred_values = pred_values & ROUND(x_Pred,0) & comma1 & ROUND(y_Pred,0) & semiColon1 polyLine1 = polyLine1 & ROUND(x_Pred,1) & space1 & ROUND(y_Pred,1) & comma1 pred_angles = pred_angles & ROUND(a_Pred,3) & semiColon1 diag_values = diag_values & x_Diag & comma1 & y_Diag & semiColon1 x_Prey = x_Prey + 120 x_Pred = x_Pred + pred_dist 'new value Step1 = i1 ELSE '--- on entry, find direction to prey from entry positions --- a_Pred = ATN( (x_Prey-x_Pred) / y_Pred) 'angle to position prey_values = prey_values & x_Prey & comma1 & 0 & semiColon1 pred_values = pred_values & ROUND(x_Pred,0) & comma1 & ROUND(y_Pred,0) & semiColon1 polyLine1 = polyLine1 & ROUND(x_Pred,1) & space1 & ROUND(y_Pred,1) & comma1 pred_angles = pred_angles & ROUND(a_Pred,3) & semiColon1 diag_values = diag_values & x_Diag & comma1 & y_Diag & semiColon1 '--- on exit, changes in prey and predator locations --- x_Prey = x_Prey + 120 x2 = SIN( a_Pred) * pred_dist y2 = COS( a_Pred) * pred_dist x_Pred = x_Pred + x2 'new value y_Pred = y_Pred - y2 Step1 = i1 END IF NEXT keyTimes1 = keyTimes1 & 0 & semiColon1 FOR i1 = 1 TO Step1 keyTimes1 = keyTimes1 & ROUND(i1/Step1,3) & semiColon1 NEXT ' set it up for a graph bounding box of 2000 horizontal by 1000 vertical ' the viewBox has to be larger, to allow for left (and right?) parameter stuff ' the graph should have 20 by 10 internal dividers (grid pattern) %> <%'------------------- title --------------------------------%> Predator chasing prey, using the shortest path based on prediction line of sight from the predator to the prey prey: <%=prey_values%> straight line from the predator to the predicted position of the prey pred: <%=pred_values%> pred: <%=diag_values%> times: <%=Step1%> " - " <%=keyTimes1%> angles: <%=pred_angles%> <%'----------------- headings ------------------------------------%> Prey Predator <%'--------------- prey circle and lines with arrows ---------------------------%> <%'--------------- predator circle on diagonal line ---------------------------%> <%'--------- predator circle on direct chase, no lag, no prediction ---------------------------%> <%'------------------- diagonal line --------------------------%> <%'------------------- curved line for no prediction --------------------------%> <%'---------------------------------------------------------------------%> <% END IF '' reset the timeout ' Server.ScriptTimeout = timeout '-----------------------------------------------------------%>