-
Notifications
You must be signed in to change notification settings - Fork 0
/
move.c
60 lines (47 loc) · 957 Bytes
/
move.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
/*
* move.c
* bouncingbots
*
* Created by David Reed on 5/1/12.
* Copyright 2012 David Reed. All rights reserved.
*
*/
#include "move.h"
#include <stdlib.h>
bb_move_set *bb_move_set_alloc()
{
return bb_array_alloc(10, sizeof(bb_move));
}
bb_move_set *bb_move_set_copy(bb_move_set *set)
{
return bb_array_copy(set);
}
bb_bool bb_move_sets_equal(bb_move_set *set, bb_move_set *other)
{
return bb_array_equal(set, other);
}
void bb_move_set_dealloc(bb_move_set *set)
{
bb_array_dealloc(set);
}
bb_index bb_move_set_length(bb_move_set *set)
{
return bb_array_length(set);
}
bb_move bb_move_set_get_move(bb_move_set *set, bb_index move)
{
bb_move mv;
bb_array_get_item(set, move, &mv);
return mv;
}
void bb_move_set_add_move(bb_move_set *set, bb_move move)
{
bb_array_add_item(set, &move);
}
bb_move bb_create_move(bb_pawn pawn, bb_direction dir)
{
bb_move move;
move.pawn = pawn;
move.direction = dir;
return move;
}