# Ryan Martin
# macid: abcd123
# student number: #######
# August 8, 2011
#
# This is a solution for Major Assignment 3 (Lab 08).

def makeCenteredRow(w, c):
    '''Returns a string with c at the center of w and empty elsewhere.'''
    line = ' ' * ((w - 1)/2) + c
    return line

def makeRow(a, b, c):
    '''Returns a string with a spaces, c, b spaces, and c again.'''
    
    line = ' ' * a + c + ' ' * b + c
    return line

def makeCross(w, c):
    '''Returns a list of lines that form an X shape 
    of width and height w > 2 (odd) made of the character c.'''

    result = []

    for i in range((w - 1)/2 - 1, -1, -1):
        result.append(makeRow((w - 1)/2 - i - 1, 2*i + 1, c))
    
    result.append(makeCenteredRow(w, c))

    for i in range(0, (w - 1)/2):
        result.append(makeRow((w - 1)/2 - i - 1, 2*i + 1, c))

    return result

'''
Design Question

By using a conditional statement, we could
implement makeCross in a single loop.
By looping over 0 to w, we can use an if-elif-else
block during each iteration to check if we are
under, at, or over the halfway point, and
change our algorithm accordingly.
This may actually result in makeCross being longer
and more complex, since at present we are using
the same calculations everywhere. 
This problem could be a case where the more 
advanced solution is not necessarily the most
clear or efficient solution.
'''
##Note: This format is used by our automated marking system.
##You will see that, for inputs, the function name is
##given with the corresponding inputs to that function
##listed right after it.
##Format: [funName, [arg1, arg2, ...]]

'''
Test Plan

V07 = {'test1':
       {'inputs':['makeCenteredRow',[5,'@']],
       'outputs':['  @']},

       'test2':
       {'inputs':['makeRow',[2, 4,'$']],
       'outputs':['  $    $']},

       'test3':
       {'inputs':['makeCross',[11, '%']],
       'outputs':[['%         %', ' %       %', '  %     %', '   %   %', '    % %', '     %', '    % %', '   %   %', '  %     %', ' %       %', '%         %']]},

       'test4':
       {'inputs':['makeCenteredRow',[1,'&']],
       'outputs':['&']},

       'test5':
       {'inputs':['makeCross',[2, '#']],
       'outputs':['#']},

      }


'''
