Quantcast
Channel: Small Basic
Viewing all articles
Browse latest Browse all 669

Small Basic Challenges of the Month - December 2015 (turtle, tree, your national anthem, Euler, stickman, AI, and more!)

$
0
0

These challenges come from LitDev (and community submissions) 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!

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).

Post your answers here:

https://social.msdn.microsoft.com/Forums/en-US/b9ab0f8c-469e-41f5-85d4-f6bd070cdefc/challenge-of-the-month-december-2015?forum=smallbasic
 

It would be good if people could post their problems they encounter along 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.

Also post feedback on the kind of challenges that you want to see more of in the future.

Small Challenges

  • Use the Turtle to follow your mouse.
  • Write a program to draw a tree in the GraphicsWindow.
  • Write a program to input and sum 5 numbers input by a user.
  • Write a program to spell check the words in a sentense (use the Dictionary object).
  • Write a program to play a few lines from your national anthem (use the Sound.PlayMusic method).

     

Maths Challenges - Project Euler

We had some of these challenges several years ago, but here are the first 5 again.  The full set (some very hard) can be found https://projecteuler.net/archives.

  • 1] Multiples of 3 and 5

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9.  The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

  • 2] Even Fibonacci numbers

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

  • 3] Largest prime factor

The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?

  • 4] Largest palindrome product

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.

Find the largest palindrome made from the product of two 3-digit numbers.

  • 5] Smallest multiple

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is divisible with no remainder "evenly divisible" by all of the numbers from 1 to 20?

   

Community Suggestion (By JetFire3201)

  • Could we do a stickman running animation challenge?
  • Suggestion - Create an animated stickman that can run and jump with animated limbs reacting to key presses.

  

Community Suggestions (By Zock77)

Advanced Artificial Intelligence (AI)

This is a facinating, but pretty tough challenge by Zock77.

  • Check this out!  It is so cool!

https://www.youtube.com/watch?v=qv6UVOQ0F44

  • Suggestion - Perhaps create a simple Artificial Neural Net (ANN) program that can be trained to a simple task like approximating an equation curve.

  

More Challenges

  • Find the square root without using Math.SquareRoot (or any Math object methods if you can).
  • Draw an ellipse using lines. (easy)
  • Or for something more challenging: Make a filled ellipse without using ellipse methods.
  • Write a program to find the GCF (Greatest Common Factor) of two numbers.

 

Community Suggestions (By Jibba Jabba)

We have a whole set of progressive graphical challenges by Jibba Jabba.  Complete these and you will be right up there!

Use a Main loop for these and try nuzzling them into game loop structure.

Basic Motion

  1. Make a square shape move from left to right of screen at a constant speed.
  2. Using arrays, place 2 more shapes on top of this shape and have them move in tandem.

 

  1. Make a circular shape move from the top to bottom of the GW at a constant speed.
  2. Now make this shape move on the same path from a standing start under the influence of gravity
  3. Now add friction/drag to this.

 

  1. Make a shape move horizontally across the screen bouncing off the edges with constant speed.
  2. Make a shape bounce from top to bottom from a standing start under the influence of gravity.
  3. Now add friction to this. Eventually the shape should stop.

 

  1. Make a shape move randomly all over the screen at a constant speed.
  2. Maybe apply some acceleration to this.

 

 
  1. Make a shape move in a circular path around a stationary shape placed in the centre.
  2. Add a satellite to this orbiting body.
  3. Have a go at changing the orbit to an elliptical path
  4. Add a continuous random barrage of asteroids that respond to any collisions

 

---------------------------------------------------------------------------------------------

  • Make a step up game where a ball bounces up a set of steps. User can move the ball left and right.
  • Make a calculator.  For a nice GUI check out Nonki's website.
  • Make some interesting Backgrounds. There was a recent blog on this by Nonki.
  • Also make some interesting gradient backgrounds, can use RGB, random or constant fills for this. The backgrounds don't have to be full window. If you make them extensible they can become part of your own code library.

 

---------------------------------------------------------------------------------------------

  • For advanced collision model some random balls colliding into each other.

 

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

  

Thank you for joining us!

Small and Basically yours,

   - Ninja Ed & LitDev


Viewing all articles
Browse latest Browse all 669

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>