-
Notifications
You must be signed in to change notification settings - Fork 0
/
kadairobot
190 lines (178 loc) · 5.37 KB
/
kadairobot
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
sum = 1
for i in range(64):
sum = sum + sum * 2
print(sum)
bowl = int(sum) / 3200
print(int(bowl))
hct = 455*71.2
nu = int(sum/hct)
print(nu)
koushien = 38500
mu = int(nu/koushien)
print(mu)
kilo = 7816*1000*1000
kilo2 = kilo/0.02
percent = int(sum / kilo2)*100
print(percent)
3433683820292512484657849089281粒
3200粒が茶碗一杯分なため3200で割る
茶碗1073026193841410165354528768杯分
米を作るために必要な面積と甲子園を調べそれらで割る
105990980994336096000147456平方メートル必要
甲子園2753012493359378857984個分
日本の総生産量でチェスの盤においた米粒の重さを割り100をかける
878629432009342976000%
import matplotlib.pyplot as plt
import math
import random
def env(x,y):
xd = 3.0
yd = -3.0
r = (x-xd)**2 + (y-yd)**2
return math.exp(-r/10)
max_steps = 100
x = 0.0
y = 0.0
a_list =[]
b_list =[]
theta =0.0
for i in range(max_steps):
sensor = env(x,y)
a_list.append(x)
b_list.append(y)
d_x = 0.1*math.cos(math.pi*theta/180.0)
d_y = 0.1*math.sin(math.pi*theta/180.0)
x = x + d_x + 0.1*(random.random()-0.5)
y = y+ d_x + 0.1*(random.random()-0.5)
print(x,y)
plt.plot(a_list,b_list)
0.061104485030529704 0.11642955943946254
0.17818467972979196 0.2429755278108948
0.29898267311284354 0.3017563273678483
0.43316739388377523 0.43381736766275375
0.5073108170967369 0.5677514478768249
0.6062542866929584 0.6829129582885562
0.6910113375033494 0.7338772946136649
0.7574260859720308 0.8244760995566425
0.8098072397161341 0.9627258636261387
0.9165777632685123 1.0856385071225054
1.0410891225141867 1.155135302846234
1.103640246359538 1.271778050189917
1.19719898608979 1.3364577433478317
1.2825043777219194 1.4494417542238205
1.418940887324437 1.5736937605151515
1.5075816632602919 1.665221498346161
1.565036024902619 1.7819117220518121
1.7055210281693671 1.8598124258415145
1.8391104490823085 1.9627073611607313
1.9599776174154857 2.085754678674678
2.0872620877150956 2.1369544980175132
2.1859220102799077 2.2600829751262816
2.275775056149065 2.401868016590165
2.3595813935761045 2.548453625937481
2.4718828850979557 2.5991272277239883
2.6069912243848288 2.731987281807565
2.7268910003525795 2.831990431742741
2.814312571152082 2.9689718004585273
2.9471107528916622 3.022938826997837
3.0083536543005844 3.1384029845657717
3.065492243629971 3.2187477680956063
3.1569762068936424 3.302053587305234
3.246694685584914 3.4422823719703914
3.320922702362586 3.4955485525876733
3.37806648294456 3.6359597809882933
3.451724060556283 3.7795170570169367
3.5260330692298947 3.8847263679430446
3.6501064447052194 4.018120302138425
3.7861831630523044 4.145277030633818
3.910986234368322 4.280999228588526
4.009811733974918 4.353261629097132
4.109485383428024 4.444717504762458
4.197154811146006 4.591367647640745
4.278547419722292 4.705345404513676
4.395590292293486 4.782676757660633
4.445725881890769 4.8835344690551
4.513295196956564 5.003249834773216
4.661766334219141 5.0728184174815745
4.793999995834095 5.123655840031879
4.900989607490244 5.267506691681326
4.974850353851491 5.388819832075786
5.038170791886737 5.476124669307946
5.159268614635226 5.615574924561887
5.212507073394255 5.681949508009387
5.339825217868621 5.808123099137813
5.423761300736661 5.888425155263047
5.517375851896772 5.942663955566377
5.607655572928528 6.070751355265638
5.746511153310864 6.175194420257986
5.856139535763403 6.314278329873153
5.985291614536343 6.422114737319115
6.0527323269280675 6.510860510816046
6.169845670441189 6.574430413843136
6.276026807998462 6.672560514957171
6.343086702134403 6.806274614187576
6.466073771137164 6.8797542886092415
6.606481961617435 6.973081936310824
6.675972422972334 7.059623305902604
6.757508943831797 7.187288772493232
6.8517653544084745 7.275739782978637
6.9438355983135756 7.374951842060707
7.035789953713437 7.445437744016937
7.117224807497755 7.555054525832237
7.237980014598632 7.660223839731944
7.3210504529717015 7.808812235894552
7.3749322920600555 7.901594298169032
7.5017144299593 8.028065331373185
7.593815681626058 8.15716800905368
7.7386893903143585 8.248937965609526
7.834578342166421 8.394674983013479
7.9023323477374845 8.46751553250766
8.002742492290075 8.553304390451915
8.069916028355875 8.62593188437837
8.163475294184511 8.698902894582773
8.21850546185249 8.802289136351812
8.300107636384014 8.943849281617684
8.368121561322617 9.012357345834817
8.512392667380167 9.090566474525353
8.59824334966533 9.210274137853629
8.73273608262608 9.295364100988529
8.783196939143897 9.382905095951397
8.865137905466806 9.518626734106522
8.983007987265815 9.61276297710964
9.05954349616423 9.680749933238483
9.190801850602682 9.785508333457988
9.298286266151944 9.849480517779167
9.444806332969787 9.993983842993643
9.570344294814934 10.14188785983022
9.620951578623472 10.226818939156946
9.761821642156432 10.357221356762066
import math
import numpy as np
actions = [[-30,100],[50,30],[-40,60],[30,30]]
x = 0.0
y = 0.0
a = 0
xlist = [x]
ylist = [y]
for i in range(4):
a = a + actions[i][0]
y = x + actions[i][1]/ math.sin(a)
x = y + actions[i][1]/ math.cos(a)
xlist.append(x)
ylist.append(y)
print(x)
print(y)
angle1 = math.atan2(x,y)
angle2 = np.rad2deg(angle1)
print(angle2)
plt.plot(xlist,ylist)
sinとcosでyとxの座標を出しatan2関数で角度を計算する
749.5034588032855
101.21133530701779
855.8787625242268
782.3641368955256
937.186657597149
790.1574063397466
846.2879335698221
882.041738770459
43.814896241207215度回転