-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlesson6.html
More file actions
199 lines (177 loc) · 10.7 KB
/
lesson6.html
File metadata and controls
199 lines (177 loc) · 10.7 KB
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
191
192
193
194
195
196
197
198
<!--
lesson6.html
Authors: Javier Laveaga, William Goldman, Izzy Morales
Date: July 31, 2024
Version: 1.0
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Lessons Placemat</title>
<!-- MAKE SURE YOU KEEP THE PYSCRIPT IMPORT UP TO DATE-->
<script type="module" src="https://pyscript.net/releases/2025.2.1/core.js"></script>
<link rel="stylesheet" href="https://pyscript.net/releases/2025.2.1/core.css">
<script src="script.js"></script>
<link rel="icon" type="image/png" href="images/favicon-32x32.png">
<link rel="stylesheet" href="./style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <!--For save button-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> <!--For download exception icon-->
</head>
<body id="lesson6">
<script type="mpy-editor" src="./main.py" config="./pyscript.toml" setup></script>
<header>
<nav class="headbar">
<a href="index.html" id="lesson1-link" >Lesson 1</a>
<a href="lesson2.html" id="lesson2-link">Lesson 2</a>
<a href="lesson3.html" id="lesson3-link">Lesson 3</a>
<a href="lesson4.html" id="lesson4-link">Lesson 4</a>
<a href="lesson5.html" id="lesson5-link">Lesson 5</a>
<a href="lesson6.html" id = "lesson6-link" class="active">Lesson 6</a> <!-- hello !-->
</nav>
</header>
<div class="container">
<div class="section title-section">
<h1>AI Puppy Lesson 6: Puppy Disco</h1>
<p style="font-size:20px">Code your puppy to do dance moves! Use reinforcement learning to train it to perform a dance sequence!</p>
</div>
<div class="two-boxes-container">
<div class="yellow-box">
<h2>Machine Learning Type</h2>
<p style="font-size:18px">
<a href="https://www.geeksforgeeks.org/what-is-reinforcement-learning/" class="special-link">Reinforcement Learning</a>:
<a href="https://www.geeksforgeeks.org/q-learning-in-python/" class="special-link">Q-learning</a>
</p>
</div>
<div class="yellow-box">
<h2>Tools Used</h2>
<p style="font-size:18px">Color sensor, force sensor, motors, & starter code</p>
</div>
</div>
<div class="section go-sections">
<h2>Example Ideas</h2>
<p>Build a puppy that can be petted!</p>
<img class="puppyPicture" src="nobgimages/aipuppy4_360-removebg-preview.png" alt="Puppy 4">
<img class="puppyPicture" src="nobgimages/aipuppy5_480-removebg-preview.png" alt="Puppy 5">
<img class="puppyPicture" src="nobgimages/aipuppy2_360-removebg-preview.png" alt="Puppy 2">
</div>
<div class="section go-sections">
<h2>Tips & Troubleshooting</h2>
<div class="container3">
<p class="basic"><span style="font-weight: bold">READ</span> through the code before you start coding! Make sure your puppy can easily turn!<p>
<p class="basic">Code your puppy to go forwards, backwards, left, and right. <span style="font-weight: bold">Code “dance moves” in with those actions too!</span><p>
<p class="basic">Be patient! It may take time to get your puppy to do exactly what you want!<p>
<p class="basic">Test out your code in the puppy_move function before running the code for the entire lesson.<p>
<br>
<p class="title"><span style="font-weight: bold">TRAINING YOUR PUPPY:</span><p>
<p class="basic">Press the <span style="font-weight: bold">left button</span> if your puppy leaves the dance floor. This is a very bad reward. Your puppy will have to start the sequence over.<p>
<p class="basic">Press the <span style="font-weight: bold">right button</span> if your puppy does the wrong move, but stays on the dance floor. This is not a great reward.<p>
<p class="basic">Press the <span style="font-weight: bold">force sensor for less than a secon</span> if your puppy does the right move! This is a good reward!<p>
<p class="basic">Press the <span style="font-weight: bold">force sensor for a few seconds</span> if your puppy does the right dance move to get to the ending square! This is a great reward!<p>
</div>
</div>
<div class="container2">
<div class="header">
<div class="topDisplay">
<button class="button1 active" id="connect-spike">Connect</button>
<!--FOR RUN BUTTON-->
<!-- partial:index.partial.html -->
<div class="button-row">
<button class="button | button--toggle button--play disabled" id="custom-run-button" data-editor-id="MPcode" disabled> <i class="ph-play | gg-play-button"></i>
<i class="ph-pause | gg-play-stop"></i>
</button>
</div>
<!--button class="button1" id="custom-run-button" data-editor-id="MPcode">Run</button-->
<!--button class="button1" id="custom-run-button" >Run</button-->
<!--button class="button1" id="save_button" >Save</button-->
<button id="save_button" class="button1">
<i class="fa fa-save" ></i>
</button>
<div class="status-container">
<div id="sensor-info" class="sensor-info-container"></div>
<div class="progress-container" id="progressDiv">
<progress id="progress" value="0" max="100"></progress>
<span class="progress-text" id="progress-percent">0%</span>
</div>
</div>
</div>
</div>
<div id="overlay" class="overlay">
<div class="modal">
<p>
Do you want to save on SPIKE? <br>
<span class="subtitle"> (gives option to save locally first) </span>
</p>
<button id= "Yes-btn" class="btn-yes" >Yes</button>
<button id = "No-btn" class="btn-no" >No</button>
</div>
</div>
<div class="flexBox">
<br>
<div class="box left-box">
<textarea id='gitpath' > https://raw.githubusercontent.com/iliketocode2/AI-Puppy-UI/main/Lessons/Main_Lesson6.py https://raw.githubusercontent.com/iliketocode2/AI-Puppy-UI/main/Lessons/CEEO_AI.py</textarea>
<!--<label for="files">Choose a file:</label> -->
<div class="filesDiv">
<select name="files" id="files" class="files">
</select>
</div>
<div class="gifFrame"><img id="gif"></div>
<div class="horizontal-buttons">
<input type="file" id="fileRead" style="display: none;"> <!--Hide actual file selector. FileRead id important for JS function-->
<button class="button1" type="button" id="chooseFileButton">
<i class="fa fa-upload"></i>
</button>
<!--button class="button1" id="download-code">Download Code</button-->
<button id="download-code" class="button1">
<i class="fa fa-download"></i>
</button>
<button class="button1" id="sensor_readings">Sensors</button>
</div>
<div class="portInstructions" id="portInfo">
<h3>Port Assignments</h3>
<div class="wrap">
<p>Choose your own!</p>
</div>
</div>
</div>
<div class="right-container">
<div class="box right-box" id="hide_on_1_and_2">
<div class ="terminalFrame" id="terminalFrameId">Pyscript Editor
<script id="MPcode" type="mpy-editor" env="ble" class="mpy-editor-container"></script>
</div>
</div>
<div class="slider">...</div>
<div class="box right-box" id="resizeBox">
<div class="tab">
<button class="tablinks active" id="customTerminalButton" style="color: black;">Terminal</button>
<button class="tablinks" id="defaultTerminalButton" style="color: black;">Debug</button>
</div>
<div id="debug" class="tabcontent">
<div id="repl"></div>
</div>
<div id="terminal" class="tabcontent">
<div id="terminalMessages">
<div id="customTerminalMessage">Please connect to a SPIKE™ Prime to begin programming.<br><br></div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- terminal to be removed from visual completely later (however, toggle available for real terminal and custom)
and replaced by custom terminal: instructions will pop up based on this-->
<div class="section go-sections">
<h2>Extended Thinking</h2>
<p>What happens if you only give your puppy the worst award (left button) when it does the wrong move? Does it learn the dance sequence faster?</p>
<img src="nobgimages/th-removebg-preview (1).png" alt="Your brain if you think about this" width="100px" height="auto">
</div>
<footer>
<p style="text-align: center;">
<img style="height:50px;width:auto;"src="images/tags2.png" alt="intermediate ai animals">
</p>
<p>----------------------------------------------------------------------- ©2024. All rights reserved.Tufts.edu.com -----------------------------------------------------------------------</p>
</footer>
</div>
</body>
</html>