Browse Source

Prototype is ready, review debug in progress...

master
Ognjen Milan Robovic 2 months ago
parent
commit
71b6186474
3 changed files with 57 additions and 14 deletions
  1. +38
    -6
      source/ai.adb
  2. +17
    -4
      source/ai.ads
  3. +2
    -4
      source/main.adb

+ 38
- 6
source/ai.adb View File

@@ -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;

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



+ 17
- 4
source/ai.ads View File

@@ -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;

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



+ 2
- 4
source/main.adb View File

@@ -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;


Loading…
Cancel
Save