From 3cb857f94b964d7107eda03efc0c6454748a5716 Mon Sep 17 00:00:00 2001
From: Niclas Dobbertin <niclas.dobbertin@mailbox.org>
Date: Fri, 19 Jul 2024 11:32:36 +0200
Subject: fix overall procedure

---
 modeling/model_env.py        |  16 +-
 modeling/model_init.py       |   4 +-
 modeling/prod_vis.py         | 347 +++++++++++++++++++++++++++++++++++++++++++
 modeling/productions_math.py |   2 +-
 4 files changed, 358 insertions(+), 11 deletions(-)

diff --git a/modeling/model_env.py b/modeling/model_env.py
index 6b8b210..7dcad3e 100644
--- a/modeling/model_env.py
+++ b/modeling/model_env.py
@@ -25,14 +25,14 @@ def generate_procedures(screen):
 
     screen["ProcedureOverall"] = {"text": "proc_overall", "position": (0, 600)}
 
-    screen["Answers"] = {"text": "Answers", "position": (100, 0)}
-    screen["Answer1"] = {"text": 1, "position": (100, 100)}
-    screen["Answer2"] = {"text": 2, "position": (100, 200)}
-    screen["Answer3"] = {"text": 3, "position": (100, 300)}
-    screen["Answer4"] = {"text": 4, "position": (100, 400)}
-    screen["Answer5"] = {"text": 5, "position": (100, 500)}
-
-    screen["AnswerOverall"] = {"text": "proc_overall", "position": (100, 600)}
+    screen["Answers"] = {"text": "Answers", "position": (100, 100)}
+    screen["Answer1"] = {"text": 1, "position": (100, 200)}
+    screen["Answer2"] = {"text": 2, "position": (100, 300)}
+    screen["Answer3"] = {"text": 3, "position": (100, 400)}
+    screen["Answer4"] = {"text": 4, "position": (100, 500)}
+    screen["Answer5"] = {"text": 5, "position": (100, 600)}
+
+    screen["AnswerOverall"] = {"text": "proc_overall", "position": (100, 700)}
 
 def generate_variables(screen):
     # Variables
diff --git a/modeling/model_init.py b/modeling/model_init.py
index 66e74b1..a6ca3ac 100644
--- a/modeling/model_init.py
+++ b/modeling/model_init.py
@@ -212,8 +212,8 @@ def init():
         )
 
     # Add comparison relations to single digit numbers
