소스 검색

Finished 4th AI prototype, works nicely, we will see for scalability...

master
부모
커밋
fc6c37bc2e
3개의 변경된 파일38개의 추가작업 그리고 29개의 파일을 삭제
  1. +3
    -0
      source/ai.adb
  2. +31
    -29
      source/ai.ads
  3. +4
    -0
      source/main.adb

+ 3
- 0
source/ai.adb 파일 보기

@@ -6,6 +6,9 @@ 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;

procedure configure is
begin
core.echo (core.failure, "No AI yet folk!");


+ 31
- 29
source/ai.ads 파일 보기

@@ -8,36 +8,34 @@ package ai is
none, walk, talk, find
);

type mind_limit is (
thirst, hunger, fatigue, solitude,
);

subtype string_16 is string (1 .. 16);

envy : constant natural := 2#00000001#;
gluttony : constant natural := 2#00000010#;
greed : constant natural := 2#00000100#;
lust : constant natural := 2#00001000#;
pride : constant natural := 2#00010000#;
sloth : constant natural := 2#00100000#;
wrath : constant natural := 2#01000000#;

thirst : constant natural := 2#00000001#;
hunger : constant natural := 2#00000010#;
fatigue : constant natural := 2#00000100#;
solitude : constant natural := 2#00001000#;
health : constant natural := 2#00010000#;
mana : constant natural := 2#00100000#;
boredom : constant natural := 2#01000000#;

agent_digit : constant natural := 4;
agent_state : constant natural := 4;
agent_digit : constant natural := 8;
agent_state : constant natural := 2;
agent_count : constant natural := 4;

type name_limit is mod 400;
type clan_limit is mod 120;
type data_limit is mod agent_state ** agent_digit - 1;

envy : constant data_limit := 2#00000001#;
gluttony : constant data_limit := 2#00000010#;
greed : constant data_limit := 2#00000100#;
lust : constant data_limit := 2#00001000#;
pride : constant data_limit := 2#00010000#;
sloth : constant data_limit := 2#00100000#;
wrath : constant data_limit := 2#01000000#;

thirst : constant data_limit := 2#00000001#;
hunger : constant data_limit := 2#00000010#;
fatigue : constant data_limit := 2#00000100#;
solitude : constant data_limit := 2#00001000#;
health : constant data_limit := 2#00010000#;
mana : constant data_limit := 2#00100000#;
boredom : constant data_limit := 2#01000000#;

type byte is new natural range 0 .. 2 ** 8 - 1;

type action_data is
record
base : data_limit;
@@ -49,9 +47,8 @@ package ai is
record
name : name_limit;
clan : clan_limit;
data : data_limit;
soul : soul_limit;
mind : mind_limit;
soul : data_limit;
mind : data_limit;
work : action;
x : natural;
y : natural;
@@ -59,16 +56,21 @@ package ai is

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

function agent_is_thirsty (index : in natural) return boolean;
function agent_is_hungry (index : in natural) return boolean;

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

action_array : constant array (action) of action_data := (
(4#3000#, action_none'access, "standing "),
(4#3000#, action_walk'access, "walking "),
(4#3000#, action_talk'access, "talking "),
(4#3000#, action_find'access, "finding ")
(2#00000000#, action_none'access, "standing "),
(2#00000000#, action_walk'access, "walking "),
(2#00000000#, action_talk'access, "talking "),
(2#00000000#, action_find'access, "finding ")
);

male_name_array : constant array (name_limit) of string_16 := (


+ 4
- 0
source/main.adb 파일 보기

@@ -166,6 +166,10 @@ 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;


불러오는 중...
취소
저장