none
Challenge of the Month - March 2016 RRS feed

  • General discussion

  • 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!

    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.

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

    Text Challenges

    • Write a program to count the number of vowels in a sentense.
    • Write a program to translate a sentence between some of the languages supported by the Dictionary object.
    • Write a program to write out the times tables to the TextWindow.  Use colour and positionng to tabulate the numbers to make the display clear and easy to read.

    Graphics Challenges

    • Write a program to flash an object when the mouse passes over it.
    • Extend the program to have several randomly positioned shapes.
    • Write a program to move objects with some depth perspective - objects further away appear to move more slowly, they may also be fainter and be positioned behind foreground objects to help the effect.
    • Modify the program to move some stationary (or even moving) objects at different distances when the user's view changes.
    • Write a program with subroutines to move Triangle and Line shapes.  The subroutines should be able to move the shapes so their center is at defined coodinates.
    • Write a program to rotate and move a Line shape so that it rotates like a second hand on a watch.
    • Write a program to write a musical phrase for use with the Music object to standard notation on a stave.

    Maths Challenges

    • Write a program to solve quadratic equations.
    • Write a program to calculate all the internal angles of a triangle from the coordinates of the corners.

    Game Challenges

    • Write a simple FPS (first person shooter) game.  When you move in an FPS, it is the player's view that moves - this is the same as moving the objects in the view in the opposite direction.
    • Write a solliair marbles game.

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

    Monday, February 29, 2016 8:39 PM
    Moderator

All replies

  • Here is my program for March Challenge

    Solving Quadratic Equation

    program no: BMC859

    Here is a web page that I found that have helped me greatly to build my program and verify its accuracy.

    http://www.wikihow.com/Solve-Quadratic-Equations

    new version BMC859

    i have draw the formula -b2±√b2-4ac / 2a instead of a picture png outside the program.


    • Edited by YLedEditor Tuesday, March 8, 2016 5:01 PM drawing teh formula instead of a png
    Friday, March 4, 2016 5:39 PM
    Answerer
  • I'm new to this forum.  How do I access FTN740?

    Should I be posting my solutions there?

    Thanks!

    Saturday, March 5, 2016 5:38 PM
  • Enter (copy and paste) the 6 character code to import the source code, using the Import button.  You can use the Publish and Import to share code on this forum or elsewhere by just posting the 6 character code.

    Saturday, March 5, 2016 5:51 PM
    Moderator
  • Here's my solution to the 1st challenge:

    sentence = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
    vowels = "1=a;2=e;3=i;4=o;5=u"
    temp = sentence
    
    While Text.GetLength(temp) > 0
      If Array.ContainsValue(vowels, Text.GetSubText(temp, 1, 1)) Then
        tally = tally + 1
      EndIf  
      temp = Text.GetSubTextToEnd(temp, 2)
    EndWhile
    
    TextWindow.WriteLine(tally)

    Sunday, March 6, 2016 2:03 AM
    Moderator
  • Enter (copy and paste) the 6 character code to import the source code, using the Import button.  You can use the Publish and Import to share code on this forum or elsewhere by just posting the 6 character code.

    That's amazing!  Is there a directory listing of these files?  (The "samples" page does not include Small Basic programs.)  I might want to submit a few "extra credit" programs, but don't want to duplicate things that have already been done.


    Sunday, March 6, 2016 3:28 AM
  • Graphics Challenges

    • Write a program to flash an object when the mouse passes over it.

    get_Flickr()
    GraphicsWindow.MouseMove=Onmove

    Sub Onmove
      MX= GraphicsWindow.MouseX
      MY= GraphicsWindow.MouseY
      N= math.Ceiling(MX/dw)+(math.Ceiling(MY/dh)-1)*5
      GraphicsWindow.Title="Selected number ... "+N
      Shapes.SetOpacity(shp[LastN],20)
      Shapes.SetOpacity(shp[N],100)
      LastN=N
    EndSub

    Sub get_Flickr
      GW=1000
      GH=600
      GraphicsWindow.Width=GW
      GraphicsWindow.Height=GH
      '  20 images are  set   X-direction = 5 ,  Y-direction -4   
      dw=GW/5
      dh=GH/4
      For i=1 To 20
        dX=math.Remainder((i-1),5)
        dY=math.Floor((i-1)/5)
        img[i]=ImageList.LoadImage(Flickr.GetRandomPicture("Flower"))
        ih[i]=ImageList.GetHeightOfImage(img[i])
        iw[i]=ImageList.GetwidthOfImage(img[i])
        shp[i]=Shapes.AddImage(img[i])
        Shapes.Zoom(shp[i],dw/iw[i],dh/ih[i])
        Shapes.Move(shp[i],GW/5*dx-iw[i]/2+dw/2,GH/4*dy-ih[i]/2+dh/2)
        Shapes.SetOpacity(shp[i],20)
      EndFor
    EndSub


    Sunday, March 6, 2016 3:40 AM
    Answerer
  • That's amazing!  Is there a directory listing of these files?  (The "samples" page does not include Small Basic programs.)  I might want to submit a few "extra credit" programs, but don't want to duplicate things that have already been done.

    There is no complte directory listing - this forum is the best place to share your programs and see others.

    There are some limited lists of some complete games or other notable programs.  Here is one.  There probably are other lists.

    Sunday, March 6, 2016 10:29 AM
    Moderator
  • My solution for some of the graphics challenges:

    Import ID: WWJ310

    Tuesday, March 15, 2016 6:24 PM
  • My solution for some of the graphics challenges:

    Import ID: WWJ310


    I love the interface and good solutions.
    Tuesday, March 15, 2016 7:03 PM
    Moderator
  • This is my first step for a game challenge (solitaire marbles game): VRZ081.
    Screen shot of a program Solitaire Marbles Game 0.1a

    Nonki Takahashi


    Friday, March 18, 2016 7:54 AM
    Moderator
  • This is my second step for the Solitaire Marbles: VRZ081-0.

    Screen shot of a program Solitaire Marble 0.2a


    Nonki Takahashi



    Friday, March 18, 2016 1:23 PM
    Moderator
  • Beautiful design !!
    Friday, March 18, 2016 3:48 PM
    Answerer
  • Beautiful design !!
    Thanks, Yvan.

    Nonki Takahashi

    Friday, March 18, 2016 4:05 PM
    Moderator
  • This is my third step for the Solitaire Marbles: VRZ081-1.

    How to move a marble:

    1. Click a marble.
    2. Click a hole (or the marble again to cancel).

    Screen shot of a program Solitaire Marbles 0.3b


    Nonki Takahashi


    Friday, March 18, 2016 4:07 PM
    Moderator
  • This is my solution for a graphics challenge (musical phrase): FQH921-0.

    Screen shot of a program Musical Score 0.2b


    Nonki Takahashi

    Sunday, March 20, 2016 5:11 AM
    Moderator
  • Amazing !

    wonderful program, very neat and clear, well design, nice drawing !!

    This gives me the taste to challenge myself and produce a similar program but with more complex chords notes... coming soon!

    Monday, March 21, 2016 5:16 AM
    Answerer
  • Amazing !

    wonderful program, very neat and clear, well design, nice drawing !!

    This gives me the taste to challenge myself and produce a similar program but with more complex chords notes... coming soon!

    Yvan, great.  Thanks.

    Nonki Takahashi

    Wednesday, March 23, 2016 12:06 PM
    Moderator
  • superb design !!

    and i like  the  choices boxes interface as a presentation !

     

    Monday, March 28, 2016 2:41 PM
    Answerer