|
| 1 | +--- |
| 2 | +layout: base.html |
| 3 | +title: Simple HTML - Programs and puzzles |
| 4 | +--- |
| 5 | +<section class="side-by-side"> |
| 6 | + <canvas class="game right" id="canvas" oncontextmenu="event.preventDefault()"></canvas> |
| 7 | + <div> |
| 8 | + <article> |
| 9 | + <h1>Programs and puzzles</h1> |
| 10 | + |
| 11 | +<p> |
| 12 | + Here and on the next few pages, there are |
| 13 | + programs to try and puzzles to solve. |
| 14 | + They all involve BASIC commands |
| 15 | + covered in this book. |
| 16 | +</p> |
| 17 | + |
| 18 | +<h2>Words and spaces</h2> |
| 19 | + |
| 20 | +<p> |
| 21 | + Try this program. It makes |
| 22 | + the computer display words |
| 23 | + next to each other on the screen. |
| 24 | +</p> |
| 25 | +<pre> |
| 26 | +10 CLS |
| 27 | +20 PRINT "RED";"ROSE" |
| 28 | +30 PRINT "BLACK";"COAL" |
| 29 | +40 PRINT "WHITE" ;"SNOW" |
| 30 | +</pre> |
| 31 | +<p> |
| 32 | +See if you can change the |
| 33 | +<code class="command">PRINT</code> lines to make spaces |
| 34 | +between the words, as shown in #2 below. |
| 35 | +</p> |
| 36 | +<p> |
| 37 | + <center><img src="{{ base_uri }}/img/usborne/simple-basic/img/13puzzle1.png"></center> |
| 38 | +</p> |
| 39 | +<p> |
| 40 | +Can you change the <code class="command">PRINT</code> |
| 41 | +lines again so the computer |
| 42 | +arranges the words in two |
| 43 | +columns like in #3? |
| 44 | +</p> |
| 45 | + |
| 46 | +<h2>Star lines</h2> |
| 47 | +<p> |
| 48 | + Run this program to make |
| 49 | + your computer display a |
| 50 | + line of stars at the side |
| 51 | + of the screen. |
| 52 | +</p> |
| 53 | +<pre> |
| 54 | +10 CLS |
| 55 | +20 FOR K=1 TO 10 |
| 56 | +30 PRINT TAB(3);"*" |
| 57 | +40 NEXT K |
| 58 | +</pre> |
| 59 | + |
| 60 | +<p> |
| 61 | + By changing the number |
| 62 | + after <code>TAB</code>, can you put the |
| 63 | + stars in the middle of the screen? |
| 64 | +</p> |
| 65 | +<p> |
| 66 | +Can you change the program |
| 67 | +again to make a line of stars |
| 68 | +across the screen, like this? |
| 69 | +</p> |
| 70 | +<p> |
| 71 | + <center><img src="{{ base_uri }}/img/usborne/simple-basic/img/13puzzle2.png"></center> |
| 72 | +</p> |
| 73 | + </article> |
| 74 | + </div> |
| 75 | +</section> |
0 commit comments