WPBDC 2013.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/WPBDC/WPBDC.c +237 -0
- data/ext/WPBDC/analysis.c +672 -0
- data/ext/WPBDC/bridge.c +288 -0
- data/ext/WPBDC/bridge_cost.c +60 -0
- data/ext/WPBDC/bridge_hash.c +126 -0
- data/ext/WPBDC/bridge_parser.c +1119 -0
- data/ext/WPBDC/bridge_random.c +292 -0
- data/ext/WPBDC/bridge_sketch.c +125 -0
- data/ext/WPBDC/extconf.rb +5 -0
- data/ext/WPBDC/geometry.c +46 -0
- data/ext/WPBDC/internal.h +518 -0
- data/ext/WPBDC/judge.c +563 -0
- data/ext/WPBDC/judge.h +142 -0
- data/ext/WPBDC/loading.c +128 -0
- data/ext/WPBDC/params.c +166 -0
- data/ext/WPBDC/proto.h +98 -0
- data/ext/WPBDC/rc4.c +62 -0
- data/ext/WPBDC/rc4.h +19 -0
- data/ext/WPBDC/rc4_key.c +2 -0
- data/ext/WPBDC/rubydefs.h +75 -0
- data/ext/WPBDC/scenario.c +671 -0
- data/ext/WPBDC/sketch.c +496 -0
- data/ext/WPBDC/sketch.h +51 -0
- data/ext/WPBDC/stdafx.h +11 -0
- data/lib/WPBDC.rb +9 -0
- metadata +71 -0
@@ -0,0 +1,671 @@
|
|
1
|
+
#include "stdafx.h"
|
2
|
+
#include "internal.h"
|
3
|
+
|
4
|
+
// Scenario descriptors
|
5
|
+
|
6
|
+
// Note the index values are used in the hash function, so don't
|
7
|
+
// fiddle with the indices between main contest and semi-finals.
|
8
|
+
// The indices do _not_ have to be in order.
|
9
|
+
|
10
|
+
// Lookup table is sorted on 10-char ID field for binary search.
|
11
|
+
static TScenarioDescriptor scenario_descriptor_tbl[] = {
|
12
|
+
{ 0, "1050824100", "27A", 99874.40 },
|
13
|
+
{ 1, "1051220100", "32A", 105140.00 },
|
14
|
+
{ 2, "1051616100", "36A", 111994.40 },
|
15
|
+
{ 3, "1052012100", "39A", 116437.60 },
|
16
|
+
{ 4, "1052408100", "41A", 122469.60 },
|
17
|
+
{ 5, "1052804100", "42A", 127090.40 },
|
18
|
+
{ 6, "1053200000", "07A", 132250.00 },
|
19
|
+
{ 7, "1053200031", "70A", 136750.00 },
|
20
|
+
{ 8, "1053200200", "14A", 138250.00 },
|
21
|
+
{ 9, "1053200300", "21A", 144250.00 },
|
22
|
+
{ 10, "1053200331", "98A", 148750.00 },
|
23
|
+
{ 11, "1060820100", "26A", 95590.00 },
|
24
|
+
{ 12, "1061216100", "31A", 101444.40 },
|
25
|
+
{ 13, "1061612100", "35A", 108887.60 },
|
26
|
+
{ 14, "1062008100", "38A", 113919.60 },
|
27
|
+
{ 15, "1062404100", "40A", 120540.40 },
|
28
|
+
{ 16, "1062804000", "06A", 123100.00 },
|
29
|
+
{ 17, "1062804040", "68A", 126600.00 },
|
30
|
+
{ 18, "1062804041", "69A", 128600.00 },
|
31
|
+
{ 19, "1062804200", "13A", 129100.00 },
|
32
|
+
{ 20, "1062804300", "20A", 135100.00 },
|
33
|
+
{ 21, "1062804340", "96A", 138600.00 },
|
34
|
+
{ 22, "1062804341", "97A", 140600.00 },
|
35
|
+
{ 23, "1070816100", "25A", 91894.40 },
|
36
|
+
{ 24, "1071212100", "30A", 98337.60 },
|
37
|
+
{ 25, "1071608100", "34A", 106369.60 },
|
38
|
+
{ 26, "1072004100", "37A", 111990.40 },
|
39
|
+
{ 27, "1072404040", "66A", 119950.00 },
|
40
|
+
{ 28, "1072404340", "94A", 131950.00 },
|
41
|
+
{ 29, "1072408000", "05A", 113950.00 },
|
42
|
+
{ 30, "1072408040", "65A", 117950.00 },
|
43
|
+
{ 31, "1072408041", "67A", 121950.00 },
|
44
|
+
{ 32, "1072408200", "12A", 119950.00 },
|
45
|
+
{ 33, "1072408300", "19A", 125950.00 },
|
46
|
+
{ 34, "1072408340", "93A", 129950.00 },
|
47
|
+
{ 35, "1072408341", "95A", 133950.00 },
|
48
|
+
{ 36, "1080812100", "24A", 88787.60 },
|
49
|
+
{ 37, "1081208100", "29A", 95819.60 },
|
50
|
+
{ 38, "1081604100", "33A", 104440.40 },
|
51
|
+
{ 39, "1082004050", "63A", 109800.00 },
|
52
|
+
{ 40, "1082004350", "91A", 121800.00 },
|
53
|
+
{ 41, "1082008050", "62A", 107800.00 },
|
54
|
+
{ 42, "1082008350", "90A", 119800.00 },
|
55
|
+
{ 43, "1082012000", "04A", 102800.00 },
|
56
|
+
{ 44, "1082012050", "61A", 105800.00 },
|
57
|
+
{ 45, "1082012051", "64A", 111800.00 },
|
58
|
+
{ 46, "1082012200", "11A", 108800.00 },
|
59
|
+
{ 47, "1082012300", "18A", 114800.00 },
|
60
|
+
{ 48, "1082012350", "89A", 117800.00 },
|
61
|
+
{ 49, "1082012351", "92A", 123800.00 },
|
62
|
+
{ 50, "1090808100", "23A", 86269.60 },
|
63
|
+
{ 51, "1091204100", "28A", 93890.40 },
|
64
|
+
{ 52, "1091604050", "59A", 102150.00 },
|
65
|
+
{ 53, "1091604350", "87A", 114150.00 },
|
66
|
+
{ 54, "1091608050", "58A", 100150.00 },
|
67
|
+
{ 55, "1091608350", "86A", 112150.00 },
|
68
|
+
{ 56, "1091612050", "57A", 98150.00 },
|
69
|
+
{ 57, "1091612350", "85A", 110150.00 },
|
70
|
+
{ 58, "1091616000", "03A", 92650.00 },
|
71
|
+
{ 59, "1091616050", "56A", 96150.00 },
|
72
|
+
{ 60, "1091616051", "60A", 104150.00 },
|
73
|
+
{ 61, "1091616200", "10A", 98650.00 },
|
74
|
+
{ 62, "1091616300", "17A", 104650.00 },
|
75
|
+
{ 63, "1091616350", "84A", 108150.00 },
|
76
|
+
{ 64, "1091616351", "88A", 116150.00 },
|
77
|
+
{ 65, "1100804100", "22A", 84340.40 },
|
78
|
+
{ 66, "1101204060", "54A", 90000.00 },
|
79
|
+
{ 67, "1101204360", "82A", 102000.00 },
|
80
|
+
{ 68, "1101208060", "53A", 88000.00 },
|
81
|
+
{ 69, "1101208360", "81A", 100000.00 },
|
82
|
+
{ 70, "1101212060", "52A", 86000.00 },
|
83
|
+
{ 71, "1101212360", "80A", 98000.00 },
|
84
|
+
{ 72, "1101216060", "51A", 84000.00 },
|
85
|
+
{ 73, "1101216360", "79A", 96000.00 },
|
86
|
+
{ 74, "1101220000", "02A", 79500.00 },
|
87
|
+
{ 75, "1101220060", "50A", 82000.00 },
|
88
|
+
{ 76, "1101220061", "55A", 92000.00 },
|
89
|
+
{ 77, "1101220200", "09A", 85500.00 },
|
90
|
+
{ 78, "1101220300", "16A", 91500.00 },
|
91
|
+
{ 79, "1101220360", "78A", 94000.00 },
|
92
|
+
{ 80, "1101220361", "83A", 104000.00 },
|
93
|
+
{ 81, "1110804060", "48A", 80350.00 },
|
94
|
+
{ 82, "1110804360", "76A", 92350.00 },
|
95
|
+
{ 83, "1110808060", "47A", 78350.00 },
|
96
|
+
{ 84, "1110808360", "75A", 90350.00 },
|
97
|
+
{ 85, "1110812060", "46A", 76350.00 },
|
98
|
+
{ 86, "1110812360", "74A", 88350.00 },
|
99
|
+
{ 87, "1110816060", "45A", 74350.00 },
|
100
|
+
{ 88, "1110816360", "73A", 86350.00 },
|
101
|
+
{ 89, "1110820060", "44A", 72350.00 },
|
102
|
+
{ 90, "1110820360", "72A", 84350.00 },
|
103
|
+
{ 91, "1110824000", "01A", 67350.00 },
|
104
|
+
{ 92, "1110824060", "43A", 70350.00 },
|
105
|
+
{ 93, "1110824061", "49A", 82350.00 },
|
106
|
+
{ 94, "1110824200", "08A", 73350.00 },
|
107
|
+
{ 95, "1110824300", "15A", 79350.00 },
|
108
|
+
{ 96, "1110824360", "71A", 82350.00 },
|
109
|
+
{ 97, "1110824361", "77A", 94350.00 },
|
110
|
+
{ 98, "2050824100", "27B", 99874.40 },
|
111
|
+
{ 99, "2051220100", "32B", 105140.00 },
|
112
|
+
{ 100, "2051616100", "36B", 111994.40 },
|
113
|
+
{ 101, "2052012100", "39B", 116437.60 },
|
114
|
+
{ 102, "2052408100", "41B", 122469.60 },
|
115
|
+
{ 103, "2052804100", "42B", 127090.40 },
|
116
|
+
{ 104, "2053200000", "07B", 132250.00 },
|
117
|
+
{ 105, "2053200031", "70B", 136750.00 },
|
118
|
+
{ 106, "2053200200", "14B", 138250.00 },
|
119
|
+
{ 107, "2053200300", "21B", 144250.00 },
|
120
|
+
{ 108, "2053200331", "98B", 148750.00 },
|
121
|
+
{ 109, "2060820100", "26B", 95590.00 },
|
122
|
+
{ 110, "2061216100", "31B", 101444.40 },
|
123
|
+
{ 111, "2061612100", "35B", 108887.60 },
|
124
|
+
{ 112, "2062008100", "38B", 113919.60 },
|
125
|
+
{ 113, "2062404100", "40B", 120540.40 },
|
126
|
+
{ 114, "2062804000", "06B", 123100.00 },
|
127
|
+
{ 115, "2062804040", "68B", 126600.00 },
|
128
|
+
{ 116, "2062804041", "69B", 128600.00 },
|
129
|
+
{ 117, "2062804200", "13B", 129100.00 },
|
130
|
+
{ 118, "2062804300", "20B", 135100.00 },
|
131
|
+
{ 119, "2062804340", "96B", 138600.00 },
|
132
|
+
{ 120, "2062804341", "97B", 140600.00 },
|
133
|
+
{ 121, "2070816100", "25B", 91894.40 },
|
134
|
+
{ 122, "2071212100", "30B", 98337.60 },
|
135
|
+
{ 123, "2071608100", "34B", 106369.60 },
|
136
|
+
{ 124, "2072004100", "37B", 111990.40 },
|
137
|
+
{ 125, "2072404040", "66B", 119950.00 },
|
138
|
+
{ 126, "2072404340", "94B", 131950.00 },
|
139
|
+
{ 127, "2072408000", "05B", 113950.00 },
|
140
|
+
{ 128, "2072408040", "65B", 117950.00 },
|
141
|
+
{ 129, "2072408041", "67B", 121950.00 },
|
142
|
+
{ 130, "2072408200", "12B", 119950.00 },
|
143
|
+
{ 131, "2072408300", "19B", 125950.00 },
|
144
|
+
{ 132, "2072408340", "93B", 129950.00 },
|
145
|
+
{ 133, "2072408341", "95B", 133950.00 },
|
146
|
+
{ 134, "2080812100", "24B", 88787.60 },
|
147
|
+
{ 135, "2081208100", "29B", 95819.60 },
|
148
|
+
{ 136, "2081604100", "33B", 104440.40 },
|
149
|
+
{ 137, "2082004050", "63B", 109800.00 },
|
150
|
+
{ 138, "2082004350", "91B", 121800.00 },
|
151
|
+
{ 139, "2082008050", "62B", 107800.00 },
|
152
|
+
{ 140, "2082008350", "90B", 119800.00 },
|
153
|
+
{ 141, "2082012000", "04B", 102800.00 },
|
154
|
+
{ 142, "2082012050", "61B", 105800.00 },
|
155
|
+
{ 143, "2082012051", "64B", 111800.00 },
|
156
|
+
{ 144, "2082012200", "11B", 108800.00 },
|
157
|
+
{ 145, "2082012300", "18B", 114800.00 },
|
158
|
+
{ 146, "2082012350", "89B", 117800.00 },
|
159
|
+
{ 147, "2082012351", "92B", 123800.00 },
|
160
|
+
{ 148, "2090808100", "23B", 86269.60 },
|
161
|
+
{ 149, "2091204100", "28B", 93890.40 },
|
162
|
+
{ 150, "2091604050", "59B", 102150.00 },
|
163
|
+
{ 151, "2091604350", "87B", 114150.00 },
|
164
|
+
{ 152, "2091608050", "58B", 100150.00 },
|
165
|
+
{ 153, "2091608350", "86B", 112150.00 },
|
166
|
+
{ 154, "2091612050", "57B", 98150.00 },
|
167
|
+
{ 155, "2091612350", "85B", 110150.00 },
|
168
|
+
{ 156, "2091616000", "03B", 92650.00 },
|
169
|
+
{ 157, "2091616050", "56B", 96150.00 },
|
170
|
+
{ 158, "2091616051", "60B", 104150.00 },
|
171
|
+
{ 159, "2091616200", "10B", 98650.00 },
|
172
|
+
{ 160, "2091616300", "17B", 104650.00 },
|
173
|
+
{ 161, "2091616350", "84B", 108150.00 },
|
174
|
+
{ 162, "2091616351", "88B", 116150.00 },
|
175
|
+
{ 163, "2100804100", "22B", 84340.40 },
|
176
|
+
{ 164, "2101204060", "54B", 90000.00 },
|
177
|
+
{ 165, "2101204360", "82B", 102000.00 },
|
178
|
+
{ 166, "2101208060", "53B", 88000.00 },
|
179
|
+
{ 167, "2101208360", "81B", 100000.00 },
|
180
|
+
{ 168, "2101212060", "52B", 86000.00 },
|
181
|
+
{ 169, "2101212360", "80B", 98000.00 },
|
182
|
+
{ 170, "2101216060", "51B", 84000.00 },
|
183
|
+
{ 171, "2101216360", "79B", 96000.00 },
|
184
|
+
{ 172, "2101220000", "02B", 79500.00 },
|
185
|
+
{ 173, "2101220060", "50B", 82000.00 },
|
186
|
+
{ 174, "2101220061", "55B", 92000.00 },
|
187
|
+
{ 175, "2101220200", "09B", 85500.00 },
|
188
|
+
{ 176, "2101220300", "16B", 91500.00 },
|
189
|
+
{ 177, "2101220360", "78B", 94000.00 },
|
190
|
+
{ 178, "2101220361", "83B", 104000.00 },
|
191
|
+
{ 179, "2110804060", "48B", 80350.00 },
|
192
|
+
{ 180, "2110804360", "76B", 92350.00 },
|
193
|
+
{ 181, "2110808060", "47B", 78350.00 },
|
194
|
+
{ 182, "2110808360", "75B", 90350.00 },
|
195
|
+
{ 183, "2110812060", "46B", 76350.00 },
|
196
|
+
{ 184, "2110812360", "74B", 88350.00 },
|
197
|
+
{ 185, "2110816060", "45B", 74350.00 },
|
198
|
+
{ 186, "2110816360", "73B", 86350.00 },
|
199
|
+
{ 187, "2110820060", "44B", 72350.00 },
|
200
|
+
{ 188, "2110820360", "72B", 84350.00 },
|
201
|
+
{ 189, "2110824000", "01B", 67350.00 },
|
202
|
+
{ 190, "2110824060", "43B", 70350.00 },
|
203
|
+
{ 191, "2110824061", "49B", 82350.00 },
|
204
|
+
{ 192, "2110824200", "08B", 73350.00 },
|
205
|
+
{ 193, "2110824300", "15B", 79350.00 },
|
206
|
+
{ 194, "2110824360", "71B", 82350.00 },
|
207
|
+
{ 195, "2110824361", "77B", 94350.00 },
|
208
|
+
{ 196, "3050824100", "27C", 102124.40 },
|
209
|
+
{ 197, "3051220100", "32C", 107390.00 },
|
210
|
+
{ 198, "3051616100", "36C", 114244.40 },
|
211
|
+
{ 199, "3052012100", "39C", 118687.60 },
|
212
|
+
{ 200, "3052408100", "41C", 124719.60 },
|
213
|
+
{ 201, "3052804100", "42C", 129340.40 },
|
214
|
+
{ 202, "3053200000", "07C", 134500.00 },
|
215
|
+
{ 203, "3053200031", "70C", 139000.00 },
|
216
|
+
{ 204, "3053200200", "14C", 140500.00 },
|
217
|
+
{ 205, "3053200300", "21C", 146500.00 },
|
218
|
+
{ 206, "3053200331", "98C", 151000.00 },
|
219
|
+
{ 207, "3060820100", "26C", 98290.00 },
|
220
|
+
{ 208, "3061216100", "31C", 104144.40 },
|
221
|
+
{ 209, "3061612100", "35C", 111587.60 },
|
222
|
+
{ 210, "3062008100", "38C", 116619.60 },
|
223
|
+
{ 211, "3062404100", "40C", 123240.40 },
|
224
|
+
{ 212, "3062804000", "06C", 125800.00 },
|
225
|
+
{ 213, "3062804040", "68C", 129300.00 },
|
226
|
+
{ 214, "3062804041", "69C", 131300.00 },
|
227
|
+
{ 215, "3062804200", "13C", 131800.00 },
|
228
|
+
{ 216, "3062804300", "20C", 137800.00 },
|
229
|
+
{ 217, "3062804340", "96C", 141300.00 },
|
230
|
+
{ 218, "3062804341", "97C", 143300.00 },
|
231
|
+
{ 219, "3070816100", "25C", 95044.40 },
|
232
|
+
{ 220, "3071212100", "30C", 101487.60 },
|
233
|
+
{ 221, "3071608100", "34C", 109519.60 },
|
234
|
+
{ 222, "3072004100", "37C", 115140.40 },
|
235
|
+
{ 223, "3072404040", "66C", 123100.00 },
|
236
|
+
{ 224, "3072404340", "94C", 135100.00 },
|
237
|
+
{ 225, "3072408000", "05C", 117100.00 },
|
238
|
+
{ 226, "3072408040", "65C", 121100.00 },
|
239
|
+
{ 227, "3072408041", "67C", 125100.00 },
|
240
|
+
{ 228, "3072408200", "12C", 123100.00 },
|
241
|
+
{ 229, "3072408300", "19C", 129100.00 },
|
242
|
+
{ 230, "3072408340", "93C", 133100.00 },
|
243
|
+
{ 231, "3072408341", "95C", 137100.00 },
|
244
|
+
{ 232, "3080812100", "24C", 92387.60 },
|
245
|
+
{ 233, "3081208100", "29C", 99419.60 },
|
246
|
+
{ 234, "3081604100", "33C", 108040.40 },
|
247
|
+
{ 235, "3082004050", "63C", 113400.00 },
|
248
|
+
{ 236, "3082004350", "91C", 125400.00 },
|
249
|
+
{ 237, "3082008050", "62C", 111400.00 },
|
250
|
+
{ 238, "3082008350", "90C", 123400.00 },
|
251
|
+
{ 239, "3082012000", "04C", 106400.00 },
|
252
|
+
{ 240, "3082012050", "61C", 109400.00 },
|
253
|
+
{ 241, "3082012051", "64C", 115400.00 },
|
254
|
+
{ 242, "3082012200", "11C", 112400.00 },
|
255
|
+
{ 243, "3082012300", "18C", 118400.00 },
|
256
|
+
{ 244, "3082012350", "89C", 121400.00 },
|
257
|
+
{ 245, "3082012351", "92C", 127400.00 },
|
258
|
+
{ 246, "3090808100", "23C", 90319.60 },
|
259
|
+
{ 247, "3091204100", "28C", 97940.40 },
|
260
|
+
{ 248, "3091604050", "59C", 106200.00 },
|
261
|
+
{ 249, "3091604350", "87C", 118200.00 },
|
262
|
+
{ 250, "3091608050", "58C", 104200.00 },
|
263
|
+
{ 251, "3091608350", "86C", 116200.00 },
|
264
|
+
{ 252, "3091612050", "57C", 102200.00 },
|
265
|
+
{ 253, "3091612350", "85C", 114200.00 },
|
266
|
+
{ 254, "3091616000", "03C", 96700.00 },
|
267
|
+
{ 255, "3091616050", "56C", 100200.00 },
|
268
|
+
{ 256, "3091616051", "60C", 108200.00 },
|
269
|
+
{ 257, "3091616200", "10C", 102700.00 },
|
270
|
+
{ 258, "3091616300", "17C", 108700.00 },
|
271
|
+
{ 259, "3091616350", "84C", 112200.00 },
|
272
|
+
{ 260, "3091616351", "88C", 120200.00 },
|
273
|
+
{ 261, "3100804100", "22C", 88840.40 },
|
274
|
+
{ 262, "3101204060", "54C", 94500.00 },
|
275
|
+
{ 263, "3101204360", "82C", 106500.00 },
|
276
|
+
{ 264, "3101208060", "53C", 92500.00 },
|
277
|
+
{ 265, "3101208360", "81C", 104500.00 },
|
278
|
+
{ 266, "3101212060", "52C", 90500.00 },
|
279
|
+
{ 267, "3101212360", "80C", 102500.00 },
|
280
|
+
{ 268, "3101216060", "51C", 88500.00 },
|
281
|
+
{ 269, "3101216360", "79C", 100500.00 },
|
282
|
+
{ 270, "3101220000", "02C", 84000.00 },
|
283
|
+
{ 271, "3101220060", "50C", 86500.00 },
|
284
|
+
{ 272, "3101220061", "55C", 96500.00 },
|
285
|
+
{ 273, "3101220200", "09C", 90000.00 },
|
286
|
+
{ 274, "3101220300", "16C", 96000.00 },
|
287
|
+
{ 275, "3101220360", "78C", 98500.00 },
|
288
|
+
{ 276, "3101220361", "83C", 108500.00 },
|
289
|
+
{ 277, "3110804060", "48C", 85300.00 },
|
290
|
+
{ 278, "3110804360", "76C", 97300.00 },
|
291
|
+
{ 279, "3110808060", "47C", 83300.00 },
|
292
|
+
{ 280, "3110808360", "75C", 95300.00 },
|
293
|
+
{ 281, "3110812060", "46C", 81300.00 },
|
294
|
+
{ 282, "3110812360", "74C", 93300.00 },
|
295
|
+
{ 283, "3110816060", "45C", 79300.00 },
|
296
|
+
{ 284, "3110816360", "73C", 91300.00 },
|
297
|
+
{ 285, "3110820060", "44C", 77300.00 },
|
298
|
+
{ 286, "3110820360", "72C", 89300.00 },
|
299
|
+
{ 287, "3110824000", "01C", 72300.00 },
|
300
|
+
{ 288, "3110824060", "43C", 75300.00 },
|
301
|
+
{ 289, "3110824061", "49C", 87300.00 },
|
302
|
+
{ 290, "3110824200", "08C", 78300.00 },
|
303
|
+
{ 291, "3110824300", "15C", 84300.00 },
|
304
|
+
{ 292, "3110824360", "71C", 87300.00 },
|
305
|
+
{ 293, "3110824361", "77C", 99300.00 },
|
306
|
+
{ 294, "4050824100", "27D", 102124.40 },
|
307
|
+
{ 295, "4051220100", "32D", 107390.00 },
|
308
|
+
{ 296, "4051616100", "36D", 114244.40 },
|
309
|
+
{ 297, "4052012100", "39D", 118687.60 },
|
310
|
+
{ 298, "4052408100", "41D", 124719.60 },
|
311
|
+
{ 299, "4052804100", "42D", 129340.40 },
|
312
|
+
{ 300, "4053200000", "07D", 134500.00 },
|
313
|
+
{ 301, "4053200031", "70D", 139000.00 },
|
314
|
+
{ 302, "4053200200", "14D", 140500.00 },
|
315
|
+
{ 303, "4053200300", "21D", 146500.00 },
|
316
|
+
{ 304, "4053200331", "98D", 151000.00 },
|
317
|
+
{ 305, "4060820100", "26D", 98290.00 },
|
318
|
+
{ 306, "4061216100", "31D", 104144.40 },
|
319
|
+
{ 307, "4061612100", "35D", 111587.60 },
|
320
|
+
{ 308, "4062008100", "38D", 116619.60 },
|
321
|
+
{ 309, "4062404100", "40D", 123240.40 },
|
322
|
+
{ 310, "4062804000", "06D", 125800.00 },
|
323
|
+
{ 311, "4062804040", "68D", 129300.00 },
|
324
|
+
{ 312, "4062804041", "69D", 131300.00 },
|
325
|
+
{ 313, "4062804200", "13D", 131800.00 },
|
326
|
+
{ 314, "4062804300", "20D", 137800.00 },
|
327
|
+
{ 315, "4062804340", "96D", 141300.00 },
|
328
|
+
{ 316, "4062804341", "97D", 143300.00 },
|
329
|
+
{ 317, "4070816100", "25D", 95044.40 },
|
330
|
+
{ 318, "4071212100", "30D", 101487.60 },
|
331
|
+
{ 319, "4071608100", "34D", 109519.60 },
|
332
|
+
{ 320, "4072004100", "37D", 115140.40 },
|
333
|
+
{ 321, "4072404040", "66D", 123100.00 },
|
334
|
+
{ 322, "4072404340", "94D", 135100.00 },
|
335
|
+
{ 323, "4072408000", "05D", 117100.00 },
|
336
|
+
{ 324, "4072408040", "65D", 121100.00 },
|
337
|
+
{ 325, "4072408041", "67D", 125100.00 },
|
338
|
+
{ 326, "4072408200", "12D", 123100.00 },
|
339
|
+
{ 327, "4072408300", "19D", 129100.00 },
|
340
|
+
{ 328, "4072408340", "93D", 133100.00 },
|
341
|
+
{ 329, "4072408341", "95D", 137100.00 },
|
342
|
+
{ 330, "4080812100", "24D", 92387.60 },
|
343
|
+
{ 331, "4081208100", "29D", 99419.60 },
|
344
|
+
{ 332, "4081604100", "33D", 108040.40 },
|
345
|
+
{ 333, "4082004050", "63D", 113400.00 },
|
346
|
+
{ 334, "4082004350", "91D", 125400.00 },
|
347
|
+
{ 335, "4082008050", "62D", 111400.00 },
|
348
|
+
{ 336, "4082008350", "90D", 123400.00 },
|
349
|
+
{ 337, "4082012000", "04D", 106400.00 },
|
350
|
+
{ 338, "4082012050", "61D", 109400.00 },
|
351
|
+
{ 339, "4082012051", "64D", 115400.00 },
|
352
|
+
{ 340, "4082012200", "11D", 112400.00 },
|
353
|
+
{ 341, "4082012300", "18D", 118400.00 },
|
354
|
+
{ 342, "4082012350", "89D", 121400.00 },
|
355
|
+
{ 343, "4082012351", "92D", 127400.00 },
|
356
|
+
{ 344, "4090808100", "23D", 90319.60 },
|
357
|
+
{ 345, "4091204100", "28D", 97940.40 },
|
358
|
+
{ 346, "4091604050", "59D", 106200.00 },
|
359
|
+
{ 347, "4091604350", "87D", 118200.00 },
|
360
|
+
{ 348, "4091608050", "58D", 104200.00 },
|
361
|
+
{ 349, "4091608350", "86D", 116200.00 },
|
362
|
+
{ 350, "4091612050", "57D", 102200.00 },
|
363
|
+
{ 351, "4091612350", "85D", 114200.00 },
|
364
|
+
{ 352, "4091616000", "03D", 96700.00 },
|
365
|
+
{ 353, "4091616050", "56D", 100200.00 },
|
366
|
+
{ 354, "4091616051", "60D", 108200.00 },
|
367
|
+
{ 355, "4091616200", "10D", 102700.00 },
|
368
|
+
{ 356, "4091616300", "17D", 108700.00 },
|
369
|
+
{ 357, "4091616350", "84D", 112200.00 },
|
370
|
+
{ 358, "4091616351", "88D", 120200.00 },
|
371
|
+
{ 359, "4100804100", "22D", 88840.40 },
|
372
|
+
{ 360, "4101204060", "54D", 94500.00 },
|
373
|
+
{ 361, "4101204360", "82D", 106500.00 },
|
374
|
+
{ 362, "4101208060", "53D", 92500.00 },
|
375
|
+
{ 363, "4101208360", "81D", 104500.00 },
|
376
|
+
{ 364, "4101212060", "52D", 90500.00 },
|
377
|
+
{ 365, "4101212360", "80D", 102500.00 },
|
378
|
+
{ 366, "4101216060", "51D", 88500.00 },
|
379
|
+
{ 367, "4101216360", "79D", 100500.00 },
|
380
|
+
{ 368, "4101220000", "02D", 84000.00 },
|
381
|
+
{ 369, "4101220060", "50D", 86500.00 },
|
382
|
+
{ 370, "4101220061", "55D", 96500.00 },
|
383
|
+
{ 371, "4101220200", "09D", 90000.00 },
|
384
|
+
{ 372, "4101220300", "16D", 96000.00 },
|
385
|
+
{ 373, "4101220360", "78D", 98500.00 },
|
386
|
+
{ 374, "4101220361", "83D", 108500.00 },
|
387
|
+
{ 375, "4110804060", "48D", 85300.00 },
|
388
|
+
{ 376, "4110804360", "76D", 97300.00 },
|
389
|
+
{ 377, "4110808060", "47D", 83300.00 },
|
390
|
+
{ 378, "4110808360", "75D", 95300.00 },
|
391
|
+
{ 379, "4110812060", "46D", 81300.00 },
|
392
|
+
{ 380, "4110812360", "74D", 93300.00 },
|
393
|
+
{ 381, "4110816060", "45D", 79300.00 },
|
394
|
+
{ 382, "4110816360", "73D", 91300.00 },
|
395
|
+
{ 383, "4110820060", "44D", 77300.00 },
|
396
|
+
{ 384, "4110820360", "72D", 89300.00 },
|
397
|
+
{ 385, "4110824000", "01D", 72300.00 },
|
398
|
+
{ 386, "4110824060", "43D", 75300.00 },
|
399
|
+
{ 387, "4110824061", "49D", 87300.00 },
|
400
|
+
{ 388, "4110824200", "08D", 78300.00 },
|
401
|
+
{ 389, "4110824300", "15D", 84300.00 },
|
402
|
+
{ 390, "4110824360", "71D", 87300.00 },
|
403
|
+
{ 391, "4110824361", "77D", 99300.00 },
|
404
|
+
};
|
405
|
+
|
406
|
+
static int to_upper_case(int c)
|
407
|
+
{
|
408
|
+
return ('a' <= c && c <= 'z') ? c + ('A' - 'a') : c;
|
409
|
+
}
|
410
|
+
|
411
|
+
static TBool scenario_numbers_equal(char *a, char *b)
|
412
|
+
{
|
413
|
+
return a[0] == b[0] && a[1] == b[1] && to_upper_case(a[2]) == to_upper_case(b[2]);
|
414
|
+
}
|
415
|
+
|
416
|
+
// Input must be a string of length at least 3.
|
417
|
+
char *local_contest_number_to_id(char *number)
|
418
|
+
{
|
419
|
+
unsigned i;
|
420
|
+
|
421
|
+
for (i = 0; i < STATIC_ARRAY_SIZE(scenario_descriptor_tbl); i++)
|
422
|
+
if (scenario_numbers_equal(scenario_descriptor_tbl[i].number, number))
|
423
|
+
return scenario_descriptor_tbl[i].id;
|
424
|
+
return NULL;
|
425
|
+
}
|
426
|
+
|
427
|
+
int lookup_scenario_descriptor(TScenarioDescriptor *desc, char *id)
|
428
|
+
{
|
429
|
+
static TScenarioDescriptor null_desc = NULL_SCENARIO_DESCRIPTOR;
|
430
|
+
int lo = 0;
|
431
|
+
int hi = STATIC_ARRAY_SIZE(scenario_descriptor_tbl) - 1;
|
432
|
+
int cmp, mid;
|
433
|
+
|
434
|
+
while (lo <= hi) {
|
435
|
+
mid = (unsigned)(lo + hi) >> 1;
|
436
|
+
cmp = strncmp(id, scenario_descriptor_tbl[mid].id, SCENARIO_ID_SIZE);
|
437
|
+
if (cmp < 0)
|
438
|
+
hi = mid - 1;
|
439
|
+
else if (cmp > 0)
|
440
|
+
lo = mid + 1;
|
441
|
+
else {
|
442
|
+
if (desc)
|
443
|
+
*desc = scenario_descriptor_tbl[mid];
|
444
|
+
return mid;
|
445
|
+
}
|
446
|
+
}
|
447
|
+
if (desc)
|
448
|
+
*desc = null_desc;
|
449
|
+
return -1;
|
450
|
+
}
|
451
|
+
|
452
|
+
// Load scenarios
|
453
|
+
|
454
|
+
// Set contents of a load scenario to known-empty.
|
455
|
+
void init_load_scenario(TLoadScenario *load_scenario)
|
456
|
+
{
|
457
|
+
static TLoadScenario constant_load_scenario = INIT_LOAD_SCENARIO;
|
458
|
+
*load_scenario = constant_load_scenario;
|
459
|
+
}
|
460
|
+
|
461
|
+
// Free allocated memory for a load scenario and reset it to known-empty.
|
462
|
+
void clear_load_scenario(TLoadScenario *load_scenario)
|
463
|
+
{
|
464
|
+
// Prescribed joint storage is static in non-contest versions.
|
465
|
+
Safefree(load_scenario->prescribed_joints);
|
466
|
+
init_load_scenario(load_scenario);
|
467
|
+
}
|
468
|
+
|
469
|
+
#define UNSIGNED_FROM_CHAR(C) ((C) - '0')
|
470
|
+
#define UNSIGNED_FROM_2_CHARS(P) (10 * UNSIGNED_FROM_CHAR((P)[0]) + UNSIGNED_FROM_CHAR((P)[1]))
|
471
|
+
|
472
|
+
// Fill contents of load scenario given a scenario index.
|
473
|
+
// For V3 and V4, this amounts to looking the load scenario up in a table.
|
474
|
+
// For V4 (contest), we compute the load scenario from the index digits!
|
475
|
+
void setup_load_scenario(TLoadScenario *load_scenario, TScenarioDescriptor *desc)
|
476
|
+
{
|
477
|
+
TJoint *prescribed_joints;
|
478
|
+
unsigned n_prescribed_joints,
|
479
|
+
panel_size,
|
480
|
+
x, y,
|
481
|
+
joint_index;
|
482
|
+
|
483
|
+
clear_load_scenario(load_scenario);
|
484
|
+
|
485
|
+
// Check that scenario index isn't null.
|
486
|
+
if (desc->index < 0) {
|
487
|
+
load_scenario->error = LoadScenarioIndexRange;
|
488
|
+
return;
|
489
|
+
}
|
490
|
+
|
491
|
+
load_scenario->support_type = 0;
|
492
|
+
|
493
|
+
// digit 10 => (0 = low pier, 1 = high pier)
|
494
|
+
if (desc->id[9] > '0')
|
495
|
+
load_scenario->support_type |= HI_NOT_LO;
|
496
|
+
|
497
|
+
// digit 9 => panel point at which pier is located. (0 = no pier).
|
498
|
+
load_scenario->intermediate_support_joint_no = UNSIGNED_FROM_CHAR(desc->id[8]);
|
499
|
+
if (load_scenario->intermediate_support_joint_no > 0)
|
500
|
+
load_scenario->support_type |= INTERMEDIATE_SUPPORT;
|
501
|
+
|
502
|
+
// digit 8 => (0 = simple, 1 = arch, 2 = cable left, 3 = cable both)
|
503
|
+
switch (desc->id[7]) {
|
504
|
+
case '0':
|
505
|
+
break;
|
506
|
+
case '1':
|
507
|
+
load_scenario->support_type |= ARCH_SUPPORT;
|
508
|
+
break;
|
509
|
+
case '2':
|
510
|
+
load_scenario->support_type |= CABLE_SUPPORT_LEFT;
|
511
|
+
break;
|
512
|
+
case '3':
|
513
|
+
load_scenario->support_type |= (CABLE_SUPPORT_LEFT | CABLE_SUPPORT_RIGHT);
|
514
|
+
break;
|
515
|
+
default:
|
516
|
+
assert(0);
|
517
|
+
break;
|
518
|
+
}
|
519
|
+
|
520
|
+
// digits 6 and 7 => meters under span
|
521
|
+
load_scenario->under_meters = UNSIGNED_FROM_2_CHARS(&desc->id[5]);
|
522
|
+
|
523
|
+
// digits 4 and 5 => meters over span
|
524
|
+
load_scenario->over_meters = UNSIGNED_FROM_2_CHARS(&desc->id[3]);
|
525
|
+
|
526
|
+
// digits 2 and 3 => number of bridge panels
|
527
|
+
load_scenario->n_panels = UNSIGNED_FROM_2_CHARS(&desc->id[1]);
|
528
|
+
|
529
|
+
// digit 1 is the load case, 1-based
|
530
|
+
load_scenario->load_case = UNSIGNED_FROM_CHAR(desc->id[0]) - 1; // -1 correction for 0-based load_case table
|
531
|
+
|
532
|
+
// There is no scaling of image in the 2004 version either, but geometry sizes changed.
|
533
|
+
load_scenario->grid_size = 0.25;
|
534
|
+
panel_size = 16;
|
535
|
+
load_scenario->over_grids = load_scenario->over_meters * 4;
|
536
|
+
load_scenario->under_grids = load_scenario->under_meters * 4;
|
537
|
+
|
538
|
+
// load_scenario->joint_radius = ??; Not set because Steve didn't give it to me. Not needed anyway.
|
539
|
+
load_scenario->num_length_grids = load_scenario->n_panels * panel_size;
|
540
|
+
load_scenario->n_loaded_joints = load_scenario->n_panels + 1;
|
541
|
+
|
542
|
+
// Loaded joints are prescribed.
|
543
|
+
n_prescribed_joints = load_scenario->n_loaded_joints;
|
544
|
+
|
545
|
+
// Add one prescribed joint for the intermediate support, if any.
|
546
|
+
if ( (load_scenario->support_type & INTERMEDIATE_SUPPORT)
|
547
|
+
&& !(load_scenario->support_type & HI_NOT_LO))
|
548
|
+
n_prescribed_joints++;
|
549
|
+
|
550
|
+
// Another two for the arch base, if we have an arch.
|
551
|
+
if (load_scenario->support_type & ARCH_SUPPORT)
|
552
|
+
n_prescribed_joints += 2;
|
553
|
+
|
554
|
+
// And another one or two for cable anchorages if they're present.
|
555
|
+
if (load_scenario->support_type & CABLE_SUPPORT_LEFT)
|
556
|
+
n_prescribed_joints++;
|
557
|
+
if (load_scenario->support_type & CABLE_SUPPORT_RIGHT)
|
558
|
+
n_prescribed_joints++;
|
559
|
+
|
560
|
+
// Allocate and fill prescribed joint vector.
|
561
|
+
Newz(92, prescribed_joints, n_prescribed_joints, TJoint);
|
562
|
+
x = y = 0;
|
563
|
+
for (joint_index = 0; joint_index < load_scenario->n_loaded_joints; joint_index++) {
|
564
|
+
prescribed_joints[joint_index].number = joint_index + 1;
|
565
|
+
prescribed_joints[joint_index].x = x;
|
566
|
+
prescribed_joints[joint_index].y = y;
|
567
|
+
x += panel_size;
|
568
|
+
}
|
569
|
+
|
570
|
+
// Loop leaves joint_index pointing at next joint. Add the low intermediate support, if any.
|
571
|
+
if ( (load_scenario->support_type & INTERMEDIATE_SUPPORT)
|
572
|
+
&& !(load_scenario->support_type & HI_NOT_LO) ) {
|
573
|
+
prescribed_joints[joint_index].number = joint_index + 1;
|
574
|
+
prescribed_joints[joint_index].x = (load_scenario->intermediate_support_joint_no - 1) * panel_size;
|
575
|
+
prescribed_joints[joint_index].y = -(TCoordinate)load_scenario->under_grids;
|
576
|
+
joint_index++;
|
577
|
+
}
|
578
|
+
|
579
|
+
// Add the arch base supports, if any.
|
580
|
+
if (load_scenario->support_type & ARCH_SUPPORT) {
|
581
|
+
prescribed_joints[joint_index].number = joint_index + 1;
|
582
|
+
prescribed_joints[joint_index].x = 0;
|
583
|
+
prescribed_joints[joint_index].y = -(TCoordinate)load_scenario->under_grids;
|
584
|
+
joint_index++;
|
585
|
+
prescribed_joints[joint_index].number = joint_index + 1;
|
586
|
+
prescribed_joints[joint_index].x = prescribed_joints[load_scenario->n_loaded_joints - 1].x;
|
587
|
+
prescribed_joints[joint_index].y = -(TCoordinate)load_scenario->under_grids;
|
588
|
+
joint_index++;
|
589
|
+
}
|
590
|
+
|
591
|
+
// Add the cable anchorages, if any.
|
592
|
+
if (load_scenario->support_type & CABLE_SUPPORT_LEFT) {
|
593
|
+
prescribed_joints[joint_index].number = joint_index + 1;
|
594
|
+
prescribed_joints[joint_index].x = -CABLE_ANCHORAGE_X_OFFSET;
|
595
|
+
prescribed_joints[joint_index].y = 0;
|
596
|
+
joint_index++;
|
597
|
+
}
|
598
|
+
if (load_scenario->support_type & CABLE_SUPPORT_RIGHT) {
|
599
|
+
prescribed_joints[joint_index].number = joint_index + 1;
|
600
|
+
prescribed_joints[joint_index].x = prescribed_joints[load_scenario->n_loaded_joints - 1].x + CABLE_ANCHORAGE_X_OFFSET;
|
601
|
+
prescribed_joints[joint_index].y = 0;
|
602
|
+
joint_index++;
|
603
|
+
}
|
604
|
+
|
605
|
+
assert(joint_index == n_prescribed_joints);
|
606
|
+
load_scenario->n_prescribed_joints = n_prescribed_joints;
|
607
|
+
load_scenario->prescribed_joints = prescribed_joints;
|
608
|
+
}
|
609
|
+
|
610
|
+
void copy_load_scenario(TLoadScenario *dst, TLoadScenario *src)
|
611
|
+
{
|
612
|
+
if (src->error != LoadScenarioNoError)
|
613
|
+
return;
|
614
|
+
clear_load_scenario(dst);
|
615
|
+
*dst = *src;
|
616
|
+
|
617
|
+
// Need fresh storage for prescribed joints.
|
618
|
+
Newz(93, dst->prescribed_joints, dst->n_prescribed_joints, TJoint);
|
619
|
+
memcpy(dst->prescribed_joints, src->prescribed_joints, dst->n_prescribed_joints * sizeof(TJoint));
|
620
|
+
}
|
621
|
+
|
622
|
+
int test_scenario_table(void)
|
623
|
+
{
|
624
|
+
unsigned i, n;
|
625
|
+
char invalid_scenario_ids[][SCENARIO_ID_SIZE + 1] = {
|
626
|
+
"----------",
|
627
|
+
"0000000500",
|
628
|
+
"1000000000",
|
629
|
+
"3999999999",
|
630
|
+
};
|
631
|
+
TScenarioDescriptor desc[1];
|
632
|
+
TLoadScenario load_scenario[1];
|
633
|
+
|
634
|
+
init_load_scenario(load_scenario);
|
635
|
+
|
636
|
+
// Check lookup function for bridges.
|
637
|
+
printf("scenario lookup check (find good indices): ");
|
638
|
+
for (i = 0; i < STATIC_ARRAY_SIZE(scenario_descriptor_tbl); i++) {
|
639
|
+
printf("%d ", i);
|
640
|
+
if (lookup_scenario_descriptor(desc, scenario_descriptor_tbl[i].id) < 0) {
|
641
|
+
printf("\nfailed to find scenario id %s (position %d)\n",
|
642
|
+
scenario_descriptor_tbl[i].id, i);
|
643
|
+
return 1;
|
644
|
+
}
|
645
|
+
setup_load_scenario(load_scenario, desc);
|
646
|
+
if (load_scenario->error != LoadScenarioNoError) {
|
647
|
+
printf("\nfailed to initialize load scenario for id %s (position %d)\n",
|
648
|
+
scenario_descriptor_tbl[i].id, i);
|
649
|
+
return 1;
|
650
|
+
}
|
651
|
+
clear_load_scenario(load_scenario);
|
652
|
+
}
|
653
|
+
|
654
|
+
printf("ok\nscenario lookup check (reject bad indices): ");
|
655
|
+
for (i = 0; i < STATIC_ARRAY_SIZE(invalid_scenario_ids); i++) {
|
656
|
+
printf("%d ", i);
|
657
|
+
if (lookup_scenario_descriptor(NULL, invalid_scenario_ids[i]) >= 0) {
|
658
|
+
printf("\nfound invalid code %s (position %d)\n", invalid_scenario_ids[i], i);
|
659
|
+
return 2;
|
660
|
+
}
|
661
|
+
}
|
662
|
+
printf("ok\ncable anchorage scenarios: ");
|
663
|
+
for (n = i = 0; i < STATIC_ARRAY_SIZE(scenario_descriptor_tbl); i++) {
|
664
|
+
if (scenario_descriptor_tbl[i].id[7] > '1') {
|
665
|
+
printf(" (%s) %s\n", scenario_descriptor_tbl[i].number, scenario_descriptor_tbl[i].id);
|
666
|
+
n++;
|
667
|
+
}
|
668
|
+
}
|
669
|
+
printf("%d cases ok\n", n);
|
670
|
+
return 0;
|
671
|
+
}
|