none
Challenge of the Month - November 2018 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.

    Graphics Challeges

    • Draw a train
    • Draw a wizard
    • Draw a dragon

    Animated Graphics Challenges

    • Flash a message at random intervals in the GraphicsWindow, say randomly between 5 and 20 second intervals.
    • Draw an animated (moving) 'nodding donkey' well.  There are plenty of YouTube videos of them working.

    File Challenge

    • Write a program to log all key presses to a file, recording the time when they were pressed

    Maths Challenges

    1. What is the smallest number which when divided by 28 leaves 8 as remainder and when divided by 32 leaves 12 as the remainder?
    2. What is the smallest four digit number which when divided by 16 and 18 leaves remainder 8 in each case?
    3. What is the smallest number which when divided by 12 and 18 leaves a remainder of 9?
    4. What is the smallest number that leaves 3 as remainder when divided by 18 and 24?
    5. What is the smallest number which when divided by 14 and 21 leaves no remainder?
    6. What is the smallest number which leaves 3 as a remainder when divided by 9, 12, 18, and 30?

    Turtle Challenge

    • Load the image of a maze below into the GraphicsWindow, then get the turtle to navigate the maze.

    maze = "https://social.msdn.microsoft.com/Forums/getfile/1354354"
    GraphicsWindow.DrawResizedImage(maze,0,0,GraphicsWindow.Width,GraphicsWindow.Height)

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

    Wednesday, October 31, 2018 7:58 PM
    Moderator

