Freigeben über


Small Basic Poet

Become a Small Basic poet! Paste in this program and try it out!

First, copy this image and name it "background.png", putting it in the same file folder as you Small Basic Poet file:

Next, see if you can alter our program and create your own Small Basic Poem Program! Change the words with your own!

Paste this code into Small Basic:

     

GraphicsWindow.Title             = "Small Basic Poet"

GraphicsWindow.CanResize  = "False"

GraphicsWindow.Width           = 480

GraphicsWindow.Height          = 360

GraphicsWindow.FontBold      = "False"

GraphicsWindow.FontItalic      = "True"

GraphicsWindow.FontSize      = 16

Path = Program.Directory

GraphicsWindow.DrawImage(path + "\Background.png", 0, 0)

Controls.AddButton("New", 10, 10)

CreateLists()

 

artCount  = Array.GetItemCount(article)

adjCount  = Array.GetItemCount(adjective)

nounCount = Array.GetItemCount(noun)

 

verbCount = Array.GetItemCount(verb)

prepCount = Array.GetItemCount(prepos)

Controls.ButtonClicked = OnButtonClicked

OnButtonClicked()

 

Sub CreateLists

  article  = "1=a;2=the;3=one;4=each;5=every;"

  adjective = "1=beautiful;2=blue;3=breeze;4=brief;5=broad;6=calm;7=careful;8=chilly;9=chubby;10=clean;11=clever;12=curved;13=damp;14=deep;15=delicious;16=delightful;17=early;18=faint;19=fast;20=freezing;21=fresh;22=full;23=gentle;24=gifted;25=glamorous;26=gray;27=great;28=green;29=handsome;30=high;31=hollow;32=hot;33=hot;34=icy;35=jolly;36=juicy;37=late;38=light;39=little;40=lively;41=loud;42=magnificent;43=melodic;44=mysterious;45=quiet;46=rainy;47=rapid;48=raspy;49=red;50=rich;51=scary;52=shallow;53=short;54=shy;55=sparkling;56=sparse;57=steep;58=straight;59=sweet;60=swift;61=tart;62=tender;63=thundering;64=tiny;65=voiceless;66=warm;67=wet;68=whispering;69=white;70=witty;71=yellow;72=young;"

  noun = "1=baby;2=bird;3=boat;4=breeze;5=brook;6=butterfly;7=cloud;8=coast;9=crow;10=dawn;11=day;12=deer;13=dew;14=doll;15=drop;16=dust;17=eye;18=face;19=fall;20=farm;21=fish;22=flame;23=flower;24=forest;25=fox;26=garden;27=gate;28=glitter;29=grape;30=grass;31=hair;32=hand;33=heart;34=hill;35=home;36=jewel;37=kiss;38=lake;39=lamp;40=land;41=leaf;42=light;43=love;44=meadow;45=mist;46=moon;47=morning;48=mouth;49=music;50=neck;51=night;52=noise;53=ocean;54=ornament;55=picture;56=pine;57=plant;58=pond;59=purpose;60=queen;61=quiet;62=quiver;63=rail;64=rain;65=raven;66=regret;67=reward;68=rhythm;69=ring;70=river;71=road;72=rock;73=sail;74=sand;75=scent;76=sea;77=shadow;78=skin;79=skirt;80=smell;81=snow;82=song;83=space;84=spring;85=star;86=street;87=sugar;88=summer;89=sun;90=sunset;91=swim;92=toy;93=tree;94=umbrella;95=vein;96=waterfall;97=whistle;98=wind;99=wine;100=winter;"

  verb     = "1=admires;2=amuses;3=appears;4=applauds;5=awakes;6=bathes;7=begins;8=beholds;9=belongs;10=bows;11=breathes;12=breeds;13=bursts;14=cares;15=carries;16=carves;17=casts;18=catches;19=creeps;20=cries;21=cures;22=dances;23=delights;24=dives;25=draws;26=dreams;27=drifts;28=drinks;29=dwells;30=earns;31=endures;32=enjoys;33=faces;34=fades;35=fails;36=fears;37=feels;38=flies;39=forgives;40=gazes;41=glows;42=heals;43=hides;44=holds;45=hopes;46=hugs;47=inspires;48=jumps;49=kisses;50=kneels;51=knocks;52=knows;53=laughs;54=leaps;55=loves;56=moves;57=packs;58=paints;59=passes;60=peels;61=prints;62=promises;63=races;64=rains;65=reaches;66=reads;67=rejoices;68=relaxes;69=rhymes;70=rises;71=runs;72=serves;73=shades;74=shakes;75=shares;76=shines;77=sleeps;78=smells;79=snows;80=sparks;81=stamps;82=stares;83=swims;84=swings;85=tastes;86=touches;87=visits;88=waits;89=walks;90=wanders;91=warms;92=whispers;"

  prepos   = "1=about;2=above;3=across;4=after;5=against;6=along;7=amidst;8=among;9=around;10=before;11=behind;12=below;13=beneath;14=beside;15=beyond;16=by;17=down;18=except;19=for;20=from;21=in;22=inside;23=into;24=near;25=next;26=off;27=on;28=outside;29=over;30=past;31=through;32=till;33=to;34=under;35=unlike;36=until;37=without;"

