Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1838967
  • 博文数量: 333
  • 博客积分: 10791
  • 博客等级: 上将
  • 技术积分: 4314
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-08 07:39
文章分类

全部博文(333)

文章存档

2015年(1)

2011年(116)

2010年(187)

2009年(25)

2008年(3)

2007年(1)

分类: C/C++

2011-07-05 14:40:57

/*
 * lifegame.h
 *
 * Created on: Jan 7, 2010
 * Author: Daniel Weller
 */


/* Warning: Do NOT modify the contents of this file.
   All your code should be in lab1a.c. */


#ifndef LIFEGAME_H_
#define LIFEGAME_H_

/* state constants */
#define DEAD 0
#define ALIVE 1

/* initialize_world -- set up world, all cells initialized
   to DEAD or ALIVE; all cells in next generation are
   initialized to DEAD */

void initialize_world(void);

/* returns the width (x) and height (y) of the world */
int get_world_width(void);
int get_world_height(void);

/* returns the state (DEAD or ALIVE) of the cell at (x,y);
   coordinates go from x = 0,...,width-1 and
   y = 0,...,height-1; returns DEAD for cells outside this
   range */

int get_cell_state(int x, int y);

/* sets the state (DEAD or ALIVE) of the cell at (x,y) in
   the next generation; range of coordinates same as in
   get_cell_state(); calls abort() if invalid coordinates
   are specified */

void set_cell_state(int x, int y, int state);

/* updates world state to next generation and resets all
   next generation states to DEAD */

/*
 * 更新细胞状态
 * 释放下一代状态(DEAD)
 */

void finalize_evolution(void);

/* outputs the current world state to the console */
void output_world(void);

/* functions to implement for Part B */
void initialize_world_from_file(const char * filename);
void save_world_to_file(const char * filename);

#endif /* LIFEGAME_H_ */


阅读(624) | 评论(0) | 转发(0) |
0

上一篇:[MIT C]lifegame.c

下一篇:[MIT C]sship.txt

给主人留下些什么吧!~~