15,900,725 members
Home / Discussions / Algorithms

# Algorithms

 Re: Simulating movement Code-o-mat24-Apr-10 22:02 Code-o-mat 24-Apr-10 22:02
 Re: Simulating movement Software_Developer29-Apr-10 6:26 Software_Developer 29-Apr-10 6:26
 Re: Simulating movement molesworth29-Apr-10 7:11 molesworth 29-Apr-10 7:11
 Re: Simulating movement Code-o-mat29-Apr-10 9:16 Code-o-mat 29-Apr-10 9:16
 Whats in a name? Tadeusz Westawic23-Apr-10 2:01 Tadeusz Westawic 23-Apr-10 2:01
 Console shapes? venomation18-Apr-10 2:58 venomation 18-Apr-10 2:58
 Re: Console shapes? Richard MacCutchan18-Apr-10 11:06 Richard MacCutchan 18-Apr-10 11:06
 Re: Console shapes? MikeMarq20-Apr-10 16:33 MikeMarq 20-Apr-10 16:33
 Basically the way to approach this is to draw a rectangle like you did before but put some conditions in to determine if you should print a star or a blank. First to get the width: Notice that except for the top line the triangle's width increases by 2 for each line it goes down. Therefore: Width = (Height * 2) - 1 To determine whether to draw a star you need to find if you are close enough to the center of the triangle. Center = Width / 2 On each line the triangle gets one wider in each direction so you need 2 variables to hold the range where stars should be drawn. So if you use Min and Max as your variable the should initally be set to Center and then subtract 1 from min each line you go down and add 1 to max each line you go down. You can then use these variable to test if your loop counter is between these 2 variables. Hope this helps, Mike
 "Best Fit" Algorithm Request && Teach A Man To Fish Michael Fritzius17-Apr-10 13:10 Michael Fritzius 17-Apr-10 13:10
 Re: "Best Fit" Algorithm Request && Teach A Man To Fish Luc Pattyn17-Apr-10 13:45 Luc Pattyn 17-Apr-10 13:45
 Re: "Best Fit" Algorithm Request && Teach A Man To Fish Radhakrishnan G.18-May-10 3:44 Radhakrishnan G. 18-May-10 3:44
 Re: "Best Fit" Algorithm Request && Teach A Man To Fish harold aptroot17-Apr-10 14:31 harold aptroot 17-Apr-10 14:31
 Re: "Best Fit" Algorithm Request && Teach A Man To Fish Som Shekhar17-Apr-10 20:46 Som Shekhar 17-Apr-10 20:46
 Re: "Best Fit" Algorithm Request && Teach A Man To Fish harold aptroot18-Apr-10 2:01 harold aptroot 18-Apr-10 2:01
 Re: "Best Fit" Algorithm Request && Teach A Man To Fish Som Shekhar18-Apr-10 2:18 Som Shekhar 18-Apr-10 2:18
 Re: "Best Fit" Algorithm Request && Teach A Man To Fish [modified] harold aptroot18-Apr-10 2:38 harold aptroot 18-Apr-10 2:38
 Re: "Best Fit" Algorithm Request && Teach A Man To Fish Som Shekhar18-Apr-10 2:56 Som Shekhar 18-Apr-10 2:56
 Re: "Best Fit" Algorithm Request && Teach A Man To Fish harold aptroot18-Apr-10 3:16 harold aptroot 18-Apr-10 3:16
 Re: "Best Fit" Algorithm Request && Teach A Man To Fish Som Shekhar18-Apr-10 3:40 Som Shekhar 18-Apr-10 3:40
 Re: "Best Fit" Algorithm Request && Teach A Man To Fish harold aptroot18-Apr-10 3:44 harold aptroot 18-Apr-10 3:44
 Re: "Best Fit" Algorithm Request && Teach A Man To Fish Som Shekhar18-Apr-10 3:53 Som Shekhar 18-Apr-10 3:53
 Re: "Best Fit" Algorithm Request && Teach A Man To Fish Michael Fritzius18-Apr-10 9:40 Michael Fritzius 18-Apr-10 9:40
 Re: "Best Fit" Algorithm Request && Teach A Man To Fish Luc Pattyn18-Apr-10 10:02 Luc Pattyn 18-Apr-10 10:02
 Re: "Best Fit" Algorithm Request && Teach A Man To Fish Luc Pattyn18-Apr-10 10:07 Luc Pattyn 18-Apr-10 10:07
 Re: "Best Fit" Algorithm Request && Teach A Man To Fish harold aptroot18-Apr-10 11:39 harold aptroot 18-Apr-10 11:39
 Last Visit: 31-Dec-99 18:00     Last Update: 18-May-24 3:27 Refresh ᐊ Prev1...122123124125126127128129130131 Next ᐅ

General    News    Suggestion    Question    Bug    Answer    Joke    Praise    Rant    Admin

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.