Skip to content

Commit 68c9a3b

Browse files
committed
final commit before submitting version 2 for review
1 parent 4689b23 commit 68c9a3b

7 files changed

+59
-92
lines changed

Code-Tutor/intents/1.0 Default Welcome Intent.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"priority": 500000,
6262
"webhookUsed": false,
6363
"webhookForSlotFilling": false,
64-
"lastUpdate": 1524527328,
64+
"lastUpdate": 1524531900,
6565
"fallbackIntent": false,
6666
"events": [
6767
{
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"id": "17016e26-d3fc-467f-b33a-8a4064b20660",
3+
"id": "a813c96c-1144-467d-9fed-4a631afd88bf",
44
"data": [
55
{
66
"text": "what is this",
@@ -12,7 +12,7 @@
1212
"updated": 1524527328
1313
},
1414
{
15-
"id": "1287e6be-22b2-4561-bdee-8fa9fd9c808e",
15+
"id": "a37eff9f-3d90-42e8-af3f-fc951d18c39c",
1616
"data": [
1717
{
1818
"text": "What do I do",
@@ -24,19 +24,7 @@
2424
"updated": 1524527328
2525
},
2626
{
27-
"id": "b9d239d2-5b27-4fec-9dcf-dae6a3f9c5ad",
28-
"data": [
29-
{
30-
"text": "hi",
31-
"userDefined": false
32-
}
33-
],
34-
"isTemplate": false,
35-
"count": 2,
36-
"updated": 1524527328
37-
},
38-
{
39-
"id": "348598db-c7c6-48c1-a163-444eb0fa3c45",
27+
"id": "d55a71f2-da14-499a-861f-35c2892f6bb7",
4028
"data": [
4129
{
4230
"text": "teach me to program",
@@ -48,7 +36,7 @@
4836
"updated": 1524527328
4937
},
5038
{
51-
"id": "eac3f7a7-3753-4b0c-bb63-672a88f1f0a3",
39+
"id": "cdf98b49-624a-4afc-adaf-efed1b88ae24",
5240
"data": [
5341
{
5442
"text": "what can i do",
@@ -60,7 +48,7 @@
6048
"updated": 1524527328
6149
},
6250
{
63-
"id": "e4e2e33b-e629-433e-bf9f-f1fa5667adda",
51+
"id": "943c7185-5979-4fca-b845-a0449dcad66c",
6452
"data": [
6553
{
6654
"text": "what do you do",
@@ -72,7 +60,7 @@
7260
"updated": 1524527328
7361
},
7462
{
75-
"id": "a2637368-0c32-4e5d-85c0-9eccbe8b520a",
63+
"id": "9300e4fe-feaf-4cd1-933f-2e8279f01293",
7664
"data": [
7765
{
7866
"text": "How do I program by talking?",
@@ -84,7 +72,7 @@
8472
"updated": 1524527328
8573
},
8674
{
87-
"id": "95a3d514-62dd-4de6-82ee-22f064f0b19f",
75+
"id": "a9b8db73-c771-479b-aecc-1b8a3173d4b8",
8876
"data": [
8977
{
9078
"text": "How can I program by voice?",
@@ -96,7 +84,7 @@
9684
"updated": 1524527328
9785
},
9886
{
99-
"id": "55c84e5b-e78a-40dc-b554-ec3495559517",
87+
"id": "c7deb1cd-0176-4667-8e41-60e73380d3c5",
10088
"data": [
10189
{
10290
"text": "I want to learn to program",
@@ -108,7 +96,7 @@
10896
"updated": 1524527328
10997
},
11098
{
111-
"id": "b670292c-5796-4826-bdcc-62fdf46710ac",
99+
"id": "67272d9e-c65b-49b2-b547-98a4a121b7ec",
112100
"data": [
113101
{
114102
"text": "teach me how to code",
@@ -120,7 +108,7 @@
120108
"updated": 1524527328
121109
},
122110
{
123-
"id": "d09ee55a-a7d2-4087-bf83-50bc11322f8c",
111+
"id": "e3c684c7-1606-4af4-88f1-4654f1b338e9",
124112
"data": [
125113
{
126114
"text": "go back to the beginning",
@@ -132,7 +120,7 @@
132120
"updated": 1524527328
133121
},
134122
{
135-
"id": "651a7a2b-eada-43ad-a270-1dd555eeb37f",
123+
"id": "30afccf7-9816-462d-9206-1972a3611963",
136124
"data": [
137125
{
138126
"text": "let\u0027s start again",
@@ -144,7 +132,7 @@
144132
"updated": 1524527328
145133
},
146134
{
147-
"id": "60f1c05b-2d30-425b-9119-28e255f615bb",
135+
"id": "d344d238-418f-4283-b96a-f6b5c8985982",
148136
"data": [
149137
{
150138
"text": "how do you use this?",
@@ -156,7 +144,7 @@
156144
"updated": 1524527328
157145
},
158146
{
159-
"id": "5bf1ef96-f112-450c-acf8-1cc5948b2fe2",
147+
"id": "12203eab-957d-44d9-bae9-bffc6d464331",
160148
"data": [
161149
{
162150
"text": "what am i supposed to do",
@@ -168,7 +156,7 @@
168156
"updated": 1524527328
169157
},
170158
{
171-
"id": "74113db4-6500-4b81-a5f6-a476ca0fd03c",
159+
"id": "11ef8587-3764-4e9d-b28e-bb544c1cbfa0",
172160
"data": [
173161
{
174162
"text": "how does this work",
@@ -180,7 +168,7 @@
180168
"updated": 1524527328
181169
},
182170
{
183-
"id": "626b4ab0-43db-4885-b557-561eb30e947e",
171+
"id": "a29c423d-c435-4779-ad94-90ff89a36f39",
184172
"data": [
185173
{
186174
"text": "what\u0027s going on",
@@ -190,53 +178,5 @@
190178
"isTemplate": false,
191179
"count": 0,
192180
"updated": 1524527328
193-
},
194-
{
195-
"id": "078f500e-6030-4967-ade2-5ebdf39e6a6a",
196-
"data": [
197-
{
198-
"text": "let\u0027s begin",
199-
"userDefined": false
200-
}
201-
],
202-
"isTemplate": false,
203-
"count": 0,
204-
"updated": 1524527328
205-
},
206-
{
207-
"id": "072146b9-a4a4-47ad-b2a8-a2b7b7a671f2",
208-
"data": [
209-
{
210-
"text": "let\u0027s start",
211-
"userDefined": false
212-
}
213-
],
214-
"isTemplate": false,
215-
"count": 0,
216-
"updated": 1524527328
217-
},
218-
{
219-
"id": "3c037c9b-941d-4adc-a27a-f86ad5c49e18",
220-
"data": [
221-
{
222-
"text": "hey",
223-
"userDefined": false
224-
}
225-
],
226-
"isTemplate": false,
227-
"count": 0,
228-
"updated": 1524527328
229-
},
230-
{
231-
"id": "8e1a74a4-ae7e-4cb0-a578-efb944dbfef1",
232-
"data": [
233-
{
234-
"text": "hello",
235-
"userDefined": false
236-
}
237-
],
238-
"isTemplate": false,
239-
"count": 1,
240-
"updated": 1524527328
241181
}
242182
]

Code-Tutor/intents/1.7 sandbox.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"platform": "google",
2222
"lang": "en",
2323
"customizeAudio": true,
24-
"ssml": "\u003cspeak\u003e\u003caudio src\u003d\"https://actions.google.com/sounds/v1/cartoon/wood_plank_flicks.ogg\"\u003e\u003c/audio\u003eIn this \"sandbox\", you have a little freedom to create any code you want. Here\u0027s examples of instructions you can say: \u003cbreak time\u003d\"1s\"/\u003e Apple equals 1. \u003cbreak time\u003d\"1s\"/\u003e Repeat 3 times. \u003cbreak time\u003d\"1s\"/\u003e Say hi. \u003cbreak time\u003d\"1s\"/\u003e If banana equals fruit. \u003cbreak time\u003d\"1s\"/\u003e When you\u0027re done, say \"run code\", and I\u0027ll follow the instructions. \u003cbreak time\u003d\"1s\"/\u003e If you need this list again, just say \"what\u0027s on the list\"\u003c/speak\u003e",
25-
"displayText": "In this \"sandbox\", you have a little freedom to create any code you want. Here\u0027s examples of instructions you can say:\n\n* apple equals 1\n* repeat 3 times\n* say hi\n* if banana equals fruit\n\nWhen you\u0027re done, say \"run code\", and I\u0027ll follow the instructions.\n\nIf you need this list again, just say \"what\u0027s on the list?\""
24+
"ssml": "\u003cspeak\u003e\u003caudio src\u003d\"https://actions.google.com/sounds/v1/cartoon/wood_plank_flicks.ogg\"\u003e\u003c/audio\u003eIn this \"sandbox\", you have a little freedom to create almost any code you want. Here\u0027s examples of instructions you can say: \u003cbreak time\u003d\"1s\"/\u003e Apple equals 1. \u003cbreak time\u003d\"1s\"/\u003e Repeat 3 times. \u003cbreak time\u003d\"1s\"/\u003e Say hi. \u003cbreak time\u003d\"1s\"/\u003e If banana equals fruit. \u003cbreak time\u003d\"1s\"/\u003e When you\u0027re done, say \"run code\", and I\u0027ll follow the instructions. \u003cbreak time\u003d\"1s\"/\u003e If you need this list again, just say \"what\u0027s on the list\"\u003c/speak\u003e",
25+
"displayText": "In this \"sandbox\", you have a little freedom to create almost any code you want. Here\u0027s examples of instructions you can say:\n\n* apple equals 1.\n* repeat 3 times.\n* say hi.\n* if banana equals fruit.\n\nWhen you\u0027re done, say \"run code\", and I\u0027ll follow the instructions.\n\nIf you need this list again, just say \"what\u0027s on the list?\""
2626
},
2727
{
2828
"type": 0,
@@ -39,7 +39,7 @@
3939
"priority": 500000,
4040
"webhookUsed": false,
4141
"webhookForSlotFilling": false,
42-
"lastUpdate": 1524530252,
42+
"lastUpdate": 1524531841,
4343
"fallbackIntent": false,
4444
"events": []
4545
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"id": "6f9c9d31-301b-440c-9a21-d86cd7120a78",
3+
"id": "882f476c-7ede-4914-bd34-278e2ce20ba2",
44
"data": [
55
{
66
"text": "sandbox",
@@ -9,6 +9,6 @@
99
],
1010
"isTemplate": false,
1111
"count": 0,
12-
"updated": 1524530174
12+
"updated": 1524531841
1313
}
1414
]

Code-Tutor/intents/3.7.4 sandbox - if.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"priority": 500000,
6565
"webhookUsed": true,
6666
"webhookForSlotFilling": false,
67-
"lastUpdate": 1524412508,
67+
"lastUpdate": 1524531940,
6868
"fallbackIntent": false,
6969
"events": []
7070
}

Code-Tutor/intents/3.7.4 sandbox - if_usersays_en.json

+33-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
11
[
22
{
3-
"id": "6f2746f2-f089-48c7-8ece-5c4be35de3d2",
3+
"id": "b1638575-bb65-4d87-87e4-d5ebe5e1e589",
4+
"data": [
5+
{
6+
"text": "check if @sys.any:variable equals @sys.any:value then",
7+
"userDefined": false
8+
}
9+
],
10+
"isTemplate": true,
11+
"count": 0,
12+
"updated": 1524531940
13+
},
14+
{
15+
"id": "7140a077-6ef8-4231-b4e6-d04af07f4393",
16+
"data": [
17+
{
18+
"text": "check if @sys.any:variable equals @sys.any:value",
19+
"userDefined": false
20+
}
21+
],
22+
"isTemplate": true,
23+
"count": 0,
24+
"updated": 1524531940
25+
},
26+
{
27+
"id": "587063cf-8e29-43e8-8641-d6131c971203",
428
"data": [
529
{
630
"text": "if @sys.any:variable \u003d\u003d @sys.any:value",
@@ -12,7 +36,7 @@
1236
"updated": 1524412508
1337
},
1438
{
15-
"id": "ec060771-d8e2-40b7-b16f-87e5b96b1e00",
39+
"id": "70457962-e6d7-4166-abe5-2bd5eb62c952",
1640
"data": [
1741
{
1842
"text": "if @sys.any:variable \u003d @sys.any:value then",
@@ -24,7 +48,7 @@
2448
"updated": 1524412508
2549
},
2650
{
27-
"id": "6b700e39-a7da-46b1-bf12-ffe31e9b841c",
51+
"id": "d2d8805d-e706-4602-b513-29494a8bae64",
2852
"data": [
2953
{
3054
"text": "if @sys.any:variable \u003d @sys.any:value",
@@ -36,7 +60,7 @@
3660
"updated": 1524412508
3761
},
3862
{
39-
"id": "2c540ae4-c52b-4bde-9cba-c711946db245",
63+
"id": "77959250-100d-4d07-b740-67ddb051140e",
4064
"data": [
4165
{
4266
"text": "if @sys.any:variable is @sys.any:value then",
@@ -48,7 +72,7 @@
4872
"updated": 1524279451
4973
},
5074
{
51-
"id": "ffa39423-198e-4249-b5c4-884c8aaf1120",
75+
"id": "7b0d3be8-c292-4944-a0eb-5ed034b41267",
5276
"data": [
5377
{
5478
"text": "if @sys.any:variable is @sys.any:value",
@@ -60,7 +84,7 @@
6084
"updated": 1524279451
6185
},
6286
{
63-
"id": "e5ffc1c1-4f60-402d-bc58-6c622b3ee054",
87+
"id": "8ca350cf-f391-4a6a-9496-8dbf8a89d427",
6488
"data": [
6589
{
6690
"text": "if @sys.any:variable is equal to @sys.any:value then",
@@ -72,7 +96,7 @@
7296
"updated": 1524279451
7397
},
7498
{
75-
"id": "aea5c17a-3612-4aae-9f1c-ac55b93923e0",
99+
"id": "fdaa1e2b-949d-46a9-8bc7-8441d039afa3",
76100
"data": [
77101
{
78102
"text": "if @sys.any:variable is equal to @sys.any:value",
@@ -84,7 +108,7 @@
84108
"updated": 1524279451
85109
},
86110
{
87-
"id": "eb5fd90a-3f95-406e-bdbe-d79bb7da68c9",
111+
"id": "d8a6f6b3-53bd-4b65-b968-9835c57e9bfb",
88112
"data": [
89113
{
90114
"text": "if @sys.any:variable equals @sys.any:value then",
@@ -96,7 +120,7 @@
96120
"updated": 1524279451
97121
},
98122
{
99-
"id": "685cdb46-39e2-4c9f-bfdb-574ab81a2ae8",
123+
"id": "2a9adfc6-8614-45d0-b8d5-eb05e870613e",
100124
"data": [
101125
{
102126
"text": "if @sys.any:variable equals @sys.any:value",

index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, resp
163163
let googleResponse = app.buildRichResponse()
164164
.addSimpleResponse("Here's your code:")
165165
.addSimpleResponse({
166-
speech: `${code}. That's it for the code. Now, in code, we count from 0. And because we want to repeat ${times} times, we need to stop 1 step before ${times}. Say "run code" and I'll follow the instructions.`,
166+
speech: `${code}. That's it for the code. By the way, in code, we count from 0. And because we want to repeat ${times} times, we need to stop 1 step before ${times}. Say "run code" and I'll follow the instructions.`,
167167
displayText: code
168168
})
169169
.addSuggestions(['run code', 'do something else'])
@@ -583,6 +583,9 @@ const getOutput = (code) => {
583583
} else if (isAfterFor) {
584584

585585
let times = parseInt(isAfterFor[2]) - parseInt(isAfterFor[1]);
586+
if (times === undefined || times > 5 || times < 1) {
587+
times = 5;
588+
}
586589
if (isSaying) {
587590
let variableName = isSaying[1];
588591
if (codeVariables.includes(variableName)) {

0 commit comments

Comments
 (0)