Source

hello / misc / fjKick.rnn

Full commit
break
reset
clear
run 200
wait

output out[25];
const SPEED = 10;
const ANGLE = 0;
#var a(1) = 1; a := 1*a;
var one(1) = 1; one := 1*one;
var neuron(1) = 0 ; neuron := 1*neuron-0.39793*one;
var inJoy3; inJoy3 := SPEED*one; # 20 is the current speed
var bb; bb:= 1.2*inJoy3;

circuit swtk0 { var addC; addC := 1*::neuron + 0.0 *::one; var y1; y1 := 8*(-1<)addC; var y2; y2:= -1*(0>)y1; var y3; y3:= 1*(1>)y2; var y4(0.1)=0; y4:= 1*y3; var y; y:= 1 * y4; } #
# fjKick.rnn
circuit swtk1 { var addC; addC := 1*::neuron + 0.16 *::one; var y1; y1 := 6*(-1<)addC; var y2; y2:= -1*(0>)y1; var y3; y3:= 1*(1>)y2; var y4(0.1)=0; y4:= 1*y3; var y; y:= 1 * y4; } #
circuit swtk1a { var addC; addC := 1*::neuron + 0.3 *::one; var y1; y1 := ::inJoy3*(-1<)addC; var y2; y2:= -1*(0>)y1; var y3; y3:= 1*(1>)y2; var y4(0.1)=0; y4:= 1*y3; var y; y:= 1 * y4; } #
circuit swtk1b { var addC; addC := 1*::neuron + 0.32 *::one; var y1; y1 := ::bb*(-1<)addC; var y2; y2:= -1*(0>)y1; var y3; y3:= 1*(1>)y2; var y4(0.1)=0; y4:= 1*y3; var y; y:= 1 * y4; } #
circuit swtk1c { var addC; addC := 1*::neuron + 0.4 *::one; var y1; y1 := 6*(-1<)addC; var y2; y2:= -1*(0>)y1; var y3; y3:= 1*(1>)y2; var y4(0.1)=0; y4:= 1*y3; var y; y:= 1 * y4; } #
circuit swtk2 { var addC; addC := 1*::neuron + 0.45 *::one; var y1; y1 := 6*(-1<)addC; var y2; y2:= -1*(0>)y1; var y3; y3:= 1*(1>)y2; var y4(0.1)=0; y4:= 1*y3; var y; y:= 1 * y4; } #
circuit swtk3 { var addC; addC := 1*::neuron + 0.68 *::one; var y1; y1 := 8*(-1<)addC; var y2; y2:= -1*(0>)y1; var y3; y3:= 1*(1>)y2; var y4(0.1)=0; y4:= 1*y3; var y; y:= 1 * y4; } #


#GET INPUT from user application============================= 
#var KikSpeed; KikSpeed := 5*inJoy[3];
var KikSpeed; KikSpeed := 5*inJoy3;

#var KickYaw;  KickYaw  := 1*inJoy[1];
var KickYaw;  KickYaw  := ANGLE*one;
var YawFlag; YawFlag := -1*one;
#var YawFlag; YawFlag := 1*one - if(KickYaw< 0)2*one;

var khhh; khhh := -19*YawFlag;
var khhh2; khhh2 := 2 * khhh;
const kOneLift = 20;
const kOneLift2 = 40;

var addKickj1;   addKickj1:=  0*one +4*::swtk0::y -4*::swtk3::y;
var addKickj11; addKickj11:=  0*one; # +4*::swtk3::y-4*::swtk6::y;

var Kick1; Kick1 := -khhh*::swtk0::y+khhh*::swtk3::y;

var KikSpeed1; KikSpeed1 := 0.8*KikSpeed;
var KikSpeed2; KikSpeed2 := 0.2*KikSpeed;
var KikSpeed3; KikSpeed3 := 0.9*KikSpeed;
#_______________________
var Kick2; Kick2 := -kOneLift*::swtk1::y
+KikSpeed1*::swtk1::y-KikSpeed*::swtk1a::y+KikSpeed2*::swtk1c::y+kOneLift*::swtk2::y
;

