forked from 61c-teach/sp22-proj1-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snake_utils.h
29 lines (21 loc) · 811 Bytes
/
snake_utils.h
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
#ifndef _SNK_SNAKE_UTILS_H
#define _SNK_SNAKE_UTILS_H
#include <stdint.h>
#include "state.h"
/* Define key presses for interactive mode. */
#define KEY_MOVEUP 0x77
#define KEY_MOVERIGHT 0x64
#define KEY_MOVEDOWN 0x73
#define KEY_MOVELEFT 0x61
#define KEY_QUIT 0x71
/* A simple deterministic random function. Look up LFSR to learn more! */
uint32_t det_rand(uint32_t* state);
/* Deterministically generates food on the board. */
int deterministic_food(game_state_t* state);
/* Generates food in the top-left corner of the board. */
int corner_food(game_state_t* state);
/* Changes the direction of the player-controlled snake. */
void redirect_snake(game_state_t* state, char newhead);
/* Randomly causes the chosen snake to turn left or right. */
void random_turn(game_state_t* state, int snum);
#endif