Skip to content

Commit c907ebd

Browse files
june128leios
authored andcommitted
Add Monte Carlo Integration in Emojicode. (#483)
1 parent fc250ee commit c907ebd

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
🐇 ☝️ 🍇
2+
🖍🆕 x 💯
3+
🖍🆕 y 💯
4+
5+
🆕 🍼 x 💯 🍼 y 💯 🍇 🍉
6+
7+
❗️ 📪 ➡️ 💯 🍇
8+
↩️ x
9+
🍉
10+
11+
❗️ 📫 ➡️ 💯 🍇
12+
↩️ y
13+
🍉
14+
🍉
15+
16+
🐇 🌕 🍇
17+
🖍🆕 radius 💯
18+
19+
🆕 given_radius 💯 🍇
20+
🏧 given_radius❗️ ➡️ 🖍radius
21+
🍉
22+
23+
❗️ 📥 point ☝️ ➡️ 👌 🍇
24+
📪 point❗️ ➡️ point_x
25+
📫 point❗️ ➡️ point_y
26+
↩️ 🤜point_x ✖️ point_x ➕ point_y ✖️ point_y🤛 ◀️ 🤜radius ✖️ radius🤛
27+
🍉
28+
🍉
29+
30+
🐇 🤡 🍇
31+
🐇 ❗️ 🏃‍♀️ samples 🔢 ➡️ 💯 🍇
32+
🆕🌕🆕 1.0 ❗️ ➡️ circle
33+
0 ➡️ 🖍🆕 count
34+
35+
🆕🎰🆕 ❗️ ➡️ random
36+
37+
🔂 i 🆕⏩⏩ 0 samples❗️ 🍇
38+
🆕☝️🆕 💯 random❗️ 💯 random❗️❗️ ➡️ point
39+
↪️ 📥 circle point❗️ 🍇
40+
count ⬅️ ➕ 1
41+
🍉
42+
🍉
43+
44+
↩️ 4.0 ✖️ 💯 count❗️ ➗ 💯samples❗️
45+
🍉
46+
🍉
47+
48+
🏁 🍇
49+
😀 🔤Running with 10,000,000 samples.🔤❗️
50+
🏃‍♀️🐇🤡 10000000❗️ ➡️ pi_estimate
51+
😀 🍪🔤The estimate of pi is: 🔤 🔡 pi_estimate 10❗🍪❗️
52+
🏧 🤜pi_estimate ➖ 🥧🕊💯 ❗️🤛❗️ ➗ 🥧🕊💯 ❗️ ✖️ 100 ➡️ percent_error
53+
😀 🍪🔤The percent error is: 🔤 🔡 percent_error 10❗ 🔤%🔤🍪❗️
54+
🍉

contents/monte_carlo_integration/monte_carlo_integration.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ each point is tested to see whether it's in the circle or not:
7171
[import:1-4, lang:"ruby"](code/ruby/monte_carlo.rb)
7272
{% sample lang="f90" %}
7373
[import:1-8, lang:"fortran"](code/fortran/monte_carlo.f90)
74+
{% sample lang="emojic" %}
75+
[import:23-27, lang:"emojicode"](code/emojicode/monte_carlo.emojic)
7476
{% sample lang="php" %}
7577
[import:4-7, lang:"php"](code/php/monte_carlo.php)
7678
{% sample lang="lua" %}
@@ -149,6 +151,8 @@ Feel free to submit your version via pull request, and thanks for reading!
149151
[import, lang:"ruby"](code/ruby/monte_carlo.rb)
150152
{% sample lang="f90" %}
151153
[import, lang:"fortran"](code/fortran/monte_carlo.f90)
154+
{% sample lang="emojic" %}
155+
[import, lang:"emojicode"](code/emojicode/monte_carlo.emojic)
152156
{% sample lang="php" %}
153157
[import, lang:"php"](code/php/monte_carlo.php)
154158
{% sample lang="lua" %}

0 commit comments

Comments
 (0)