#_______________________
var Kick3; Kick3 := kOneLift2*::swtk1::y
-KikSpeed3*::swtk1b::y+KikSpeed3*::swtk1c::y-kOneLift2*::swtk2::y
;
#_______________________
var Kick4; Kick4 := -kOneLift*::swtk1::y
+KikSpeed1*::swtk1b::y-KikSpeed1*::swtk1c::y+kOneLift*::swtk2::y
;


var Kick7_1; Kick7_1 := -1*::swtk1::y +1*::swtk3::y;
var Kick7; Kick7 := 1*Kick7_1;

var collis1; collis1 := 0.7*inJoy3;
var collis2; collis2 := 2*collis1;

var Inertia4; Inertia4 := 0.3*::swtk1b::y-0.3*::swtk3::y;
var KickAddJ0;   KickAddJ0  := KickYaw*::swtk1::y-KickYaw*::swtk1c::y;
var KickAddJ1;KickAddJ1:= 1*Kick1-if(YawFlag>0)1*addKickj11-if(YawFlag<0)1*addKickj1;
var KickAddJ2;   KickAddJ2  := 1*Kick2-collis1*::swtk1::y+collis1*::swtk1c::y;
#var KickAddJ2;   KickAddJ2  := -collis1*::swtk1::y+collis1*::swtk1c::y;


var KickAddJ3;   KickAddJ3  := 1*Kick3+collis2*::swtk1::y-collis2*::swtk1c::y;
var KickAddJ4;   KickAddJ4  := 1*Kick4 +inJoy3*Inertia4-collis1*::swtk1::y+collis1*::swtk1c::y;
var KickAddJ5;   KickAddJ5  := -1*Kick1;
var KickAddJ6;   KickAddJ6  := -1.2*Kick2; #1*Kick6;
var KickAddJ7;   KickAddJ7  := inJoy3*Kick7;
var KickAddJ10;   KickAddJ10  := 0*one;
#var KickAddJ10;  KickAddJ10 := 15*::swtk1::y-15*::swtk1a::y+0*::swtk2::y;
var KickAddJ11;  KickAddJ11 := 1*Kick1+if(YawFlag<0)1*addKickj11+if(YawFlag>0)1*addKickj1;
#var KickAddJ11;  KickAddJ11 := 1* KikSpeed;
var KickAddJ12;  KickAddJ12 := 0*one;
var KickAddJ13;  KickAddJ13 := 0*one;
var KickAddJ14;  KickAddJ14 := 0*one +inJoy3*Inertia4;
var KickAddJ15;  KickAddJ15 := -1*Kick1;
var KickAddJ16;  KickAddJ16 := 1.2*Kick2; #1*Kick16;
var KickAddJ17;  KickAddJ17 := -1*KickAddJ7;

out[0] := 0 * one;
out[1] := 1.0 * KickAddJ1;
out[2] := -20 * one + 1 * KickAddJ2;
out[3] := 40 * one + 1* KickAddJ3;
out[4] := -20 * one + 1* KickAddJ4;
out[5] := 1.0* KickAddJ5;
out[6] := 90 * one + 1* KickAddJ6;
out[7] := -10*one+1* KickAddJ7;
out[8] := 10*one ;
out[9] := -25 * one;
out[10] := 1* KickAddJ10;
out[11] := 1.0* KickAddJ11;
out[12] := -20 * one + 1* KickAddJ12;
out[13] := 40 * one + 1* KickAddJ13;
out[14] := -20 * one + 1* KickAddJ14;
out[15] := 1.0* KickAddJ15;
out[16] := 90 * one + 1* KickAddJ16;
out[17] := 10.0 * one + 1* KickAddJ17;
out[18] := -10 * one;
out[19] := -25 * one;
out[20] := 0 * one;


#run 10000
#wait