File: dummy.c

package info (click to toggle)
netmaze 0.81+jpg0.82-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,188 kB
  • ctags: 911
  • sloc: ansic: 8,277; tcl: 1,223; makefile: 58; sh: 16
file content (51 lines) | stat: -rw-r--r-- 803 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* This is a demonstration on how to write robots.
 * How about a competition between some robots? :-)
 */

#include <string.h>
#include "netmaze.h"

extern struct shared_struct *sm;

/*******************
 * the init_robot is called one time right after the start
 */

void init_robot(void)
{
  strcpy(sm->ownname,"Dr.Dummy");
  strcpy(sm->owncomment,"Gotcha!!!");
}

void start_robot(int number)
{

}

/*******************
 * the own_action is called every 'beat'
 *
 * this bot really is a dummy, I use this guy
 * to test my program with 31 'players'.
 */

int own_action(void)
{
  static int i=0;
  int ret=0;

  i++; i &= 0x1f;

  switch(i & 0xf0)
  {
    case 0x00:
      ret = JOY_LEFT | JOY_BUTTON;
      break;
    case 0x10:
      ret = JOY_UP | JOY_BUTTON;
      break;
  }
  return ret;
}