Tests About Natural Selection In Virtual Environment
c
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

creature_logic.h 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. Copyright (C) 2011 Weber Yann, Schuck Clement
  3. This file is part of Tansive.
  4. Tansive is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. Tansive is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with Tansive. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #ifndef CREATURE_LOGIC_H
  16. #define CREATURE_LOGIC_H
  17. #include"creature.h"
  18. #include"map.h"
  19. #include"config.h"
  20. /*
  21. creature_logic.h :
  22. Define struct, constant and functions about creature's decision and action.
  23. */
  24. #define MOVE_UP 0
  25. #define MOVE_DWN 1
  26. #define MOVE_RGHT 2
  27. #define MOVE_LFT 3
  28. #define PROBA_REPRO 1
  29. #define LOGIC_MAX_DIST_BORN 10
  30. #define LOGIC_ACTION_EATVEGET 1
  31. #define LOGIC_ACTION_CREAT 2
  32. typedef struct _t_action
  33. {
  34. }t_action;
  35. //Let the creature do a decision
  36. void creature_decision(t_map* mp,t_chain_creature* lst_creat, t_creature* creat, char* dead, t_chain_creature** ptr_head);
  37. //Return a list of action
  38. char check_action(t_map* mp, t_creature* creat, int* x, int* y);
  39. t_chain_creature* repro_creat(t_map* mp, t_chain_creature* lst_creat, t_creature* creat, t_tree_genome* gnome);
  40. //Do a random move to the creature
  41. void random_move(t_map* mp, t_creature* creat);
  42. void move_creat(t_map* mp, t_creature* creat,char dir);
  43. void fight_creat(t_map* mp, t_creature* creat1, t_creature* creat2, char* creat1_dead, t_chain_creature** ptr_head);
  44. #endif