- Page 1 and 2:
Learn to Program with Small Basic A
- Page 4 and 5:
Learn to Program with Small Basic A
- Page 6:
Brief Contents Foreword by Vijaye R
- Page 9 and 10:
Exploring Other Features. .........
- Page 11 and 12:
7 Empowering Programs with math 83
- Page 13 and 14:
12 building Graphical User Interfac
- Page 15 and 16:
Storing Records. ..................
- Page 18 and 19:
Foreword Computer programming is ma
- Page 20 and 21:
Acknowledgments This book represent
- Page 22 and 23:
Introduction Have you ever wondered
- Page 24 and 25:
• In Chapter 11: Event-Driven Pro
- Page 26 and 27:
1 Introducing Small Basic Bill Gate
- Page 28 and 29:
BASIC language that would help kids
- Page 30 and 31:
Toolbar Help Area Editor Surface Fi
- Page 32 and 33:
Then click the New button to open a
- Page 34 and 35:
Helping Hands: IntelliSense and Syn
- Page 36:
Programming Challenges If you get s
- Page 39 and 40:
The Parts of a Program Let’s expl
- Page 41 and 42:
The method’s name and a brief des
- Page 43 and 44:
5 + 7 12 Here’s the output of thi
- Page 45 and 46:
For example, to make the TextWindow
- Page 47 and 48:
TRY IT OUT 2-3 Now you have a chanc
- Page 49 and 50:
Programming Errors Just because a p
- Page 51 and 52:
26 Chapter 2 4. Write a program tha
- Page 53 and 54:
In the system you use at school, po
- Page 55 and 56:
Drawing Shapes You can draw lots of
- Page 57 and 58:
Figure 3-6 shows what the output lo
- Page 59 and 60:
22 GraphicsWindow.BrushColor = "Lig
- Page 61 and 62:
DrawText() takes three arguments. T
- Page 63 and 64:
GraphicsWindow provides two methods
- Page 65 and 66:
6. Write a program that draws this
- Page 68 and 69:
4 Using Variables Have you ever wan
- Page 70 and 71:
Try changing the value in karenBear
- Page 72 and 73:
These two ways of updating the scor
- Page 74 and 75:
Figure 4-2: How a variable is added
- Page 76 and 77:
TRY IT OUT 4-3 Write a program that
- Page 78 and 79:
Two Kinds of Data Programs use all
- Page 80 and 81:
5 Drawing Shapes with Turtle Graphi
- Page 82 and 83:
Absolute Motion With absolute motio
- Page 84 and 85:
North 0 (360) 315 (-45) 45 (-315) W
- Page 86 and 87:
GraphicsWindow.PenColor = "Red" Gra
- Page 88 and 89:
The For loop runs Turtle.Move(60) a
- Page 90 and 91:
y 5). For the hexagon (the polygon
- Page 92 and 93:
Creating Polygon Art Using Nested L
- Page 94 and 95:
Endless Graphics In Listing 5-10 yo
- Page 96:
Write a program to have the turtle
- Page 99 and 100:
Talking to the Computer Until now,
- Page 101 and 102:
Figure 6-2: The text window waiting
- Page 103 and 104:
4 C = (5 / 9) * (F - 32) 5 C = Math
- Page 105 and 106:
9 noun = TextWindow.Read() 10 11 Te
- Page 108 and 109:
7 Empowering Programs with Math If
- Page 110 and 111:
Here’s a sample run of our progra
- Page 112 and 113:
Round() -4 -3.5 -3 0 3 3.5 4 Round(
- Page 114 and 115:
This code snippet shows you some ex
- Page 116 and 117:
Let’s walk through this program l
- Page 118 and 119:
Trigonometric Methods Trigonometric
- Page 120:
Programming Challenges If you get s
- Page 123 and 124:
Small Basic uses a few different wa
- Page 125 and 126:
You can test all sorts of condition
- Page 127 and 128:
Small Basic first finds the value o
- Page 129 and 130:
Your mom’s instructions assume th
- Page 131 and 132:
But wait, your mom just realized th
- Page 133 and 134:
This code asks the user to enter a
- Page 136 and 137:
9 Using Decisions to Make Games Som
- Page 138 and 139:
Condition 1 True Statement set 1 If
- Page 140 and 141:
This change to the program means th
- Page 142 and 143:
Door 1 Door 2 Door 3 Figure 9-6: Pe
- Page 144 and 145:
Listing 9-4 shows an example of usi
- Page 146 and 147:
Think of the Shapes object as a “
- Page 148 and 149:
Background image (Grid.png) Star.pn
- Page 150 and 151:
In Figure 9-8, you see that the gri
- Page 152 and 153:
This code asks the player to enter
- Page 154 and 155:
10 Solving Problems with Subroutine
- Page 156 and 157:
Gulliver later learned that 1 glum-
- Page 158 and 159:
TRY IT OUT 10-1 When Gulliver asked
- Page 160 and 161:
variables that belong to the main p
- Page 162 and 163:
4 TextWindow.WriteLine("Your turn.
- Page 164 and 165:
1 step away). If the arrow hits the
- Page 166 and 167:
Then you set the graphics window’
- Page 168 and 169: 24 Shapes.SetText(msgText, "") 25 T
- Page 170 and 171: Step 8: Shoot Arrows with ShootArro
- Page 172 and 173: Lines 3-7 animate the dragon’s fi
- Page 174 and 175: 11 Event-Driven Programming So far,
- Page 176 and 177: GraphicsWindow Events Let’s start
- Page 178 and 179: 4 5 Sub OnKeyDown 6 GraphicsWindow.
- Page 180 and 181: 13 Else 14 GraphicsWindow.DrawText(
- Page 182 and 183: Useful Tips Before moving on, we’
- Page 184 and 185: 21 GraphicsWindow.BrushColor = "Red
- Page 186 and 187: 4 XG = Math.GetRandomNumber(8) - 1
- Page 188: Programming Challenges If you get s
- Page 191 and 192: Today, most programs use a graphica
- Page 193 and 194: located at (100, 100). By default,
- Page 195 and 196: 9 GraphicsWindow.MouseMove = OnMous
- Page 197 and 198: Let’s look at the computations. Y
- Page 199 and 200: You start by loading the two backgr
- Page 201 and 202: (line 8). If the total resistance i
- Page 203 and 204: TRY IT OUT 12-4 Write a program to
- Page 206 and 207: 13 Repeating For Loops Have you eve
- Page 208 and 209: Each For loop starts with the keywo
- Page 210 and 211: The program uses a variable named s
- Page 212 and 213: TRY IT OUT 13-5 What does the follo
- Page 214 and 215: Nested Loops The statements in the
- Page 216 and 217: Figure 13-7: The output of Stamp.sb
- Page 220 and 221: 14 Creating Conditional While Loops
- Page 222 and 223: This piece of code simply says, “
- Page 224 and 225: Tip Make sure you initialize any va
- Page 226 and 227: Images P1, P2, and P3 show the play
- Page 228 and 229: TIP If you want to find out the exa
- Page 230: 2. Open the file SimpleSlot.sb from
- Page 233 and 234: eferenced using a string index, suc
- Page 235 and 236: This line of code adds five to the
- Page 237 and 238: Constant Initialization The followi
- Page 239 and 240: Here’s the output of this loop: a
- Page 241 and 242: TRY IT OUT 15-4 Write a program tha
- Page 243 and 244: 3 ans[2] = "It is decidedly so. By
- Page 245 and 246: 20 numMissed = 0 ' Missed apples 21
- Page 247 and 248: 7 CheckCatch() ' Checks if the appl
- Page 249 and 250: and bounces to the left or to the r
- Page 252 and 253: 16 Storing Data with Associative Ar
- Page 254 and 255: Let’s look at some sample runs of
- Page 256 and 257: TRY IT OUT 16-1 What’s the output
- Page 258 and 259: This code uses the Array object’s
- Page 260 and 261: 6 For N = 1 To Array.GetItemCount(n
- Page 262 and 263: Step 2: Set Up the Graphical User I
- Page 264: TRY IT OUT 16-4 Run your poet progr
- Page 267 and 268: The arrays you’ll make in this ch
- Page 269 and 270:
Following along with this figure, w
- Page 271 and 272:
To move the square, we call the Mov
- Page 273 and 274:
Going Interactive Let’s explore h
- Page 275 and 276:
Duckberg Industries December Sales
- Page 277 and 278:
TRY IT OUT 17-5 Donald wants to rev
- Page 279 and 280:
Forest Rain btnN btnE btnS btnW Flo
- Page 281 and 282:
8 ShowLocation() ' Gives feedback t
- Page 283 and 284:
Step 6: Show the Player’s Locatio
- Page 285 and 286:
We mentioned that the old compass h
- Page 288 and 289:
18 Advanced Text Magic Although pic
- Page 290 and 291:
Earlier in the book, you learned ho
- Page 292 and 293:
The GetSubText() Method To extract
- Page 294 and 295:
3 lwrCase = Text.ConvertToLowerCase
- Page 296 and 297:
a: 97 b: 98 1: 49 2: 50 Fancy Chara
- Page 298 and 299:
Armed with the knowledge you’ve g
- Page 300 and 301:
sixth digits, and so on. If any two
- Page 302 and 303:
TRY IT OUT 18-7 Write a program tha
- Page 304 and 305:
Listing 18-9 shows the main part of
- Page 306 and 307:
Page1 This is the House that Jack b
- Page 308 and 309:
Lines 2-8 set up the GraphicsWindow
- Page 310:
Complete the GetInput() subroutine,
- Page 313 and 314:
In most programming languages, work
- Page 315 and 316:
The filesystem has a tree structure
- Page 317 and 318:
5 TextWindow.WriteLine(str) 6 TextW
- Page 319 and 320:
output file (line 16). If the file
- Page 321 and 322:
When you run this program, it creat
- Page 323 and 324:
To keep the code simple, we didn’
- Page 325 and 326:
WARNING When you call DeleteDirecto
- Page 327 and 328:
We automatically load the contents
- Page 329 and 330:
16 TextWindow.WriteLine("The game w
- Page 331 and 332:
2. Write a science quiz that tests
- Page 333 and 334:
Review Questions Test your knowledg
- Page 335 and 336:
C CaptainCork_ Incomplete.sb, 109 c
- Page 337 and 338:
Format Program, 99 FrenchDay.sb, 23
- Page 339 and 340:
MovingWord.sb, 184 .mp3 files, 289
- Page 341 and 342:
Small Basic, continued integrated d
- Page 343 and 344:
Updates Visit http://nostarch.com/s