This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
justhomework/MCU/Final_Design/snake.h

41 lines
474 B
C
Raw Normal View History

2022-05-07 06:48:25 +00:00
#ifndef _SNAKE_H_
#define _SNAKE_H_
2022-05-07 05:56:47 +00:00
#include <reg52.h>
#include <stdio.h>
2022-05-07 11:39:50 +00:00
#define XXX 31
#define YYY 15
#define bool char
2022-05-07 06:25:22 +00:00
#define MOVE_STATE char
#define R 0
#define U 1
#define L 2
#define D 3
2022-05-07 05:56:47 +00:00
struct DOT
{
unsigned char x;
unsigned char y;
} ;
2022-05-07 06:25:22 +00:00
typedef struct DOT Dot;
2022-05-07 05:56:47 +00:00
struct BODY
{
2022-05-07 06:25:22 +00:00
Dot d;
MOVE_STATE m;
2022-05-07 05:56:47 +00:00
};
typedef struct BODY Body;
2022-05-07 06:25:22 +00:00
2022-05-07 11:39:50 +00:00
void snake_init();
void body_move(Body b);
void snake_move();
void body_add();
void snake_draw();
void snake_test();
2022-05-07 06:48:25 +00:00
#endif