Commit graph

118 commits

Author SHA1 Message Date
Petr Baudis
a36deeb1db Connection: Abstract out buf_incomplete() macro 2011-11-27 05:05:43 +01:00
Petr Baudis
a151a2985d agent::on_tick(): Do nothing when not placed 2011-11-27 04:42:52 +01:00
Petr Baudis
a2a52f5884 World: Multiply all constants by ten for higher granularity 2011-11-27 04:41:41 +01:00
Petr Baudis
812e0da79b agent::spawn(): Introduce 2011-11-27 04:30:18 +01:00
Petr Baudis
7714906baa agent::spawn_at(): Disassociate from constructor, allow tile == NULL 2011-11-27 04:28:16 +01:00
Petr Baudis
3e5366a5c4 README: Document attack_dir 2011-11-27 04:17:29 +01:00
Petr Baudis
ed2c1ee11b move_cost: Scale down from -10 to -5 2011-11-27 04:17:04 +01:00
Petr Baudis
9bf8281b91 dead_body_energy: Scale down from 500 to 200 2011-11-27 04:16:32 +01:00
Petr Baudis
14015e3bfc tile::symbol(): Return 'a' on dead agents 2011-11-27 04:16:07 +01:00
Petr Baudis
da3a988116 Introduce world::dead_body_energy_carryover 2011-11-27 04:12:51 +01:00
Petr Baudis
0c29808836 Action attack_dir(): Implement, trivially random now 2011-11-27 04:10:53 +01:00
Petr Baudis
0398856635 agent::chenergy(): Implement 2011-11-27 04:02:25 +01:00
Petr Baudis
d120fcc938 main(): Allow map dimensions as commandline arguments 2011-11-27 03:49:23 +01:00
Petr Baudis
5efaafe983 Sense around -> visual 2011-11-27 03:44:14 +01:00
Petr Baudis
f0a603352f Sense around: Extended format describing agents explicitly 2011-11-27 03:43:45 +01:00
Petr Baudis
e22c57c97f connnection::actions(): Take agent& 2011-11-27 03:25:16 +01:00
Petr Baudis
415475cd26 connnection::senses(): Sanitize interface, take just agent& 2011-11-27 03:24:40 +01:00
Petr Baudis
9dcb3c543a Connection: Use CRLF for output too 2011-11-27 03:16:47 +01:00
Petr Baudis
b969e91bd1 around: Show 8-neighborhood 2011-11-27 03:16:11 +01:00
Petr Baudis
4f13d0dd6f agent::move_dir(): If moving at dead agent, remove it from map and acquire its energy 2011-11-27 03:07:42 +01:00
Petr Baudis
e27a9fe2aa agent::move_dir(): Disallow movement of dead agent 2011-11-27 03:00:38 +01:00
Petr Baudis
77e555706b Send BUMP if move failed 2011-11-27 02:59:28 +01:00
Petr Baudis
de7a604e52 Dead bodies have (slowly decaying) energy 2011-11-27 02:54:58 +01:00
Petr Baudis
80712598e0 README: Document DEAD, energy 2011-11-27 02:53:22 +01:00
Petr Baudis
64ea015a06 Support for agent death 2011-11-27 02:48:28 +01:00
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