mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-02 18:03:37 +02:00
Spawn agent at random position
This commit is contained in:
parent
b305a41cfc
commit
125d0a416e
1 changed files with 5 additions and 1 deletions
6
main.cc
6
main.cc
|
@ -1,3 +1,5 @@
|
|||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
|
||||
#include "agent.h"
|
||||
|
@ -8,7 +10,9 @@ main(int argc, char *argv[])
|
|||
{
|
||||
class map map(10, 10);
|
||||
|
||||
class tile &agentpos = map.tile_at(4, 4);
|
||||
srandom(time(NULL));
|
||||
|
||||
class tile &agentpos = map.tile_at(random() % map.w, random() % map.h);
|
||||
class agent agent(0, agentpos);
|
||||
|
||||
map.print_map();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue