-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathHSAIPathFinding.h
60 lines (41 loc) · 1.57 KB
/
HSAIPathFinding.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
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
//
// HSAIPathFinding.h
//
// Created by Jared McFarland on 8/12/13.
//
#import <Foundation/Foundation.h>
#define HSAIManhattanHeuristic 1
#define HSAIDiagonalHeuristic 2
#define HSAIEuclidianHeuristic 3
@interface HSAIPathFindingNode : NSObject
@property (nonatomic) CGPoint point;
@property (nonatomic) CGFloat gScore;
@property (nonatomic) CGFloat hScore;
@property (nonatomic) CGFloat speed;
@property (nonatomic, retain) HSAIPathFindingNode *parent;
- (id) initWithPosition: (CGPoint) position;
- (CGFloat) fScore;
- (BOOL) isEqualTo:(HSAIPathFindingNode *) object;
@end
@protocol HSAIPathFindingDelegate
- (BOOL) nodeIsPassable: (HSAIPathFindingNode *) node;
- (NSArray *) neighborsFor: (HSAIPathFindingNode *) node;
@optional
- (void) nodeWasAddedToOpenList: (HSAIPathFindingNode *) node;
- (void) nodeWasAddedToPath: (HSAIPathFindingNode *) node;
@end
@interface HSAIPathFinding : NSObject <HSAIPathFindingDelegate>
@property (nonatomic, retain) NSMutableArray *openList;
@property (nonatomic, retain) NSMutableArray *closedList;
@property (nonatomic, assign) id delegate;
@property (nonatomic) NSInteger heuristic;
- (NSArray *)findPathFrom: (CGPoint)start to: (CGPoint)goal;
- (HSAIPathFindingNode *) cheapestNode;
- (CGFloat) heuristic: (HSAIPathFindingNode *)start to: (HSAIPathFindingNode *) end;
- (CGFloat) gScore: (HSAIPathFindingNode *) start to: (HSAIPathFindingNode *) end;
@end
@interface HSAIPathFindingHeuristic : NSObject
+ (NSInteger) diagonalHeuristic;
+ (NSInteger) manhattanHeuristic;
+ (NSInteger) euclidianHeuristic;
@end