EndSub

 

Sub OnButtonClicked

  GraphicsWindow.DrawImage(path + "\Background.png", 0, 0)

  MakeLine1()  'Construct poemLine1

  MakeLine2()  'Construct poemLine2

  MakeLine3()  'Construct poemLine3

  GraphicsWindow.DrawText(180, 140, poemLine1)

  GraphicsWindow.DrawText(100, 165, poemLine2)

  GraphicsWindow.DrawText(180, 190, poemLine3) 

EndSub

 

Sub MakeLine1

  art1  = article  [Math.GetRandomNumber(artCount)]

  adj1  = adjective[Math.GetRandomNumber(adjCount)]

  noun1 = noun     [Math.GetRandomNumber(nounCount)]

  poemLine1 = art1 + " " + adj1 + " " + noun1

EndSub

 

Sub MakeLine2

  art1  = article[Math.GetRandomNumber(artCOUNT) ] 

  art2  = article[Math.GetRandomNumber(artCOUNT) ]     

  noun1 = noun   [Math.GetRandomNumber(nounCOUNT)] 

  noun2 = noun   [Math.GetRandomNumber(nounCOUNT)] 

  verb1 = verb   [Math.GetRandomNumber(verbCOUNT)]

  prep1 = prepos [Math.GetRandomNumber(prepCOUNT)] 

  adj1  = adjective[Math.GetRandomNumber(adjCOUNT)]

  poemLine2 = art1  + " " + noun1 + " " + verb1 

  poemLine2 = poemLine2 + " " + prep1 + " " + art2

  poemLine2 = poemLine2 + " " + adj1  + " " + noun2   

EndSub

 

Sub MakeLine3 

  adj1  = adjective[Math.GetRandomNumber(AdjCOUNT)]

  adj2  = adjective[Math.GetRandomNumber(AdjCOUNT)]

  noun1 = noun     [Math.GetRandomNumber(nounCOUNT)]

  poemLine3 = adj1 + " " + adj2 + " " + noun1

EndSub

  

==============

 

Did you play with it and change the words to create your own unique poem generator?

If so, comment below with your Import ID! And share it with your family and friends!

  

 

Do you have any questions? Ask us! We're full of answers and other fine things!

Head to the Small Basic forum to get the most answers to your questions: 

https://social.msdn.microsoft.com/Forums/en-US/smallbasic/threads/   

And go to https://blogs.msdn.com/SmallBasic to download Small Basic and learn all about it!

   

Small and Basically yours,

   - Ninja Ed & Majed Marji

Comments