forked from cse30-sp21/A4_starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboard.c
64 lines (54 loc) · 1.2 KB
/
board.c
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
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* Assignment: life
* Name :TODO
* PID: TODO
* Class: UCSD CSE30-SP21
*
*/
#include "cse30life.h"
#include "board.h"
/**
* create a new board
*
* - malloc a boards structure
* - set the generation to 0
* - open the file (if it doesn't exist, return a NULL pointer
* - read the first line which is the number of rows
* - read the second line which is the number of cols
* - set the # of rows and # of cols in the boards structure
* - malloc bufferA and bufferB
* - Set currentBuffer and nextBuffer
* - clear both board buffers
* - read the file until done. each row contains a row and a columns separted by
* white space
* for each line, set the cell in the current buffer
* - close the file
* - return the boards pointer if successfull or NULL ptr otherwise
*/
boards_t * createBoard(char *initFileName){
// TODO:
}
/**
* delete a board
*/
void deleteBoard(boards_t **bptrPtr){
// TODO:
}
/**
* set all the belems in both buffers to 0
*/
void clearBoards(boards_t *self){
// TODO:
}
/**
* swap the current and next buffers
*/
void swapBuffers(boards_t *self){
// TODO:
}
/**
* get a cell index
*/
size_t getIndex(size_t numCols, size_t row, size_t col){
// TODO:
}