-    for i in range(0, 11):
-        for j in range(0, 11):
+    for i in range(0, 101):
+        for j in range(0, 101):
             DM.add(
                 actr.makechunk(
                     f"greater{i}{j}",
diff --git a/modeling/prod_vis.py b/modeling/prod_vis.py
index e70a4c7..3360b33 100644
--- a/modeling/prod_vis.py
+++ b/modeling/prod_vis.py
@@ -1052,6 +1052,7 @@ def procedures(Model):
         =g>
         isa         math_goal
         op          max_arg2_attend
+        arg2        ~Answers
         arg2_idx    max
         vis_counter 1
         =visual_location>
@@ -1613,4 +1614,350 @@ def procedures(Model):
         ~retrieval>
         """,
     )
+
+    vis_max_arg2_answers_step1_attend = Model.productionstring(
+        name="vis_max_arg2_answers_step1_attend",
+        string="""
+        =g>
+        isa         math_goal
+        arg2        Answers
+        op          max_arg2_attend
+        arg2_idx    max
+        vis_counter 1
+        =visual_location>
+        isa         _visuallocation
+        ?visual>
+        state       free
+        ==>
+        =g>
+        isa         math_goal
+        op          max_arg2_encode_answers
+        +visual>
+        isa         _visual
+        cmd         move_attention
+        screen_pos  =visual_location
+        """,
+    )
+    vis_max_arg2_answers_step1_encode = Model.productionstring(
+        name="vis_max_arg2_answers_step1_encode",
+        string="""
+        =g>
+        isa         math_goal
+        op          max_arg2_encode_answers
+        arg2_idx    max
+        vis_counter 1
+        =visual_location>
+        isa         _visuallocation
+        screen_x    =screen_x
+        =visual>
+        isa         _visual
+        value       =value
+        ==>
+        =g>
+        isa         math_goal
+        op          max_arg2_attend_answers
+        vis_counter 2
+        arg2        =value
+        +visual_location>
+        isa         _visuallocation
+        screen_x    =screen_x
+        screen_y    300
+        """,
+    )
+
+    vis_max_arg2_answer_step2_attend = Model.productionstring(
+        name="vis_max_arg2_answers_step2_attend",
+        string="""
+        =g>
+        isa         math_goal
+        op          max_arg2_attend_answers
+        arg2_idx    max
+        vis_counter 2
+        =visual_location>
+        isa         _visuallocation
+        screen_x    =screen_x
+        screen_y    =screen_y
+        ?visual>
+        state       free
+        ==>
+        =g>
+        isa         math_goal
+        op          max_arg2_check_answers
+        +visual>
+        isa         _visual
+        cmd         move_attention
+        screen_pos  =visual_location
+        """,
+    )
+    vis_max_arg2_answers_step2_check = Model.productionstring(
+        name="vis_max_arg2_answers_step2_check",
+        string="""
+        =g>
+        isa         math_goal
+        op          max_arg2_check_answers
+        arg2        =arg2
+        arg2_idx    max
+        vis_counter 2
+        =visual>
+        isa         _visual
+        value       =value
+        ==>
+        =g>
+        isa         math_goal
+        op          max_arg2_encode_answers
+        +retrieval>
+        isa         math_op
+        op          greater
+        arg1        =arg2
+        arg2        =value
+        """,
+    )
+    vis_max_arg2_answers_step2_encode = Model.productionstring(
+        name="vis_max_arg2_answers_step2_encode",
+        string="""
+        =g>
+        isa         math_goal
+        op          max_arg2_encode_answers
+        arg2_idx    max
+        vis_counter 2
+        =visual_location>
+        isa         _visuallocation
+        screen_x    =screen_x
+        =retrieval>
+        isa         math_op
+        op          greater
+        result      =result
+        ==>
+        =g>
+        isa         math_goal
+        op          max_arg2_attend_answers
+        vis_counter 3
+        arg2        =result
+        +visual_location>
+        isa         _visuallocation
+        screen_x    =screen_x
+        screen_y    400
+        ~retrieval>
+        """,
+    )
+    vis_max_arg2_answers_step3_attend = Model.productionstring(
+        name="vis_max_arg2_answers_step3_attend",
+        string="""
+        =g>
+        isa         math_goal
+        op          max_arg2_attend_answers
+        arg2_idx    max
+        vis_counter 3
+        =visual_location>
+        isa         _visuallocation
+        screen_x    =screen_x
+        screen_y    =screen_y
+        ?visual>
+        state       free
+        ==>
+        =g>
+        isa         math_goal
+        op          max_arg2_check_answers
+        +visual>
+        isa         _visual
+        cmd         move_attention
+        screen_pos  =visual_location
+        """,
+    )
+    vis_max_arg2_answers_step3_check = Model.productionstring(
+        name="vis_max_arg2_answers_step3_check",
+        string="""
+        =g>
+        isa         math_goal
+        op          max_arg2_check_answers
+        arg2        =arg2
+        arg2_idx    max
+        vis_counter 3
+        =visual>
+        isa         _visual
+        value       =value
+        ==>
+        =g>
+        isa         math_goal
+        op          max_arg2_encode_answers
+        +retrieval>
+        isa         math_op
+        op          greater
+        arg1        =arg2
+        arg2        =value
+        """,
+    )
+    vis_max_arg2_answers_step3_encode = Model.productionstring(
+        name="vis_max_arg2_answers_step3_encode",
+        string="""
+        =g>
+        isa         math_goal
+        op          max_arg2_encode_answers
+        arg2_idx    max
+        vis_counter 3
+        =visual_location>
+        isa         _visuallocation
+        screen_x    =screen_x
+        =retrieval>
+        isa         math_op
+        op          greater
+        result      =result
+        ==>
+        =g>
+        isa         math_goal
+        op          max_arg2_attend_answers
+        vis_counter 4
+        arg2        =result
+        +visual_location>
+        isa         _visuallocation
+        screen_x    =screen_x
+        screen_y    500
+        ~retrieval>
+        """,
+    )
+    vis_max_arg2_answers_step4_attend = Model.productionstring(
+        name="vis_max_arg2_answers_step4_attend",
+        string="""
+        =g>
+        isa         math_goal
+        op          max_arg2_attend_answers
+        arg2_idx    max
+        vis_counter 4
+        =visual_location>
+        isa         _visuallocation
+        screen_x    =screen_x
+        screen_y    =screen_y
+        ?visual>
+        state       free
+        ==>
+        =g>
+        isa         math_goal
+        op          max_arg2_check_answers
+        +visual>
+        isa         _visual
+        cmd         move_attention
+        screen_pos  =visual_location
+        """,
+    )
+    vis_max_arg2_answers_step4_check = Model.productionstring(
+        name="vis_max_arg2_answers_step4_check",
+        string="""
+        =g>
+        isa         math_goal
+        op          max_arg2_check_answers
+        arg2        =arg2
+        arg2_idx    max
+        vis_counter 4
+        =visual>
+        isa         _visual
+        value       =value
+        ==>
+        =g>
+        isa         math_goal
+        op          max_arg2_encode_answers
+        +retrieval>
+        isa         math_op
+        op          greater
+        arg1        =arg2
+        arg2        =value
+        """,
+    )
+    vis_max_arg2_answers_step4_encode = Model.productionstring(
+        name="vis_max_arg2_answers_step4_encode",
+        string="""
+        =g>
+        isa         math_goal
+        op          max_arg2_encode_answers
+        arg2_idx    max
+        vis_counter 4
+        =visual_location>
+        isa         _visuallocation
+        screen_x    =screen_x
+        =retrieval>
+        isa         math_op
+        op          greater
+        result      =result
+        ==>
+        =g>
+        isa         math_goal
+        op          max_arg2_attend_answers
+        vis_counter 5
+        arg2        =result
+        +visual_location>
+        isa         _visuallocation
+        screen_x    =screen_x
+        screen_y    600
+        ~retrieval>
+        """,
+    )
+    vis_max_arg2_answers_step5_attend = Model.productionstring(
+        name="vis_max_arg2_answers_step5_attend",
+        string="""
+        =g>
+        isa         math_goal
+        op          max_arg2_attend_answers
+        arg2_idx    max
+        vis_counter 5
+        =visual_location>
+        isa         _visuallocation
+        screen_x    =screen_x
+        screen_y    =screen_y
+        ?visual>
+        state       free
+        ==>
+        =g>
+        isa         math_goal
+        op          max_arg2_check_answers
+        +visual>
+        isa         _visual
+        cmd         move_attention
+        screen_pos  =visual_location
+        """,
+    )
+    vis_max_arg2_answers_step5_check = Model.productionstring(
+        name="vis_max_arg2_answers_step5_check",
+        string="""
+        =g>
+        isa         math_goal
+        op          max_arg2_check_answers
+        arg2        =arg2
+        arg2_idx    max
+        vis_counter 5
+        =visual>
+        isa         _visual
+        value       =value
+        ==>
+        =g>
+        isa         math_goal
+        op          max_arg2_encode_answers
+        +retrieval>
+        isa         math_op
+        op          greater
+        arg1        =arg2
+        arg2        =value
+        """,
+    )
+    vis_max_arg2_answers_step5_encode = Model.productionstring(
+        name="vis_max_arg2_answers_step5_encode",
+        string="""
+        =g>
+        isa         math_goal
+        op          max_arg2_encode_answers
+        arg2_idx    max
+        vis_counter 5
+        =retrieval>
+        isa         math_op
+        op          greater
+        result      =result
+        ==>
+        =g>
+        isa         math_goal
+        op          done
+        arg2        =result
+        vis_counter None
+        expand_slot None
+        ~visual>
+        ~retrieval>
+        """,
+    )
     return prods
diff --git a/modeling/productions_math.py b/modeling/productions_math.py
index 1a756c9..9ab11a9 100644
--- a/modeling/productions_math.py
+++ b/modeling/productions_math.py
@@ -95,7 +95,7 @@ def start():
             # if sim.current_event.action == "NO RULE FOUND":
             #     print(goal)
             if sim.current_event.action == "KEY PRESSED: SPACE":
-                sim._Simulation__env.stimulus["Answer1"]["text"] = "99"
+                sim._Simulation__env.stimulus["Answer5"]["text"] = "99"
                 i += 1
                 print(userinput)
                 print("NEW PROC")
-- 
cgit v1.2.3