Commit graph

43 commits

Author SHA1 Message Date
Petr Baudis
f6221436a4 connection::thread_loop(): Do not write() if we have nothing to write 2011-11-27 02:40:57 +01:00
Petr Baudis
296f4148d3 Introduce sun energy (on-tick gain) 2011-11-27 02:34:28 +01:00
Petr Baudis
158ab85715 connection::thread_loop(): Break on zero reads 2011-11-27 02:33:24 +01:00
Petr Baudis
93882f79b9 Track agent energy
Base energy, move energy
2011-11-27 02:32:59 +01:00
Petr Baudis
4fe552a79e Ensure unicate agent IDs 2011-11-27 02:24:04 +01:00
Petr Baudis
d44c5f5b10 move_dir: Restrict to {-1,0,1} 2011-11-27 02:22:14 +01:00
Petr Baudis
5ed183c554 Add basic README + protocol description 2011-11-27 02:20:15 +01:00
Petr Baudis
de6a4d656f Support for command input
For starters, 'move_dir x y' command is supported.
2011-11-27 02:14:57 +01:00
Petr Baudis
92940b6054 Connection communication in separate thread 2011-11-27 01:24:52 +01:00
Petr Baudis
ec3897b29b map::agent_startpos(): Introduce, abstract out from main loop 2011-11-27 00:38:31 +01:00
Petr Baudis
ea4f18b642 map::on_tick(): Move to map.cc 2011-11-27 00:36:07 +01:00
Petr Baudis
ba9d51fda0 Tidyup. 2011-11-27 00:35:11 +01:00
Petr Baudis
f0d0bef899 agent::on_senses_update(): Split off on_tick() 2011-11-27 00:33:05 +01:00
Petr Baudis
9c746310de Correctly number new agents 2011-11-27 00:29:32 +01:00
Petr Baudis
1a9dcce608 Separate agent on_tick and removal, better world consistency 2011-11-27 00:26:45 +01:00
Petr Baudis
27f4f4a3b0 Main loop: Add comments 2011-11-27 00:25:16 +01:00
Petr Baudis
6f038434f9 Accept new agents at the beginning of tick 2011-11-27 00:24:05 +01:00
Petr Baudis
f33f7c1d61 Support for multiple connected agents 2011-11-27 00:22:29 +01:00
Petr Baudis
50fb0bd004 CFLAGS -= -O3, difficult debugging 2011-11-27 00:16:20 +01:00
Petr Baudis
54603edcb9 map::map: Use in-place constructor 2011-11-27 00:04:45 +01:00
Petr Baudis
eb42ab4764 map::on_tick(): Introduce, call in each tick 2011-11-27 00:03:20 +01:00
Petr Baudis
d7ed0bc6ce Move print_map() to the end of the tick 2011-11-27 00:02:10 +01:00
Petr Baudis
6a3d9b2e4a Destroy agent on disconnect; another agent can connect later 2011-11-26 23:59:31 +01:00
Petr Baudis
cd347a316d agent::conn: Do not assume being non-NULL
Disconnected agents will remain in the world in the future.
2011-11-26 23:54:05 +01:00
Petr Baudis
a645ba5758 agent::conn: Change to pointer, delete in ~agent() 2011-11-26 23:52:31 +01:00
Petr Baudis
1d15adac48 Main loop: Switch to infinite ticking paradigm; agents connect on the fly, cannot reconnect yet 2011-11-26 23:50:07 +01:00
Petr Baudis
978a080656 ~connection(): Close file descriptor 2011-11-26 23:43:52 +01:00
Petr Baudis
2603aacf1f Don't die on SIGPIPE 2011-11-26 23:37:25 +01:00
Petr Baudis
07dbb9c4f9 ~agent(): Introduce proper destructor 2011-11-26 23:36:10 +01:00
Petr Baudis
1ed67c81b6 Maintain and broadcast current tick id 2011-11-26 23:31:28 +01:00
Petr Baudis
3d485518b0 agent::on_tick(): Introduce 2011-11-26 23:26:01 +01:00
Petr Baudis
6b3a51139a Support for (read-only) TCP connection agent communication 2011-11-26 23:24:06 +01:00
Petr Baudis
a72882a743 Fix map addressing 2011-11-26 22:00:16 +01:00
Petr Baudis
2c83064fa9 Makefile: $(OBJS) 2011-11-26 21:47:40 +01:00
Petr Baudis
125d0a416e Spawn agent at random position 2011-11-26 21:47:31 +01:00
Petr Baudis
b305a41cfc agent::move_dir(): Implement 2011-11-26 20:40:22 +01:00
Petr Baudis
56726a6c05 Get rid of class position 2011-11-26 20:40:05 +01:00
Petr Baudis
f622f79283 gitignore 2011-11-26 19:41:27 +01:00
Petr Baudis
32dc354e60 Create an agent 2011-11-26 19:41:03 +01:00
Petr Baudis
a131964cc0 position() constructor: Take map ref, not ptr 2011-11-26 19:40:55 +01:00
Petr Baudis
1eaf680111 tile::on_agent_enter(): Check for collisions 2011-11-26 19:40:05 +01:00
Petr Baudis
8e78efd7d8 tile::symbol() -> ::type_symbol(), ::symbol() accounts for agent id 2011-11-26 19:26:32 +01:00
Petr Baudis
ce6f46ef1c brmlife: Initial version
Can draw 10x10 field of dots.
2011-11-26 19:21:27 +01:00