#Python assessment :C

1 messages · Page 1 of 1 (latest)

proud linden
#

the assessment?

vapid gate
#

so i was given with 3 python files, and my task was to create a object that has ability to move based on the random seed.

#

here the seed

#

#
#--------------------------------------------------------------------#



#-----Data Set Function for Assessing Your Solution------------------#
#
# The function in this section is called by the assignment template
# to generate the data sets used by your program.

# The following function creates a random data set defining the
# overall image to draw.  Your program must work for ANY data set that
# can be produced by this function.  The results returned by calling
# this function will be used as the argument to your data visualisation
# function during marking.  For convenience during code development
# and marking this function also prints the data set generated to the
# shell window.  NB: Your solution should not print anything else to
# the shell.  Make sure any debugging calls to the "print" function
# are disabled before you submit your solution.
#
def raw_data():

    # Define the possible ways the object can move and turn
    moves = ['Move forward', 'Move & turn left', 'Move & turn right']
    # Define the possible initial orientations
    directions = ['North', 'North east', 'South east',
                  'South', 'South west', 'North west']

    # Choose the number of moves
    num_moves = randint(0, 10)
    # Choose the object's initial energy level
    # (which mustn't exceed the number of moves)
    energy = randint(0, num_moves)
    # Choose the object's initial orientation
    direction = choice(directions)

    # Keep track of how many moves have been created in total
    move_no = 0

    # Initialise the data set with the special first move
    random_moves = [[move_no, energy, direction]]

    # Create the remaining moves
    while move_no < num_moves:
        # Increment move number
        move_no = move_no + 1
        # Choose which way the object moves and turns
        move = choice(moves)
        # Add the new move to the data set
        random_moves.append([move_no, move])

    # Print the whole data set to the shell window, laid out
    # nicely, one move per line
    print("The moves to visualise are:\n")
    print(str(random_moves).replace('],', '],\n'))
    
    # Return the data set to the caller
    return random_moves

#```
elfin topaz
#

Please tell us what you've done and tried to solve the problem yourself, is this file just given to you? Have you done any work?

vapid gate
#

what i have done is create my own object but can cannot make it moves based on the seed.

#

lemme send all 3 files

upbeat harborBOT
vapid gate
#

assignment_1_config.py is the canvas (map)

#

and i need to make my object move based on the random seed (assignment_1_data_source.py)

#

and yea, i stuck at that part.

#

this is the example how it should look like.

#

it will start in the middle and move on it own power based on the random seed.

upbeat harborBOT