//====================================================================/ // / // KK-Multi Agent Simulator for Java / // / //====================================================================/ Version = 1.0; //------------------------------------------------------- // Component Tree //------------------------------------------------------- UNIVERSE { Space Space_K(0,0),Square_2D(100, 100, Loop, North, 1){ AgtType Walker1(0, 0)[1] { Dim X(0, 0) As Double = (0.0); Dim Y(0, 0) As Double = (0.0); Dim Layer(0, 0) As Integer = (0); Dim Direction(0, 0) As Double = (0.0); Dim Speed(0, 0) As Double = (0.0); } AgtType Walker2(0, 0)[1] { Dim X(0, 0) As Double = (0.0); Dim Y(0, 0) As Double = (0.0); Dim Layer(0, 0) As Integer = (0); Dim Direction(0, 0) As Double = (0.0); Dim Speed(0, 0) As Double = (0.0); } AgtType Walker3(0, 0)[1] { Dim X(0, 0) As Double = (0.0); Dim Y(0, 0) As Double = (0.0); Dim Layer(0, 0) As Integer = (0); Dim Direction(0, 0) As Double = (0.0); Dim Speed(0, 0) As Double = (0.0); } AgtType Walker4(0, 0)[1] { Dim X(0, 0) As Double = (0.0); Dim Y(0, 0) As Double = (0.0); Dim Layer(0, 0) As Integer = (0); Dim Direction(0, 0) As Double = (0.0); Dim Speed(0, 0) As Double = (0.0); Dim Count(0, 0) As Integer = (0); } AgtType Walker5(0, 0)[1] { Dim X(0, 0) As Double = (0.0); Dim Y(0, 0) As Double = (0.0); Dim Layer(0, 0) As Integer = (0); Dim Direction(0, 0) As Double = (0.0); Dim Speed(0, 0) As Double = (0.0); } AgtType Walker6(0, 0)[1] { Dim X(0, 0) As Double = (0.0); Dim Y(0, 0) As Double = (0.0); Dim Layer(0, 0) As Integer = (0); Dim Direction(0, 0) As Double = (0.0); Dim Speed(0, 0) As Double = (0.0); Dim Destination(0, 0) As Integer = (0); } } } //------------------------------------------------------- // Agent Variable Initial Data //------------------------------------------------------- Initial_Value { } //------------------------------------------------------- // Agent Rule //------------------------------------------------------- #begin_rule UNIVERSE Univ_Init{ } Univ_Step_Begin{ } Univ_Step_End{ } Univ_Finish{ } #end_rule UNIVERSE //------------------------------------------------------- // Agent Rule //------------------------------------------------------- #begin_rule UNIVERSE.SPACE_K.WALKER1 Agt_Init{ // 初期設定をする My.X = 50 My.Y = 50 My.Direction = rnd()*360 My.Speed = rnd()*5 } Agt_Step{ // 前に進む Forward(My.Speed) // 速さを調節する If my.Speed>3 then my.Speed = my.Speed - 0.1 else my.Speed = my.Speed + 0.1 end if } #end_rule UNIVERSE.SPACE_K.WALKER1 //------------------------------------------------------- // Agent Rule //------------------------------------------------------- #begin_rule UNIVERSE.SPACE_K.WALKER2 Agt_Init{ // 初期設定をする My.X = 50 My.Y = 50 My.Direction = rnd()*360 My.Speed = rnd()*5 } Agt_Step{ // 前に進む Forward(My.Speed) // 回転方向を判断する If my.Speed > 2.5 then Turn(-10) else Turn(10) end if } #end_rule UNIVERSE.SPACE_K.WALKER2 //------------------------------------------------------- // Agent Rule //------------------------------------------------------- #begin_rule UNIVERSE.SPACE_K.WALKER3 Agt_Init{ // 初期設定をする My.X = 50 My.Y = 50 My.Direction = rnd()*360 My.Speed = rnd()*5 } Agt_Step{ // 前にすすむ Forward(My.Speed) // 方向や速さを変更するか、どうかを判断する dim a as double a = rnd() if a < 0.1 then My.Direction = rnd()*360 My.Speed = rnd()*5 end if } #end_rule UNIVERSE.SPACE_K.WALKER3 //------------------------------------------------------- // Agent Rule //------------------------------------------------------- #begin_rule UNIVERSE.SPACE_K.WALKER4 Agt_Init{ // 初期設定をする My.X = 1 My.Y = 1 My.Direction = 0 My.Speed = 1 } Agt_Step{ // 前にすすむ Forward(My.Speed) // 歩数をカウントする My.Count = My.Count + 1 // 歩数が99になったら右に90度曲がり、カウントを0に戻す If My.Count == 98 then Turn(90) My.Count = 0 end if } #end_rule UNIVERSE.SPACE_K.WALKER4 //------------------------------------------------------- // Agent Rule //------------------------------------------------------- #begin_rule UNIVERSE.SPACE_K.WALKER5 Agt_Init{ // 初期設定をする My.X = 50 My.Y = 50 My.Direction = rnd()*360 My.Speed = rnd()*5 } Agt_Step{ // 前に進む Forward(My.Speed) // 方向を調節する If My.Direction>=0 and My.Direction < 45 then Turn(10) elseif My.Direction > 45 and My.Direction < 225 then Turn(-10) else Turn(10) end if } #end_rule UNIVERSE.SPACE_K.WALKER5 //------------------------------------------------------- // Agent Rule //------------------------------------------------------- #begin_rule UNIVERSE.SPACE_K.WALKER6 Agt_Init{ // 初期設定をする My.X = 50 My.Y = 50 My.Direction = rnd()*360 My.Speed = rnd()*5 My.Destination = rnd()*360 } Agt_Step{ // 前に進む Forward(My.Speed) // 方向を調節する If My.Destination> My.Direction and My.Destination< My.Direction+180 then Turn(10) elseif My.Destination< My.Direction-180 then Turn(10) else Turn(-10) end if } #end_rule UNIVERSE.SPACE_K.WALKER6 //------------------------------------------------------- // Simulation Definition Division //------------------------------------------------------- Single_Simulation { Step_Max = 0; Time_Max = 0; End_Condition = ""; Exec_Wait = 0; Exec_Order = Random; Random_Seed = 0; Log_File = "", Fixed, Append, 0; Replay_Log_File = "", Fixed, Append, 0; Redraw_Timing = Step; Redraw_Interval = 1; Garbage_Interval = 1; } //------------------------------------------------------- // Simulation Loop Definition Division //------------------------------------------------------- Repeat_Simulation { Value_Change = None; Repeat_Max = 1; } //------------------------------------------------------- // 2 Dimension Map Display Definition Division //------------------------------------------------------- Map_Output { Map_Space_Name = "UNIVERSE.SPACE_K"; Map_Name = "Space_K"; Font_Name = "Dialog"; Font_Char_Set = 81; Font_Size = 12.0; Font_Style = 0; Font_Color = 0, 0, 0; Font_Background_Color = 255, 255, 255; Title = ""; Axis_Label = "", ""; Draw_Range = 0, 0, 100, 100; Ruled_Line = No; Remarks = Yes; Legend_Pos = Top; Background_Color = 0, 0, 0; Background_Transparent = No; Target_Layer = 0; Coordinate_Display = No; Space_Kind = Square_2D; BG_Pict = No; BG_Type = 0; BG_Var_Name = ""; BG_File_Name = ""; Disable = No; Position_x = 106; Position_y = 21; Size_x = 792; Size_y = 533; Origin_Position = 2; Output { Map_Element_Name = "Walker1"; Map_Element = Agent_Variable; Output_Expression = "UNIVERSE.SPACE_K.WALKER1"; Draw_Line = No; Collection_Name = ""; Line_Type = 0; Line_Arrow = 0; Line_Width = 0; Line_Color = 0, 0, 0; Agent_Color = 255,0,0; Marker_Id = 1; Icon_Type = 0; Icon_Var_Name = ""; Icon_Transparent = No; Icon_Enlarg_Reduce = No; Icon_File_Name = ""; Num_Display = No; Num_Var_Name = "UNIVERSE.SPACE_K.WALKER.NUM"; } Output { Map_Element_Name = "Walker2"; Map_Element = Agent_Variable; Output_Expression = "UNIVERSE.SPACE_K.WALKER2"; Draw_Line = No; Collection_Name = ""; Line_Type = 0; Line_Arrow = 0; Line_Width = 0; Line_Color = 0, 0, 0; Agent_Color = 102,153,255; Marker_Id = 1; Icon_Type = 0; Icon_Var_Name = ""; Icon_Transparent = No; Icon_Enlarg_Reduce = No; Icon_File_Name = ""; Num_Display = No; Num_Var_Name = ""; } Output { Map_Element_Name = "Walker3"; Map_Element = Agent_Variable; Output_Expression = "UNIVERSE.SPACE_K.WALKER3"; Draw_Line = No; Collection_Name = ""; Line_Type = 0; Line_Arrow = 0; Line_Width = 0; Line_Color = 0, 0, 0; Agent_Color = 255,153,0; Marker_Id = 1; Icon_Type = 0; Icon_Var_Name = ""; Icon_Transparent = No; Icon_Enlarg_Reduce = No; Icon_File_Name = ""; Num_Display = No; Num_Var_Name = ""; } Output { Map_Element_Name = "Walker4"; Map_Element = Agent_Variable; Output_Expression = "UNIVERSE.SPACE_K.WALKER4"; Draw_Line = No; Collection_Name = ""; Line_Type = 0; Line_Arrow = 0; Line_Width = 0; Line_Color = 0, 0, 0; Agent_Color = 0,153,0; Marker_Id = 1; Icon_Type = 0; Icon_Var_Name = ""; Icon_Transparent = No; Icon_Enlarg_Reduce = No; Icon_File_Name = ""; Num_Display = No; Num_Var_Name = ""; } Output { Map_Element_Name = "Walker5"; Map_Element = Agent_Variable; Output_Expression = "UNIVERSE.SPACE_K.WALKER5"; Draw_Line = No; Collection_Name = ""; Line_Type = 0; Line_Arrow = 0; Line_Width = 0; Line_Color = 0, 0, 0; Agent_Color = 153,153,153; Marker_Id = 1; Icon_Type = 0; Icon_Var_Name = ""; Icon_Transparent = No; Icon_Enlarg_Reduce = No; Icon_File_Name = ""; Num_Display = No; Num_Var_Name = ""; } Output { Map_Element_Name = "Walker6"; Map_Element = Agent_Variable; Output_Expression = "UNIVERSE.SPACE_K.WALKER6"; Draw_Line = No; Collection_Name = ""; Line_Type = 0; Line_Arrow = 0; Line_Width = 0; Line_Color = 0, 0, 0; Agent_Color = 204,51,255; Marker_Id = 1; Icon_Type = 0; Icon_Var_Name = ""; Icon_Transparent = No; Icon_Enlarg_Reduce = No; Icon_File_Name = ""; Num_Display = No; Num_Var_Name = "UNIVERSE.SPACE_K.WALKER6.DESTINATION"; } } //------------------------------------------------------- // Control Panel Definition Division //------------------------------------------------------- Control_Panel { Display_Area = 0, 0, 100, 100; } //------------------------------------------------------- // Space Initial Value Definition Divsion //------------------------------------------------------- Space_Initial { } //------------------------------------------------------- // Other Miscellaneous Data Definition Division //------------------------------------------------------- Others_Data { Indent = 4; Rule_Colored = Yes; Font_Name = "Dialog"; Font_Char_Set = 0; Font_Size = 12.0; Font_Style = 0; Font_Color = 0, 0, 0; Font_Background_Color = 0, 0, 0; Window_Hide_Run = 1; Debug_Position_x = 75; Debug_Position_y = 75; Debug_Size_x = 400; Debug_Size_y = 200; Console_Position_x = 67; Console_Position_y = 512; Console_Size_x = 600; Console_Size_y = 120; }