次の方法で共有


Small Basic Challenges of the Month - July 2017

These challenges are intended for people who are learning to program for the first time or for those returning to programming who want to start using Small Basic.  Some will be easy, some will be hard - but they will all make you think, and more importantly be GREAT FUN!

Contribute to the challenges in this Forum thread:

Please post your solutions / partial solutions / questions / feedback etc. into this thread that will remain 'sticky' for the month.  The only rule is that your solution must use standard Small Basic methods (no extensions).

It would be good if people could post their problems with these challenges so that a discussion can start so that everyone can learn from each other.

We may extend these challenges over into a second month if solutions and questions are still coming in.

Text Challenges

  • Write a program reverse all the characters in a sentence ("hello world" -> "dlrow olleh")
  • Write a program to reverse the word order in a sentence ("hello world" -> "world hello")
  • Write a program to swap pairs of characters in a sentence ("hello world" -> "ehll oowlrd")
  • Write a program to capitalise every word in a sentence ("hello world" -> "Hello World")

Maths Challenges

  • Write a program to calculate the sum of the first 10 whole numbers (1+2+3+...+9+10)
  • Write a program to calculate the sum of the first 10 even numbers (2+4+...+18+20)
  • Write a program to calculate the sum of the first 10 odd numbers (1+3+...+17+19)
  • Write a program to calculate the sum of the first 10 numbers that are a divisible by 3 (3+6+...+27+30)
  • Write a program to calculate the sum of the first 10 numbers squared (1+4+...+81+100)

Graphics Challenges

  • Draw a picture of your pet (or animal you would like to be your pet)
  • Draw a picture with that animates from day to night, perhaps a moving sun and moon, maybe stars gradually appearing

Interface Challenge

  • Write a GraphicsWIndow interface using the Controls and Shapes commands with events to get the user to enter 5 numbers and get the program to calculate their sum, average, minimum and maximum values when buttons for these are pressed
  • Validate that all data is correctly entered (e.g. all data are numbers and present)

Game Challenge

  • Write a simple platform game, where your player has to move from left to right and jump over an obstacle or gap
  • Extend as far as you can to include other features like scrolling with player, duck below objects, jump to get coins, avoid enemies, etc.

Physics Challenge

  • Write a program to simulate an internal combustion engine, valves openning, piston moving and turning a crank shaft

Do you have an idea for a future challenge? Please post it here!

Big thanks to LitDev for hosting this challenge!

 

Small and Basically loving the community!

- Ninja Ed

Comments

  • Anonymous
    September 06, 2017
    The comment has been removed