All replies

  • Here is one "Way Out" of the MAZE.  WGX265

    Thursday, November 1, 2018 4:54 AM
  • Maze "way out" ID QGX714
                                                                                                                 mahreen miangul
    Sunday, November 4, 2018 4:27 AM
  • This is my first step for the Turtle Challenge: ZLC681-5.

    Screen shot of a program Maze 1.5


    Nonki Takahashi

    Wednesday, November 7, 2018 2:16 PM
    Moderator
  • mahreen miangul Smile ID MBT602

                                                                                                         mahreen miangul

    Thursday, November 8, 2018 2:29 PM
  • Remainders Challenges ID: VWH504
    Thursday, November 8, 2018 11:39 PM
    Answerer
  • This is my solution for the graphics challenge "Draw a train": HKR115.

    Screen shot of a program Train Sample - 0 Series Shinkansen


    Nonki Takahashi

    Tuesday, November 13, 2018 4:50 PM
    Moderator
  • Quel est le plus petit nombre qui, divisé par 28, laisse 8 comme reste 
    'et quand divisé par 32 laisse 12, le reste?

    num=x
    For x =28 To 1000
      remainder1 = Math.Remainder(num, 28)
      remainder2 = Math.Remainder(num, 32) 

      If  remainder1 = 8 And remainder2 = 12 Then
         TextWindow.WriteLine(num)
       Else  
         num=x+1 
     EndIf 

    EndFor
    Tuesday, November 13, 2018 8:28 PM
  • small variation:

    For num =28 To 1000
      remainder1 = Math.Remainder(num, 28)
      remainder2 = Math.Remainder(num, 32) 
      If  remainder1 = 8 And remainder2 = 12 Then
        TextWindow.WriteLine(num)
        'num=1001
      EndIf 
    EndFor

    Tuesday, November 13, 2018 9:41 PM
  • This my next idea for the Turtle challenge: to use A* search algorithm.

    Nonki Takahashi

    Wednesday, November 14, 2018 7:33 AM
    Moderator
  • thank you

    but this program give all the numbers between 1 and 1000 (204,428,652,876) and the mine give only the first ,the small ,204 as asked in the question

    Wednesday, November 14, 2018 8:38 AM
  • defi math 5

             

    Quel est le plus petit nombre qui, divisé par 14 et 21, ne laisse pas de reste?

    num=x
    For x = 14 To 1000000
      remainder1 = Math.Remainder(num, 14)
      remainder2 = Math.Remainder(num, 21)

      If  remainder1  = 0  and remainder2 = 0 Then
        TextWindow.WriteLine(num)

        x=x+1

     EndIf 

    EndFor

    remainder =0 ne semble pas fonctionner car mon programme ne donne rien et j'ai testé pour x de 14 à 15,je devrais obtenir 14 mais je n'obtiens rien merci de me renseigner

    Wednesday, November 14, 2018 8:44 PM
  • défi math 6

                

    'Quel est le plus petit nombre qui laisse 3 comme reste quand divisé par 9, 12, 18 et 30?

    num=x
    For x =10000000 To 100000000
      remainder1 = Math.Remainder(num, 9)
      remainder2 = Math.Remainder(num, 12)
      remainder3 = Math.Remainder(num, 18)
      remainder4 = Math.Remainder(num, 30)

      If  remainder1 and remainder2 and remainder3 and remainder4 = 3 Then
        TextWindow.WriteLine(num)

        x=x+1


     EndIf 

    EndFor

    mon programme tourne très longtemps sans donner de résultat donc soit il n'y a pas de nombre répondant à la question soit mon programme n'est pas compatible avec la question, merci de me renseigner

    Wednesday, November 14, 2018 8:49 PM
  • defi math 4

    ce programme fonctionne

    Quel est le plus petit nombre qui laisse 3 comme reste quand divisé par 18 et 24?

    num=x
    For x =18 To 1000
      remainder1 = Math.Remainder(num, 18)
      remainder2 = Math.Remainder(num, 24) 

      If  remainder1 = 3 And remainder2 = 3 Then
         TextWindow.WriteLine(num)
       Else  
         num=x+1 
     EndIf 

    EndFor

    Wednesday, November 14, 2018 8:58 PM
  • defi math 2

    What is the smallest four digit number which when divided by 16 and 18 leaves remainder 8 in each case?

    num=x
    For x =1000 To 9999
      remainder1 = Math.Remainder(num, 16)
      remainder2 = Math.Remainder(num, 18) 

      If  remainder1 = 8 And remainder2 = 8 Then
         TextWindow.WriteLine(num)
       Else  
         num=x+1 
     EndIf 

    EndFor

    Wednesday, November 14, 2018 9:08 PM
  • math6. This program works: 
    For x =100 To 10000000
      remainder1 = Math.Remainder(x, 9)
      remainder2 = Math.Remainder(x, 12)
      remainder3 = Math.Remainder(x, 18)
      remainder4 = Math.Remainder(x, 30)
      If remainder1=3 and remainder2=3 and remainder3=3 and remainder4=3 Then
        TextWindow.WriteLine(x)
        x=100000000000
      EndIf  
    EndFor


    Jan [ WhTurner ] The Netherlands


    Thursday, November 15, 2018 10:16 AM
    Answerer
  • Math5

    Your variable num is empty at the start and is never changed.


    Jan [ WhTurner ] The Netherlands

    Thursday, November 15, 2018 10:21 AM
    Answerer
  • Math2

    After the first number (1016) is found, num is never changed and the program keeps printng 1016


    Jan [ WhTurner ] The Netherlands

    Thursday, November 15, 2018 10:26 AM
    Answerer

  • While num  <> 0
      remainder1 = Math.Remainder(num, 28)
      remainder2 = Math.Remainder(num, 24) 

      If  remainder1 = 8 And remainder2 = 12 Then
        TextWindow.WriteLine(num)
        num=0
       Else  
         num=num +1 
       EndIf 
       EndWhile
      
    Thursday, November 15, 2018 11:58 AM
  • il est demandé le plus petit nombre en l’occurrence 1016 et ma recherche ne va pas plus loin ,par contre ok pb d'impression
    Thursday, November 15, 2018 4:26 PM
  • I don't understand  " contre ok pb "

    Try this:

    For x =1000 To 9999
      remainder1 = Math.Remainder(x, 16)
      remainder2 = Math.Remainder(x, 18) 
      If  remainder1 = 8 And remainder2 = 8 Then
         TextWindow.WriteLine(x)
     EndIf 
    EndFor


    Jan [ WhTurner ] The Netherlands

    Thursday, November 15, 2018 6:03 PM
    Answerer
  • je voulais dire ok il y a un problème d'édition

    mais le programme fonctionne et donne bien le plus petit nombre

    Thursday, November 15, 2018 9:11 PM
  • thanks

    Math 5 =WBJ514 

    Saturday, November 17, 2018 6:02 PM
  • This is my solution for the graphics challenge "Draw a train": HKR115.

    Screen shot of a program Train Sample - 0 Series Shinkansen


    Nonki Takahashi


    updated: BXK911
    Saturday, November 17, 2018 8:51 PM
  • 12 3d chairs

    GraphicsWindow.BackgroundColor="teal"
    GraphicsWindow.Title = "Chairs"
    GraphicsWindow.BackgroundColor="darkblue"
    gw=1200
    gh=900
    
    GraphicsWindow.width=gw
    GraphicsWindow.Height=gh
    GraphicsWindow.Top=0
    GraphicsWindow.Left=0
    
    view3D = LD3DView.AddView(gw,gh,"True")
    LD3DView.AddSpotLight (view3D,"white",1 1 1, -1,-1,1 30, 10)
    LD3DView.AddDirectionalLight (view3D,"white" ,-1,-1,-1)
    LD3DView.AutoControl2 (1 1)
    
    For m=0 To 3
      For n=0 To 2
        cll=LDColours.HSLtoRGB(m*30+n*10 1 .6)
        
        For x=0 To 1
          For y=0 To 1
            ss=LD3DView.AddCone(view3D .5 .5 5+(1-y)*5 12 cll "D")
            LD3DView.TranslateGeometry(view3D ss x*6+m*12 0, y*6+n*14)
          EndFor
        EndFor
        
        For x=0 To 12
          For y=0 To 12
            ss=LD3DView.AddCube(view3D .5 cll "D")
            LD3DView.TranslateGeometry(view3D ss x*.5+m*12 4.75, y*.5+n*14)
          EndFor
        EndFor
        
        For x=0 To 12
          For y=0 To 2
            ss=LD3DView.AddCube(view3D .5 cll "D")
            LD3DView.TranslateGeometry(view3D ss x*.5+m*12 9.75-y/2, n*14)
          EndFor
        EndFor
        
      EndFor
    EndFor
    
    

    Saturday, November 17, 2018 9:12 PM
  • This is my final step for the Turtle challenge: PRV488.

    Screen shot of a program A* Search


    Nonki Takahashi

    Monday, November 19, 2018 2:38 PM
    Moderator
  • This is my solution for the animated graphics challenge Nodding Donkey: WBH906-0.

    Screen shot of a program Nodding Donkey


    Nonki Takahashi


    Monday, November 26, 2018 7:56 AM
    Moderator
  • sb online issue: SXF695

    -not rotating bcs sb-online doesnt work arc fn-s

    -also still doesn't rotate shapes

    Thursday, November 29, 2018 8:10 AM
  • Wednesday, December 5, 2018 4:28 PM
  • Challenge: Key Logger

    Open it: NWW387

    'Small Basic – November Code Challenges!!!
    'File Challenge
    'Write a program to log all key presses to a file, recording the time when they were pressed
    TextWindow.WriteLine("Write something... ;-)")
    TextWindow.WriteLine("End with *")
    line=1
    filename="C:\Users\thlan\Documents\SmallBasic\Keylogger\log.txt"
    file.DeleteFile(filename)
    While 1<>2
      input=TextWindow.ReadKey()
      TextWindow.WriteLine(input)
      file.WriteLine(filename, line, input+" "+Clock.Date+" "+Clock.Time)
      line=line+1
      If input="*" Then
        Program.End()
      EndIf
    EndWhile

    Wednesday, December 5, 2018 4:28 PM