From 71b61864740b309b2a3f549139e0e1c7586f4430 Mon Sep 17 00:00:00 2001 From: xolatile Date: Sun, 24 Mar 2024 09:14:54 -0400 Subject: [PATCH] Prototype is ready, review debug in progress... --- source/ai.adb | 44 ++++++++++++++++++++++++++++++++++++++------ source/ai.ads | 21 +++++++++++++++++---- source/main.adb | 6 ++---- 3 files changed, 57 insertions(+), 14 deletions(-) diff --git a/source/ai.adb b/source/ai.adb index 1859c0c..bd87eb7 100644 --- a/source/ai.adb +++ b/source/ai.adb @@ -6,8 +6,29 @@ package body ai is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - function agent_is_thirsty (index : in natural) return boolean is begin return (agent (index).mind and thirst) = thirst; end agent_is_thirsty; - function agent_is_hungry (index : in natural) return boolean is begin return (agent (index).mind and hunger) = hunger; end agent_is_hungry; + function agent_is_envious (index : in natural) return boolean is begin return (agent (index).soul and envy) = envy; end agent_is_envious; + function agent_is_glutton (index : in natural) return boolean is begin return (agent (index).soul and gluttony) = gluttony; end agent_is_glutton; + function agent_is_greed (index : in natural) return boolean is begin return (agent (index).soul and greed) = greed; end agent_is_greed; + function agent_is_slutty (index : in natural) return boolean is begin return (agent (index).soul and lust) = lust; end agent_is_slutty; + function agent_is_proud (index : in natural) return boolean is begin return (agent (index).soul and pride) = pride; end agent_is_proud; + function agent_is_lazy (index : in natural) return boolean is begin return (agent (index).soul and sloth) = sloth; end agent_is_lazy; + function agent_is_angry (index : in natural) return boolean is begin return (agent (index).soul and wrath) = wrath; end agent_is_angry; + function agent_is_thirsty (index : in natural) return boolean is begin return (agent (index).mind and thirst) = thirst; end agent_is_thirsty; + function agent_is_hungry (index : in natural) return boolean is begin return (agent (index).mind and hunger) = hunger; end agent_is_hungry; + function agent_is_tired (index : in natural) return boolean is begin return (agent (index).mind and fatigue) = fatigue; end agent_is_tired; + function agent_is_lonely (index : in natural) return boolean is begin return (agent (index).mind and solitude) = solitude; end agent_is_lonely; + function agent_is_healthy (index : in natural) return boolean is begin return (agent (index).mind and health) = health; end agent_is_healthy; + function agent_is_happy (index : in natural) return boolean is begin return (agent (index).mind and joy) = joy; end agent_is_happy; + function agent_is_bored (index : in natural) return boolean is begin return (agent (index).mind and boredom) = boredom; end agent_is_bored; + + ------------------------------------------------------------------------------------------ + + procedure action_none is begin null; end action_none; + procedure action_walk is begin null; end action_walk; + procedure action_talk is begin null; end action_talk; + procedure action_find is begin null; end action_find; + + ------------------------------------------------------------------------------------------ procedure configure is begin @@ -23,10 +44,21 @@ package body ai is ------------------------------------------------------------------------------------------ - procedure action_none is begin null; end action_none; - procedure action_walk is begin null; end action_walk; - procedure action_talk is begin null; end action_talk; - procedure action_find is begin null; end action_find; + procedure review is + width : integer := 600; + height : integer := 300; + offset : integer := 32; + x : integer := (core.window_width - width) / 2; + y : integer := (core.window_height - height) / 2; + begin + ui.draw_tiny_menu (x, y, width, height, true); + for index in 1 .. agent_count + loop + core.write ("Bot" & integer'image (index), x + offset + 0, y * index + offset, ui.glyphs (ui.active)); + core.write ("T =" & boolean'image (agent_is_thirsty (index)), x + offset + 120, y * index + offset, ui.glyphs (ui.active)); + core.write ("H =" & boolean'image (agent_is_hungry (index)), x + offset + 240, y * index + offset, ui.glyphs (ui.active)); + end loop; + end review; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/ai.ads b/source/ai.ads index b6754a7..71285db 100644 --- a/source/ai.ads +++ b/source/ai.ads @@ -31,7 +31,7 @@ package ai is fatigue : constant data_limit := 2#00000100#; solitude : constant data_limit := 2#00001000#; health : constant data_limit := 2#00010000#; - mana : constant data_limit := 2#00100000#; + joy : constant data_limit := 2#00100000#; boredom : constant data_limit := 2#01000000#; type byte is new natural range 0 .. 2 ** 8 - 1; @@ -56,15 +56,27 @@ package ai is ------------------------------------------------------------------------------------------ - function agent_is_thirsty (index : in natural) return boolean; - function agent_is_hungry (index : in natural) return boolean; + function agent_is_envious (index : in natural) return boolean; -- wtf + function agent_is_glutton (index : in natural) return boolean; -- wtf + function agent_is_greed (index : in natural) return boolean; -- wtf + function agent_is_slutty (index : in natural) return boolean; -- wtf + function agent_is_proud (index : in natural) return boolean; -- wtf + function agent_is_lazy (index : in natural) return boolean; -- wtf + function agent_is_angry (index : in natural) return boolean; -- wtf + function agent_is_thirsty (index : in natural) return boolean; + function agent_is_hungry (index : in natural) return boolean; + function agent_is_tired (index : in natural) return boolean; -- wtf + function agent_is_lonely (index : in natural) return boolean; + function agent_is_healthy (index : in natural) return boolean; + function agent_is_happy (index : in natural) return boolean; -- wtf + function agent_is_bored (index : in natural) return boolean; -- wtf procedure action_none; procedure action_walk; procedure action_talk; procedure action_find; - agent : array (1 .. agent_count) of agent_data := (others => (0, 0, 3, 3, walk, 0, 0)); + agent : array (1 .. agent_count) of agent_data := ((0, 0, 1, 1, walk, 0, 0), others => (0, 0, 3, 3, walk, 0, 0)); action_array : constant array (action) of action_data := ( (2#00000000#, action_none'access, "standing "), @@ -203,6 +215,7 @@ package ai is procedure configure; procedure synchronize; + procedure review; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/main.adb b/source/main.adb index 8fa648a..e1dc842 100644 --- a/source/main.adb +++ b/source/main.adb @@ -159,6 +159,8 @@ begin -- signal_list (core.signal_code'val (core.signal_mode)).all; -- + ai.review; + -- menu_render; -- core.write (integer'image (menu_count), 16, 16, ui.glyphs (ui.active), 16#FFFFFFFF#); @@ -166,10 +168,6 @@ begin ui.draw_text_box (0, core.window_height - 32, core.window_width, 32); end loop gameplay; - - core.echo (core.export, "Bot 1 is thirsty is " & boolean'image (ai.agent_is_thirsty (1))); - core.echo (core.export, "Bot 1 is hungry is " & boolean'image (ai.agent_is_hungry (1))); - ------------------------------------------------------------------------------------------ core.deinitialize;