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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
--- lib/neuralnet.c.old 2006-01-29 11:16:30.000000000 -0700
+++ lib/neuralnet.c 2006-01-29 11:21:10.000000000 -0700
@@ -386,13 +386,15 @@
}
extern void *NeuralNetCreateDirect( neuralnet *pnn, void *p ) {
- pnn->cInput = *( ( (int *) p )++ );
- pnn->cHidden = *( ( (int *) p )++ );
- pnn->cOutput = *( ( (int *) p )++ );
- pnn->nTrained = *( ( (int *) p )++ );
+ int *ip = (int *)p;
+ pnn->cInput = *( ip++ );
+ pnn->cHidden = *( ip++ );
+ pnn->cOutput = *( ip++ );
+ pnn->nTrained = *( ip++ );
pnn->fDirect = TRUE;
- pnn->rBetaHidden = *( ( (float *) p )++ );
- pnn->rBetaOutput = *( ( (float *) p )++ );
+ float *fp = (float *)ip;
+ pnn->rBetaHidden = *( fp++ );
+ pnn->rBetaOutput = *( fp++ );
if( pnn->cInput < 1 || pnn->cHidden < 1 || pnn->cOutput < 1 ||
pnn->nTrained < 0 || pnn->rBetaHidden <= 0.0 ||
@@ -402,19 +404,19 @@
return NULL;
}
- pnn->arHiddenWeight = p;
- ( (float *) p ) += pnn->cInput * pnn->cHidden;
- pnn->arOutputWeight = p;
- ( (float *) p ) += pnn->cHidden * pnn->cOutput;
- pnn->arHiddenThreshold = p;
- ( (float *) p ) += pnn->cHidden;
- pnn->arOutputThreshold = p;
- ( (float *) p ) += pnn->cOutput;
+ pnn->arHiddenWeight = (void *)fp;
+ fp += pnn->cInput * pnn->cHidden;
+ pnn->arOutputWeight = (void *)fp;
+ fp += pnn->cHidden * pnn->cOutput;
+ pnn->arHiddenThreshold = (void *)fp;
+ fp += pnn->cHidden;
+ pnn->arOutputThreshold = (void *)fp;
+ fp += pnn->cOutput;
pnn->savedBase = malloc( pnn->cHidden * sizeof( float ) );
pnn->savedIBase = malloc( pnn->cInput * sizeof( float ) );
- return p;
+ return (void *)fp;
}
extern int
--- eval.c.old 2006-01-29 11:24:57.000000000 -0700
+++ eval.c 2006-01-29 11:27:35.000000000 -0700
@@ -798,7 +798,9 @@
if( !fstat( h, &st ) &&
( p = mmap( NULL, st.st_size, PROT_READ | PROT_WRITE,
MAP_PRIVATE, h, 0 ) ) ) {
- ( (float *) p ) += 2; /* skip magic number and version */
+ float *fp = (float *)p;
+ fp += 2; /* skip magic number and version */
+ p = (void *)fp;
fReadWeights =
( p = NeuralNetCreateDirect( &nnContact, p ) ) &&
( p = NeuralNetCreateDirect( &nnRace, p ) ) &&
--- rollout.c.old 2006-01-29 11:32:54.000000000 -0700
+++ rollout.c 2006-01-29 11:32:58.000000000 -0700
@@ -219,7 +219,7 @@
nPermutationSeed = n;
}
-static int nSkip;
+static int nSkip_local;
static int RolloutDice( int iTurn, int iGame, int cGames,
int fInitial,
@@ -234,10 +234,10 @@
int j;
if( !iGame )
- nSkip = 0;
+ nSkip_local = 0;
- for( ; ; nSkip++ ) {
- j = aaanPermutation[ 0 ][ 0 ][ ( iGame + nSkip ) % 36 ];
+ for( ; ; nSkip_local++ ) {
+ j = aaanPermutation[ 0 ][ 0 ][ ( iGame + nSkip_local ) % 36 ];
anDice[ 0 ] = j / 6 + 1;
anDice[ 1 ] = j % 6 + 1;
@@ -265,7 +265,7 @@
k; /* 36**i */
for( i = 0, j = 0, k = 1; i < 6 && i <= iTurn; i++, k *= 36 )
- j = aaanPermutation[ i ][ iTurn ][ ( (iGame + nSkip) / k + j ) % 36 ];
+ j = aaanPermutation[ i ][ iTurn ][ ( (iGame + nSkip_local) / k + j ) % 36 ];
anDice[ 0 ] = j / 6 + 1;
anDice[ 1 ] = j % 6 + 1;
@@ -1173,7 +1173,7 @@
if( prc->fRotate )
QuasiRandomSeed( prc->nSeed );
- nSkip = prc->nSkip;
+ nSkip_local = prc->nSkip;
/* ... and the RNG */
if( prc->rngRollout != RNG_MANUAL )
@@ -1672,7 +1672,7 @@
return -1;
pes->rc.nGamesDone = cGames;
- pes->rc.nSkip = nSkip;
+ pes->rc.nSkip = nSkip_local;
return 0;
|