tx · GVigW9kJ7L5kKsj4N9WQkGSwosJv6oNaS5FM7MXUjXCy 3MqbTfLJ5nrYh6fUbS38Hfpe6T8MP5K5HiT: -0.04000000 Waves 2020.08.26 14:53 [1149640] smart account 3MqbTfLJ5nrYh6fUbS38Hfpe6T8MP5K5HiT > SELF 0.00000000 Waves
{ "type": 13, "id": "GVigW9kJ7L5kKsj4N9WQkGSwosJv6oNaS5FM7MXUjXCy", "fee": 4000000, "feeAssetId": null, "timestamp": 1598442851913, "version": 1, "sender": "3MqbTfLJ5nrYh6fUbS38Hfpe6T8MP5K5HiT", "senderPublicKey": "EzWkAi3pMjNqjjV3PpJiHWrButTm4aorR4p173qwdGeL", "proofs": [ "6oGQKiBt1Bfe6mpk72jmHucfvSfmsDywj9t7Rm6toEUegif27u4AEyGKYjBKD19Qjgko5eF19rweAJhypQFb6zT" ], "script": "base64:AAIDAAAAAAAAABEIARIECgIBARIFCgMBAQESAAAAAAwBAAAACXNldENvb3JkcwAAAAMAAAADa2V5AAAACGxhdGl0dWRlAAAACWxvbmdpdHVkZQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACAgAAAAxwb3NpdGlvbkxhdF8FAAAAA2tleQUAAAAIbGF0aXR1ZGUJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAAMcG9zaXRpb25Mb25fBQAAAANrZXkFAAAACWxvbmdpdHVkZQUAAAADbmlsAQAAAAtzZXRHYW1lRGF0YQAAAAIAAAAJcGxheWVyS2V5AAAAC29wcG9uZW50S2V5BAAAAAZnYW1lSWQJAAEsAAAAAgkAASwAAAACBQAAAAlwbGF5ZXJLZXkCAAAAAV8FAAAAC29wcG9uZW50S2V5CQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAAB2dhbWVJZF8FAAAACXBsYXllcktleQUAAAAGZ2FtZUlkCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAACW9wcG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AUAAAABaQAAAAZjYWxsZXIFAAAABWFzc2V0AwkAAGYAAAACAAAAAAAAAABkBQAAAAdiYWxhbmNlCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAAZAUAAAAFYXNzZXQFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQUAAAADbmlsAAAAAME5HLA=", "chainId": 84, "height": 1149640, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DfNpWHBxSUcJti3jxdDgaZZv75RiuWqLpy6a1kzoqvHH Next: 7MS76qDfDaU8kAu19e9Nb1fkVMHKNnPpGDHppaouzmxb Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | func setCoords (key,latitude,longitude) = [DataEntry(("positionLat_" + key), latitude), DataEntry((" | |
4 | + | func setCoords (key,latitude,longitude) = [DataEntry(("positionLat_" + key), latitude), DataEntry(("positionLon_" + key), longitude)] | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func setGameData (playerKey,opponentKey) = { | |
23 | 23 | let norm = (positive + (factor * 628318)) | |
24 | 24 | if ((norm > 314159)) | |
25 | 25 | then { | |
26 | - | let norm2 = (norm - 314159) | |
27 | - | let a = ((16 * norm2) * (314159 - norm2)) | |
28 | - | let b = (493480220050 - (a / 4)) | |
29 | - | ((a * 100000) / b) | |
26 | + | let a = ((16 * (norm - 314159)) * (314159 - (norm - 314159))) | |
27 | + | ((a * 100000) / (493480220050 - (a / 4))) | |
30 | 28 | } | |
31 | 29 | else { | |
32 | 30 | let a = ((16 * norm) * (314159 - norm)) | |
33 | - | let b = (493480220050 - (a / 4)) | |
34 | - | ((-(a) * 100000) / b) | |
31 | + | ((-(a) * 100000) / (493480220050 - (a / 4))) | |
35 | 32 | } | |
36 | 33 | } | |
37 | 34 | else if ((positive > 314159)) | |
38 | 35 | then { | |
39 | - | let norm = (positive - 314159) | |
40 | - | let a = ((16 * norm) * (314159 - norm)) | |
41 | - | let b = (493480220050 - (a / 4)) | |
42 | - | ((a * 100000) / b) | |
36 | + | let a = ((16 * (positive - 314159)) * (314159 - (positive - 314159))) | |
37 | + | ((a * 100000) / (493480220050 - (a / 4))) | |
43 | 38 | } | |
44 | 39 | else { | |
45 | 40 | let a = ((16 * positive) * (314159 - positive)) | |
46 | - | let b = (493480220050 - (a / 4)) | |
47 | - | ((-(a) * 100000) / b) | |
41 | + | ((-(a) * 100000) / (493480220050 - (a / 4))) | |
48 | 42 | } | |
49 | 43 | } | |
50 | 44 | else if ((rad > 628318)) | |
52 | 46 | let norm = (rad - (factor * 628318)) | |
53 | 47 | if ((norm > 314159)) | |
54 | 48 | then { | |
55 | - | let norm2 = (norm - 314159) | |
56 | - | let a = ((16 * norm2) * (314159 - norm2)) | |
57 | - | let b = (493480220050 - (a / 4)) | |
58 | - | ((-(a) * 100000) / b) | |
49 | + | let a = ((16 * (norm - 314159)) * (314159 - (norm - 314159))) | |
50 | + | ((-(a) * 100000) / (493480220050 - (a / 4))) | |
59 | 51 | } | |
60 | 52 | else { | |
61 | 53 | let a = ((16 * norm) * (314159 - norm)) | |
62 | - | let b = (493480220050 - (a / 4)) | |
63 | - | ((a * 100000) / b) | |
54 | + | ((a * 100000) / (493480220050 - (a / 4))) | |
64 | 55 | } | |
65 | 56 | } | |
66 | 57 | else if ((rad > 314159)) | |
67 | 58 | then { | |
68 | - | let norm = (rad - 314159) | |
69 | - | let a = ((16 * norm) * (314159 - norm)) | |
70 | - | let b = (493480220050 - (a / 4)) | |
71 | - | ((-(a) * 100000) / b) | |
59 | + | let a = ((16 * (rad - 314159)) * (314159 - (rad - 314159))) | |
60 | + | ((-(a) * 100000) / (493480220050 - (a / 4))) | |
72 | 61 | } | |
73 | 62 | else { | |
74 | 63 | let a = ((16 * rad) * (314159 - rad)) | |
75 | - | let b = (493480220050 - (a / 4)) | |
76 | - | ((a * 100000) / b) | |
64 | + | ((a * 100000) / (493480220050 - (a / 4))) | |
77 | 65 | } | |
78 | 66 | } | |
79 | 67 | ||
81 | 69 | func cos (rad) = sin((157079 - rad)) | |
82 | 70 | ||
83 | 71 | ||
84 | - | func asin (x) = { | |
85 | - | let xPow2 = ((x * x) / 10000000000) | |
86 | - | let xPow3 = ((x * x) * x) | |
87 | - | let val2 = (xPow3 / 60000000000) | |
88 | - | let val3 = (((xPow3 * 3) / 400000000000) * xPow2) | |
89 | - | let val4 = ((((xPow3 * 15) / 3360000000000) * xPow2) * xPow2) | |
90 | - | let val5 = (((((xPow3 * 105) / 34560000000000) * xPow2) * xPow2) * xPow2) | |
91 | - | ((((x + val2) + val3) + val4) + val5) | |
92 | - | } | |
72 | + | func asin (x) = if ((-100000 >= x)) | |
73 | + | then -157079 | |
74 | + | else if ((x >= 100000)) | |
75 | + | then 157079 | |
76 | + | else if ((0 > x)) | |
77 | + | then { | |
78 | + | let x1 = (-1 * x) | |
79 | + | let val2 = (((-1873 * x1) / 100000) + 7426) | |
80 | + | let val4 = (((val2 * x1) / 100000) - 21211) | |
81 | + | let val6 = (((val4 * x1) / 100000) + 157072) | |
82 | + | let root = pow((100000 - x1), 5, 5, 1, 5, HALFEVEN) | |
83 | + | -((157079 - ((root * val6) / 100000))) | |
84 | + | } | |
85 | + | else { | |
86 | + | let val2 = (((-1873 * x) / 100000) + 7426) | |
87 | + | let val4 = (((val2 * x) / 100000) - 21211) | |
88 | + | let val6 = (((val4 * x) / 100000) + 157072) | |
89 | + | let root = pow((100000 - x), 5, 5, 1, 5, HALFEVEN) | |
90 | + | (157079 - ((root * val6) / 100000)) | |
91 | + | } | |
93 | 92 | ||
94 | 93 | ||
95 | - | func atan (x) = if ((x > 100000)) | |
96 | - | then { | |
97 | - | let xInv = (10000000000 / x) | |
98 | - | let xInvPow2 = ((xInv * xInv) / 10000000000) | |
99 | - | let xInvPow3 = ((xInv * xInv) * xInv) | |
100 | - | let val2 = (xInvPow3 / 30000000000) | |
101 | - | let val3 = ((xInvPow3 / 50000000000) * xInvPow2) | |
102 | - | let val4 = (((xInvPow3 / 70000000000) * xInvPow2) * xInvPow2) | |
103 | - | let val5 = ((((xInvPow3 / 90000000000) * xInvPow2) * xInvPow2) * xInvPow2) | |
104 | - | (((((157080 - xInv) + val2) - val3) + val4) - val5) | |
105 | - | } | |
106 | - | else if ((-100000 > x)) | |
107 | - | then { | |
108 | - | let xInv = (10000000000 / x) | |
109 | - | let xInvPow2 = ((xInv * xInv) / 10000000000) | |
110 | - | let xInvPow3 = ((xInv * xInv) * xInv) | |
111 | - | let val2 = (xInvPow3 / 30000000000) | |
112 | - | let val3 = ((xInvPow3 / 50000000000) * xInvPow2) | |
113 | - | let val4 = (((xInvPow3 / 70000000000) * xInvPow2) * xInvPow2) | |
114 | - | let val5 = ((((xInvPow3 / 90000000000) * xInvPow2) * xInvPow2) * xInvPow2) | |
115 | - | (((((val2 - val3) + val4) - 157080) - xInv) - val5) | |
116 | - | } | |
117 | - | else { | |
118 | - | let xPow2 = ((x * x) / 10000000000) | |
119 | - | let xPow3 = ((x * x) * x) | |
120 | - | let val2 = (xPow3 / 30000000000) | |
121 | - | let val3 = ((xPow3 / 50000000000) * xPow2) | |
122 | - | let val4 = (((xPow3 / 70000000000) * xPow2) * xPow2) | |
123 | - | let val5 = ((((xPow3 / 90000000000) * xPow2) * xPow2) * xPow2) | |
124 | - | ((((x - val2) + val3) - val4) + val5) | |
125 | - | } | |
94 | + | func atan (x) = { | |
95 | + | let xPow2 = ((x * x) / 100000) | |
96 | + | if ((-100000 > x)) | |
97 | + | then (-157079 - ((x * 100000) / (xPow2 + 28000))) | |
98 | + | else if ((x > 100000)) | |
99 | + | then (157079 - ((x * 100000) / (xPow2 + 28000))) | |
100 | + | else ((x * 100000) / (100000 + ((28000 * xPow2) / 100000))) | |
101 | + | } | |
126 | 102 | ||
127 | 103 | ||
128 | 104 | func atan2 (y,x) = if ((x > 0)) | |
138 | 114 | else if (if ((x == 0)) | |
139 | 115 | then (y > 0) | |
140 | 116 | else false) | |
141 | - | then | |
117 | + | then 157079 | |
142 | 118 | else if (if ((x == 0)) | |
143 | 119 | then (0 > y) | |
144 | 120 | else false) | |
145 | - | then - | |
121 | + | then -157079 | |
146 | 122 | else 0 | |
147 | 123 | ||
148 | 124 | ||
149 | - | func sqrt (x) = if ((2 > x)) | |
150 | - | then x | |
151 | - | else { | |
152 | - | let x1 = ((316 + (x / 316)) / 2) | |
153 | - | let x2 = ((x1 + (x / x1)) / 2) | |
154 | - | let x3 = ((x2 + (x / x2)) / 2) | |
155 | - | let x4 = ((x3 + (x / x3)) / 2) | |
156 | - | let x5 = ((x4 + (x / x4)) / 2) | |
157 | - | let x6 = ((x5 + (x / x5)) / 2) | |
158 | - | let x7 = ((x6 + (x / x6)) / 2) | |
159 | - | let x8 = ((x7 + (x / x7)) / 2) | |
160 | - | let x9 = ((x8 + (x / x8)) / 2) | |
161 | - | ((x9 + (x / x9)) / 2) | |
162 | - | } | |
125 | + | func calculateShotDistance (v,pitch) = (((2 * v) * ((cos(pitch) * sin(pitch)) / 100000)) / 980665) | |
163 | 126 | ||
164 | 127 | ||
165 | - | func getShotDistance (v,pitch) = (((2 * ((v * v) / 100000)) * ((cos(pitch) * sin(pitch)) / 100000)) / 980665) | |
166 | - | ||
167 | - | ||
168 | - | func distance (lat1,lon1,lat2,lon2) = { | |
169 | - | let dLat = (lat1 - lat2) | |
170 | - | let dLon = (lon1 - lon2) | |
171 | - | let dLatSin = sin((dLat / 2)) | |
172 | - | let dLonSin = sin((dLon / 2)) | |
128 | + | func gpsDistance (lat1,lon1,lat2,lon2) = { | |
129 | + | let dLatSin = sin(((lat1 - lat2) / 2)) | |
130 | + | let dLonSin = sin(((lon1 - lon2) / 2)) | |
173 | 131 | let hav = ((dLatSin * dLatSin) + (((cos(lat1) * cos(lat2)) / 100000) * ((dLonSin * dLonSin) / 100000))) | |
174 | - | let theta = (2 * asin( | |
175 | - | ( | |
132 | + | let theta = (2 * asin(pow((hav / 1000), 7, 5, 1, 5, HALFEVEN))) | |
133 | + | (6371000 * theta) | |
176 | 134 | } | |
177 | 135 | ||
178 | 136 | ||
179 | - | func impact (lat,lon,dist,yaw) = { | |
180 | - | let th = (dist / 637100) | |
137 | + | func calculateImpactPosition (lat,lon,dist,yaw) = { | |
181 | 138 | let sinLat = sin(lat) | |
182 | 139 | let cosLat = cos(lat) | |
183 | - | let sinTh = sin( | |
184 | - | let cosTh = cos( | |
140 | + | let sinTh = sin((dist / 6371000)) | |
141 | + | let cosTh = cos((dist / 6371000)) | |
185 | 142 | let newLat = asin((((sinLat * cosTh) / 100000) + (((cosLat * sinTh) * cos(yaw)) / 10000000000))) | |
186 | - | let newLon = (lon + | |
143 | + | let newLon = (lon + atan2((((sin(yaw) * sinTh) * cosLat) / 100000), (cosTh - ((sinLat * sin(newLat)) / 100000)))) | |
187 | 144 | [newLat, newLon] | |
188 | 145 | } | |
189 | 146 | ||
190 | 147 | ||
191 | - | func | |
192 | - | let | |
193 | - | let | |
194 | - | let | |
195 | - | let | |
196 | - | let distanceBetweenPlayers = ( | |
197 | - | let optimalVelocity = ( | |
198 | - | let playerShotReach = | |
199 | - | let impactPosition = | |
200 | - | let impactDistance = | |
201 | - | ||
148 | + | func calculateShot (pitch,yaw,force,playerKey,opponentKey) = { | |
149 | + | let playerLatitude = getIntegerValue(this, ("positionLat_" + playerKey)) | |
150 | + | let playerLongitude = getIntegerValue(this, ("positionLon_" + playerKey)) | |
151 | + | let opponentLatitude = getIntegerValue(this, ("positionLat_" + opponentKey)) | |
152 | + | let opponentLongitude = getIntegerValue(this, ("positionLon_" + opponentKey)) | |
153 | + | let distanceBetweenPlayers = gpsDistance(playerLatitude, playerLongitude, opponentLatitude, opponentLongitude) | |
154 | + | let optimalVelocity = ((distanceBetweenPlayers * 980665) / 100000) | |
155 | + | let playerShotReach = calculateShotDistance(((optimalVelocity * force) / 100000), pitch) | |
156 | + | let impactPosition = calculateImpactPosition(playerLatitude, playerLongitude, playerShotReach, yaw) | |
157 | + | let impactDistance = gpsDistance(impactPosition[0], impactPosition[1], opponentLatitude, opponentLongitude) | |
158 | + | impactDistance :: impactPosition | |
202 | 159 | } | |
203 | 160 | ||
204 | 161 | ||
205 | 162 | @Callable(i) | |
206 | 163 | func startGame (latitude,longitude) = { | |
164 | + | let asset = base58'' | |
165 | + | let payment = value(i.payment) | |
207 | 166 | let caller = toString(i.caller) | |
208 | 167 | let coordinates = setCoords(caller, ((latitude * 1745) / 100000), ((longitude * 1745) / 100000)) | |
209 | 168 | let openGame = getString(this, "openGame") | |
210 | - | let gameId = getString(this, ("gameId_" + caller)) | |
211 | - | let gameIsActive = getBoolean(this, ("gameId_" + getGameId(caller))) | |
212 | - | if (if (if (if ((gameId != "")) | |
213 | - | then (gameId != unit) | |
169 | + | if (if ((payment.assetId == asset)) | |
170 | + | then (payment.amount >= 1) | |
214 | 171 | else false) | |
215 | - | then (gameIsActive != false) | |
216 | - | else false) | |
217 | - | then (gameIsActive != unit) | |
218 | - | else false) | |
219 | - | then throw("Please finish your current game, before starting another one") | |
220 | - | else if (!(isDefined(openGame))) | |
221 | - | then WriteSet(DataEntry("openGame", caller) :: coordinates) | |
222 | - | else if (if ((openGame == "")) | |
223 | - | then true | |
224 | - | else (openGame == caller)) | |
225 | - | then WriteSet(DataEntry("openGame", caller) :: coordinates) | |
226 | - | else WriteSet([DataEntry("openGame", ""), coordinates[0], coordinates[1], setGameData(value(openGame), caller)]) | |
172 | + | then { | |
173 | + | let gameId = getString(this, ("gameId_" + caller)) | |
174 | + | if (if ((gameId != "")) | |
175 | + | then (gameId != unit) | |
176 | + | else false) | |
177 | + | then throw("Please finish your current game, before starting another one") | |
178 | + | else if (!(isDefined(openGame))) | |
179 | + | then WriteSet(DataEntry("openGame", caller) :: coordinates) | |
180 | + | else if (if ((openGame == "")) | |
181 | + | then true | |
182 | + | else (openGame == caller)) | |
183 | + | then WriteSet(DataEntry("openGame", caller) :: coordinates) | |
184 | + | else WriteSet([DataEntry("openGame", ""), coordinates[0], coordinates[1], setGameData(value(openGame), caller)]) | |
185 | + | } | |
186 | + | else throw("Please pay the token") | |
227 | 187 | } | |
228 | 188 | ||
229 | 189 | ||
230 | 190 | ||
231 | 191 | @Callable(i) | |
232 | 192 | func executeShot (pitch,yaw,force) = { | |
193 | + | let asset = base58'' | |
233 | 194 | let caller = toString(i.caller) | |
234 | 195 | let opponent = getStringValue(this, ("opponent_" + caller)) | |
235 | 196 | let gameId = getGameId(caller) | |
236 | 197 | if ((getStringValue(this, ("gameTurn_" + gameId)) != caller)) | |
237 | - | then throw("please wait for your turn") | |
238 | - | else if (gotHit(pitch, yaw, force, caller, opponent)) | |
239 | - | then WriteSet([DataEntry(("game_" + gameId), false), DataEntry(("gameWinner_" + gameId), caller)]) | |
240 | - | else WriteSet([DataEntry(("gameTurn_" + gameId), opponent)]) | |
198 | + | then throw("Please wait for your turn.") | |
199 | + | else { | |
200 | + | let shotData = calculateShot(pitch, yaw, force, caller, opponent) | |
201 | + | if ((((shotData[0] / 5) + 1000000000) > shotData[0])) | |
202 | + | then ScriptResult(WriteSet([DataEntry(("game_" + gameId), false), DataEntry(("gameWinner_" + gameId), caller), DataEntry(("lastShotDistance_" + gameId), shotData[0]), DataEntry(("lastShotLat_" + gameId), shotData[1]), DataEntry(("lastShotLon_" + gameId), shotData[2])]), TransferSet([ScriptTransfer(i.caller, 2, asset)])) | |
203 | + | else WriteSet([DataEntry(("gameTurn_" + gameId), opponent), DataEntry(("lastShotDistance_" + gameId), shotData[0]), DataEntry(("lastShotLat_" + gameId), shotData[1]), DataEntry(("lastShotLon_" + gameId), shotData[2])]) | |
204 | + | } | |
205 | + | } | |
206 | + | ||
207 | + | ||
208 | + | ||
209 | + | @Callable(i) | |
210 | + | func faucet () = { | |
211 | + | let asset = base58'' | |
212 | + | let caller = toString(i.caller) | |
213 | + | let balance = assetBalance(i.caller, asset) | |
214 | + | if ((100 > balance)) | |
215 | + | then TransferSet([ScriptTransfer(i.caller, 100, asset)]) | |
216 | + | else TransferSet(nil) | |
241 | 217 | } | |
242 | 218 | ||
243 | 219 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | func setCoords (key,latitude,longitude) = [DataEntry(("positionLat_" + key), latitude), DataEntry((" | |
4 | + | func setCoords (key,latitude,longitude) = [DataEntry(("positionLat_" + key), latitude), DataEntry(("positionLon_" + key), longitude)] | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func setGameData (playerKey,opponentKey) = { | |
8 | 8 | let gameId = ((playerKey + "_") + opponentKey) | |
9 | 9 | [DataEntry(("gameId_" + playerKey), gameId), DataEntry(("opponent_" + playerKey), opponentKey), DataEntry(("gameId_" + opponentKey), gameId), DataEntry(("opponent_" + opponentKey), playerKey), DataEntry(("game_" + gameId), true), DataEntry(("gameTurn_" + gameId), playerKey), DataEntry(("gameWinner_" + gameId), "")] | |
10 | 10 | } | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func getGameId (key) = getStringValue(this, ("gameId_" + key)) | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func sin (rad) = { | |
17 | 17 | let factor = (rad / 628318) | |
18 | 18 | if ((0 > rad)) | |
19 | 19 | then { | |
20 | 20 | let positive = -(rad) | |
21 | 21 | if ((positive > 628318)) | |
22 | 22 | then { | |
23 | 23 | let norm = (positive + (factor * 628318)) | |
24 | 24 | if ((norm > 314159)) | |
25 | 25 | then { | |
26 | - | let norm2 = (norm - 314159) | |
27 | - | let a = ((16 * norm2) * (314159 - norm2)) | |
28 | - | let b = (493480220050 - (a / 4)) | |
29 | - | ((a * 100000) / b) | |
26 | + | let a = ((16 * (norm - 314159)) * (314159 - (norm - 314159))) | |
27 | + | ((a * 100000) / (493480220050 - (a / 4))) | |
30 | 28 | } | |
31 | 29 | else { | |
32 | 30 | let a = ((16 * norm) * (314159 - norm)) | |
33 | - | let b = (493480220050 - (a / 4)) | |
34 | - | ((-(a) * 100000) / b) | |
31 | + | ((-(a) * 100000) / (493480220050 - (a / 4))) | |
35 | 32 | } | |
36 | 33 | } | |
37 | 34 | else if ((positive > 314159)) | |
38 | 35 | then { | |
39 | - | let norm = (positive - 314159) | |
40 | - | let a = ((16 * norm) * (314159 - norm)) | |
41 | - | let b = (493480220050 - (a / 4)) | |
42 | - | ((a * 100000) / b) | |
36 | + | let a = ((16 * (positive - 314159)) * (314159 - (positive - 314159))) | |
37 | + | ((a * 100000) / (493480220050 - (a / 4))) | |
43 | 38 | } | |
44 | 39 | else { | |
45 | 40 | let a = ((16 * positive) * (314159 - positive)) | |
46 | - | let b = (493480220050 - (a / 4)) | |
47 | - | ((-(a) * 100000) / b) | |
41 | + | ((-(a) * 100000) / (493480220050 - (a / 4))) | |
48 | 42 | } | |
49 | 43 | } | |
50 | 44 | else if ((rad > 628318)) | |
51 | 45 | then { | |
52 | 46 | let norm = (rad - (factor * 628318)) | |
53 | 47 | if ((norm > 314159)) | |
54 | 48 | then { | |
55 | - | let norm2 = (norm - 314159) | |
56 | - | let a = ((16 * norm2) * (314159 - norm2)) | |
57 | - | let b = (493480220050 - (a / 4)) | |
58 | - | ((-(a) * 100000) / b) | |
49 | + | let a = ((16 * (norm - 314159)) * (314159 - (norm - 314159))) | |
50 | + | ((-(a) * 100000) / (493480220050 - (a / 4))) | |
59 | 51 | } | |
60 | 52 | else { | |
61 | 53 | let a = ((16 * norm) * (314159 - norm)) | |
62 | - | let b = (493480220050 - (a / 4)) | |
63 | - | ((a * 100000) / b) | |
54 | + | ((a * 100000) / (493480220050 - (a / 4))) | |
64 | 55 | } | |
65 | 56 | } | |
66 | 57 | else if ((rad > 314159)) | |
67 | 58 | then { | |
68 | - | let norm = (rad - 314159) | |
69 | - | let a = ((16 * norm) * (314159 - norm)) | |
70 | - | let b = (493480220050 - (a / 4)) | |
71 | - | ((-(a) * 100000) / b) | |
59 | + | let a = ((16 * (rad - 314159)) * (314159 - (rad - 314159))) | |
60 | + | ((-(a) * 100000) / (493480220050 - (a / 4))) | |
72 | 61 | } | |
73 | 62 | else { | |
74 | 63 | let a = ((16 * rad) * (314159 - rad)) | |
75 | - | let b = (493480220050 - (a / 4)) | |
76 | - | ((a * 100000) / b) | |
64 | + | ((a * 100000) / (493480220050 - (a / 4))) | |
77 | 65 | } | |
78 | 66 | } | |
79 | 67 | ||
80 | 68 | ||
81 | 69 | func cos (rad) = sin((157079 - rad)) | |
82 | 70 | ||
83 | 71 | ||
84 | - | func asin (x) = { | |
85 | - | let xPow2 = ((x * x) / 10000000000) | |
86 | - | let xPow3 = ((x * x) * x) | |
87 | - | let val2 = (xPow3 / 60000000000) | |
88 | - | let val3 = (((xPow3 * 3) / 400000000000) * xPow2) | |
89 | - | let val4 = ((((xPow3 * 15) / 3360000000000) * xPow2) * xPow2) | |
90 | - | let val5 = (((((xPow3 * 105) / 34560000000000) * xPow2) * xPow2) * xPow2) | |
91 | - | ((((x + val2) + val3) + val4) + val5) | |
92 | - | } | |
72 | + | func asin (x) = if ((-100000 >= x)) | |
73 | + | then -157079 | |
74 | + | else if ((x >= 100000)) | |
75 | + | then 157079 | |
76 | + | else if ((0 > x)) | |
77 | + | then { | |
78 | + | let x1 = (-1 * x) | |
79 | + | let val2 = (((-1873 * x1) / 100000) + 7426) | |
80 | + | let val4 = (((val2 * x1) / 100000) - 21211) | |
81 | + | let val6 = (((val4 * x1) / 100000) + 157072) | |
82 | + | let root = pow((100000 - x1), 5, 5, 1, 5, HALFEVEN) | |
83 | + | -((157079 - ((root * val6) / 100000))) | |
84 | + | } | |
85 | + | else { | |
86 | + | let val2 = (((-1873 * x) / 100000) + 7426) | |
87 | + | let val4 = (((val2 * x) / 100000) - 21211) | |
88 | + | let val6 = (((val4 * x) / 100000) + 157072) | |
89 | + | let root = pow((100000 - x), 5, 5, 1, 5, HALFEVEN) | |
90 | + | (157079 - ((root * val6) / 100000)) | |
91 | + | } | |
93 | 92 | ||
94 | 93 | ||
95 | - | func atan (x) = if ((x > 100000)) | |
96 | - | then { | |
97 | - | let xInv = (10000000000 / x) | |
98 | - | let xInvPow2 = ((xInv * xInv) / 10000000000) | |
99 | - | let xInvPow3 = ((xInv * xInv) * xInv) | |
100 | - | let val2 = (xInvPow3 / 30000000000) | |
101 | - | let val3 = ((xInvPow3 / 50000000000) * xInvPow2) | |
102 | - | let val4 = (((xInvPow3 / 70000000000) * xInvPow2) * xInvPow2) | |
103 | - | let val5 = ((((xInvPow3 / 90000000000) * xInvPow2) * xInvPow2) * xInvPow2) | |
104 | - | (((((157080 - xInv) + val2) - val3) + val4) - val5) | |
105 | - | } | |
106 | - | else if ((-100000 > x)) | |
107 | - | then { | |
108 | - | let xInv = (10000000000 / x) | |
109 | - | let xInvPow2 = ((xInv * xInv) / 10000000000) | |
110 | - | let xInvPow3 = ((xInv * xInv) * xInv) | |
111 | - | let val2 = (xInvPow3 / 30000000000) | |
112 | - | let val3 = ((xInvPow3 / 50000000000) * xInvPow2) | |
113 | - | let val4 = (((xInvPow3 / 70000000000) * xInvPow2) * xInvPow2) | |
114 | - | let val5 = ((((xInvPow3 / 90000000000) * xInvPow2) * xInvPow2) * xInvPow2) | |
115 | - | (((((val2 - val3) + val4) - 157080) - xInv) - val5) | |
116 | - | } | |
117 | - | else { | |
118 | - | let xPow2 = ((x * x) / 10000000000) | |
119 | - | let xPow3 = ((x * x) * x) | |
120 | - | let val2 = (xPow3 / 30000000000) | |
121 | - | let val3 = ((xPow3 / 50000000000) * xPow2) | |
122 | - | let val4 = (((xPow3 / 70000000000) * xPow2) * xPow2) | |
123 | - | let val5 = ((((xPow3 / 90000000000) * xPow2) * xPow2) * xPow2) | |
124 | - | ((((x - val2) + val3) - val4) + val5) | |
125 | - | } | |
94 | + | func atan (x) = { | |
95 | + | let xPow2 = ((x * x) / 100000) | |
96 | + | if ((-100000 > x)) | |
97 | + | then (-157079 - ((x * 100000) / (xPow2 + 28000))) | |
98 | + | else if ((x > 100000)) | |
99 | + | then (157079 - ((x * 100000) / (xPow2 + 28000))) | |
100 | + | else ((x * 100000) / (100000 + ((28000 * xPow2) / 100000))) | |
101 | + | } | |
126 | 102 | ||
127 | 103 | ||
128 | 104 | func atan2 (y,x) = if ((x > 0)) | |
129 | 105 | then atan((y / x)) | |
130 | 106 | else if (if ((0 > x)) | |
131 | 107 | then (y >= 0) | |
132 | 108 | else false) | |
133 | 109 | then (atan((y / x)) + 314159) | |
134 | 110 | else if (if ((0 > x)) | |
135 | 111 | then (0 > y) | |
136 | 112 | else false) | |
137 | 113 | then (atan((y / x)) - 314159) | |
138 | 114 | else if (if ((x == 0)) | |
139 | 115 | then (y > 0) | |
140 | 116 | else false) | |
141 | - | then | |
117 | + | then 157079 | |
142 | 118 | else if (if ((x == 0)) | |
143 | 119 | then (0 > y) | |
144 | 120 | else false) | |
145 | - | then - | |
121 | + | then -157079 | |
146 | 122 | else 0 | |
147 | 123 | ||
148 | 124 | ||
149 | - | func sqrt (x) = if ((2 > x)) | |
150 | - | then x | |
151 | - | else { | |
152 | - | let x1 = ((316 + (x / 316)) / 2) | |
153 | - | let x2 = ((x1 + (x / x1)) / 2) | |
154 | - | let x3 = ((x2 + (x / x2)) / 2) | |
155 | - | let x4 = ((x3 + (x / x3)) / 2) | |
156 | - | let x5 = ((x4 + (x / x4)) / 2) | |
157 | - | let x6 = ((x5 + (x / x5)) / 2) | |
158 | - | let x7 = ((x6 + (x / x6)) / 2) | |
159 | - | let x8 = ((x7 + (x / x7)) / 2) | |
160 | - | let x9 = ((x8 + (x / x8)) / 2) | |
161 | - | ((x9 + (x / x9)) / 2) | |
162 | - | } | |
125 | + | func calculateShotDistance (v,pitch) = (((2 * v) * ((cos(pitch) * sin(pitch)) / 100000)) / 980665) | |
163 | 126 | ||
164 | 127 | ||
165 | - | func getShotDistance (v,pitch) = (((2 * ((v * v) / 100000)) * ((cos(pitch) * sin(pitch)) / 100000)) / 980665) | |
166 | - | ||
167 | - | ||
168 | - | func distance (lat1,lon1,lat2,lon2) = { | |
169 | - | let dLat = (lat1 - lat2) | |
170 | - | let dLon = (lon1 - lon2) | |
171 | - | let dLatSin = sin((dLat / 2)) | |
172 | - | let dLonSin = sin((dLon / 2)) | |
128 | + | func gpsDistance (lat1,lon1,lat2,lon2) = { | |
129 | + | let dLatSin = sin(((lat1 - lat2) / 2)) | |
130 | + | let dLonSin = sin(((lon1 - lon2) / 2)) | |
173 | 131 | let hav = ((dLatSin * dLatSin) + (((cos(lat1) * cos(lat2)) / 100000) * ((dLonSin * dLonSin) / 100000))) | |
174 | - | let theta = (2 * asin( | |
175 | - | ( | |
132 | + | let theta = (2 * asin(pow((hav / 1000), 7, 5, 1, 5, HALFEVEN))) | |
133 | + | (6371000 * theta) | |
176 | 134 | } | |
177 | 135 | ||
178 | 136 | ||
179 | - | func impact (lat,lon,dist,yaw) = { | |
180 | - | let th = (dist / 637100) | |
137 | + | func calculateImpactPosition (lat,lon,dist,yaw) = { | |
181 | 138 | let sinLat = sin(lat) | |
182 | 139 | let cosLat = cos(lat) | |
183 | - | let sinTh = sin( | |
184 | - | let cosTh = cos( | |
140 | + | let sinTh = sin((dist / 6371000)) | |
141 | + | let cosTh = cos((dist / 6371000)) | |
185 | 142 | let newLat = asin((((sinLat * cosTh) / 100000) + (((cosLat * sinTh) * cos(yaw)) / 10000000000))) | |
186 | - | let newLon = (lon + | |
143 | + | let newLon = (lon + atan2((((sin(yaw) * sinTh) * cosLat) / 100000), (cosTh - ((sinLat * sin(newLat)) / 100000)))) | |
187 | 144 | [newLat, newLon] | |
188 | 145 | } | |
189 | 146 | ||
190 | 147 | ||
191 | - | func | |
192 | - | let | |
193 | - | let | |
194 | - | let | |
195 | - | let | |
196 | - | let distanceBetweenPlayers = ( | |
197 | - | let optimalVelocity = ( | |
198 | - | let playerShotReach = | |
199 | - | let impactPosition = | |
200 | - | let impactDistance = | |
201 | - | ||
148 | + | func calculateShot (pitch,yaw,force,playerKey,opponentKey) = { | |
149 | + | let playerLatitude = getIntegerValue(this, ("positionLat_" + playerKey)) | |
150 | + | let playerLongitude = getIntegerValue(this, ("positionLon_" + playerKey)) | |
151 | + | let opponentLatitude = getIntegerValue(this, ("positionLat_" + opponentKey)) | |
152 | + | let opponentLongitude = getIntegerValue(this, ("positionLon_" + opponentKey)) | |
153 | + | let distanceBetweenPlayers = gpsDistance(playerLatitude, playerLongitude, opponentLatitude, opponentLongitude) | |
154 | + | let optimalVelocity = ((distanceBetweenPlayers * 980665) / 100000) | |
155 | + | let playerShotReach = calculateShotDistance(((optimalVelocity * force) / 100000), pitch) | |
156 | + | let impactPosition = calculateImpactPosition(playerLatitude, playerLongitude, playerShotReach, yaw) | |
157 | + | let impactDistance = gpsDistance(impactPosition[0], impactPosition[1], opponentLatitude, opponentLongitude) | |
158 | + | impactDistance :: impactPosition | |
202 | 159 | } | |
203 | 160 | ||
204 | 161 | ||
205 | 162 | @Callable(i) | |
206 | 163 | func startGame (latitude,longitude) = { | |
164 | + | let asset = base58'' | |
165 | + | let payment = value(i.payment) | |
207 | 166 | let caller = toString(i.caller) | |
208 | 167 | let coordinates = setCoords(caller, ((latitude * 1745) / 100000), ((longitude * 1745) / 100000)) | |
209 | 168 | let openGame = getString(this, "openGame") | |
210 | - | let gameId = getString(this, ("gameId_" + caller)) | |
211 | - | let gameIsActive = getBoolean(this, ("gameId_" + getGameId(caller))) | |
212 | - | if (if (if (if ((gameId != "")) | |
213 | - | then (gameId != unit) | |
169 | + | if (if ((payment.assetId == asset)) | |
170 | + | then (payment.amount >= 1) | |
214 | 171 | else false) | |
215 | - | then (gameIsActive != false) | |
216 | - | else false) | |
217 | - | then (gameIsActive != unit) | |
218 | - | else false) | |
219 | - | then throw("Please finish your current game, before starting another one") | |
220 | - | else if (!(isDefined(openGame))) | |
221 | - | then WriteSet(DataEntry("openGame", caller) :: coordinates) | |
222 | - | else if (if ((openGame == "")) | |
223 | - | then true | |
224 | - | else (openGame == caller)) | |
225 | - | then WriteSet(DataEntry("openGame", caller) :: coordinates) | |
226 | - | else WriteSet([DataEntry("openGame", ""), coordinates[0], coordinates[1], setGameData(value(openGame), caller)]) | |
172 | + | then { | |
173 | + | let gameId = getString(this, ("gameId_" + caller)) | |
174 | + | if (if ((gameId != "")) | |
175 | + | then (gameId != unit) | |
176 | + | else false) | |
177 | + | then throw("Please finish your current game, before starting another one") | |
178 | + | else if (!(isDefined(openGame))) | |
179 | + | then WriteSet(DataEntry("openGame", caller) :: coordinates) | |
180 | + | else if (if ((openGame == "")) | |
181 | + | then true | |
182 | + | else (openGame == caller)) | |
183 | + | then WriteSet(DataEntry("openGame", caller) :: coordinates) | |
184 | + | else WriteSet([DataEntry("openGame", ""), coordinates[0], coordinates[1], setGameData(value(openGame), caller)]) | |
185 | + | } | |
186 | + | else throw("Please pay the token") | |
227 | 187 | } | |
228 | 188 | ||
229 | 189 | ||
230 | 190 | ||
231 | 191 | @Callable(i) | |
232 | 192 | func executeShot (pitch,yaw,force) = { | |
193 | + | let asset = base58'' | |
233 | 194 | let caller = toString(i.caller) | |
234 | 195 | let opponent = getStringValue(this, ("opponent_" + caller)) | |
235 | 196 | let gameId = getGameId(caller) | |
236 | 197 | if ((getStringValue(this, ("gameTurn_" + gameId)) != caller)) | |
237 | - | then throw("please wait for your turn") | |
238 | - | else if (gotHit(pitch, yaw, force, caller, opponent)) | |
239 | - | then WriteSet([DataEntry(("game_" + gameId), false), DataEntry(("gameWinner_" + gameId), caller)]) | |
240 | - | else WriteSet([DataEntry(("gameTurn_" + gameId), opponent)]) | |
198 | + | then throw("Please wait for your turn.") | |
199 | + | else { | |
200 | + | let shotData = calculateShot(pitch, yaw, force, caller, opponent) | |
201 | + | if ((((shotData[0] / 5) + 1000000000) > shotData[0])) | |
202 | + | then ScriptResult(WriteSet([DataEntry(("game_" + gameId), false), DataEntry(("gameWinner_" + gameId), caller), DataEntry(("lastShotDistance_" + gameId), shotData[0]), DataEntry(("lastShotLat_" + gameId), shotData[1]), DataEntry(("lastShotLon_" + gameId), shotData[2])]), TransferSet([ScriptTransfer(i.caller, 2, asset)])) | |
203 | + | else WriteSet([DataEntry(("gameTurn_" + gameId), opponent), DataEntry(("lastShotDistance_" + gameId), shotData[0]), DataEntry(("lastShotLat_" + gameId), shotData[1]), DataEntry(("lastShotLon_" + gameId), shotData[2])]) | |
204 | + | } | |
205 | + | } | |
206 | + | ||
207 | + | ||
208 | + | ||
209 | + | @Callable(i) | |
210 | + | func faucet () = { | |
211 | + | let asset = base58'' | |
212 | + | let caller = toString(i.caller) | |
213 | + | let balance = assetBalance(i.caller, asset) | |
214 | + | if ((100 > balance)) | |
215 | + | then TransferSet([ScriptTransfer(i.caller, 100, asset)]) | |
216 | + | else TransferSet(nil) | |
241 | 217 | } | |
242 | 218 | ||
243 | 219 |
github/deemru/w8io/169f3d6 50.54 ms ◑