-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.h
96 lines (82 loc) · 1.63 KB
/
types.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <pthread.h>
typedef double decimal;
#define SIGMOID(x) (2 / (1 + exp(x)) - 1)
// decimal dsigmoid(decimal x) { return x * (1 - x); }
#define RAD(deg) ((deg) * 0.01745329)
#define DEG(rad) ((rad) * 57.29578 )
#define RANDOMDECIMAL() ((((decimal)rand() / (decimal)RAND_MAX) - 0.5) * 2)
struct Pos {
decimal x;
decimal y;
};
struct Controller {
unsigned int forward;
unsigned int left;
unsigned int right;
};
struct Eyes {
decimal resolution;
unsigned int forward;
unsigned int left;
unsigned int right;
unsigned int softleft;
unsigned int softright;
};
struct Physics {
decimal roadfriction;
decimal accel;
decimal forwardaccel;
decimal wheeldirfriction;
decimal wheeldiraccel;
decimal wheelmaxdir;
decimal wheelturnback;
};
struct Nodeconnection {
unsigned int i;
decimal weight;
};
struct Node {
unsigned int vallen;
decimal val;
decimal bias;
unsigned int destlen;
struct Nodeconnection *dest;
};
struct Car {
unsigned int id;
unsigned int sprite;
unsigned int alive;
struct Controller controller;
struct Eyes eyes;
struct Physics physics;
struct Pos pos;
struct Pos vel;
decimal forwardvel;
decimal dir;
decimal wheeldir;
decimal wheeldirvel;
// unsigned int skid;
// unsigned int skidlen;
// struct Pos skidpos[50];
unsigned int aienabled;
unsigned int maxroadval;
decimal fitness;
unsigned int nodelen;
struct Node *node;
};
struct Thread {
pthread_t thread;
unsigned int id;
struct Car *start;
unsigned int size;
unsigned int alive;
};
struct Map {
unsigned int x;
unsigned int y;
unsigned char* data;
};