81 lines
1.8 KiB
Plaintext
81 lines
1.8 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Blockly deconstructed\n",
|
||
|
"\n",
|
||
|
"Consider this [blockly program](https://blockly.games/bird?lang=en&level=2#562ubo).\n",
|
||
|
"\n",
|
||
|
"![blockly-bird](blockly-bird.png)\n",
|
||
|
"\n",
|
||
|
"This is actually a full computer program! When you succesfully complete it, you can see the automatic translation to Javascript. (Javascript is obviously a different programming language than Python, but the important points we can discuss anyway.)\n",
|
||
|
"\n",
|
||
|
"```\n",
|
||
|
"if (noWorm()) {\n",
|
||
|
" heading(0);\n",
|
||
|
"} else {\n",
|
||
|
" heading(90);\n",
|
||
|
"}\n",
|
||
|
"```\n",
|
||
|
"\n",
|
||
|
"if we would re-write this in Python, it would be:\n",
|
||
|
"\n",
|
||
|
"```\n",
|
||
|
"if noWorm():\n",
|
||
|
" heading(0)\n",
|
||
|
"else:\n",
|
||
|
" heading(90)\n",
|
||
|
"```"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Let's discuss what is going on here.\n",
|
||
|
"\n",
|
||
|
"(Discussion of computer program, computer, operating system, external world.)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Consider this [blockly program](https://blockly.games/music?lang=en&level=3#juok8w).\n",
|
||
|
"\n",
|
||
|
"![blockly](blockly.png)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"The main conceptual new thing is the use of **functions**."
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3 (ipykernel)",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.11.8"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 4
|
||
|
}
|