ASCII Art
807598Mar 5 2006 — edited Mar 5 2006I'm having some problems writing code to print out some ASCII shapes, in particular a heart. I have part of the method to print the top part of the heart. ****** ****** (the heart peaks)
******* *******
********* *********
but I'm having problems completing the method to print this particular part out. I know I'm supposed to use loops but I don't know how to start.
Any help is appreciated!
private void printHeartPeaksBody( int i, int height, int width, int margin )
{
int sideGap = i - 1;
int peakGap = i;
int peakWidth = width - sideGap - sideGap - peakGap;
int eachPeakWidth = (int) ( peakWidth / 2.0 );
if( ( sideGap + eachPeakWidth + peakGap + eachPeakWidth + sideGap ) < width )
{
peakGap++;
}