Assignment 1 FAQ

This page was last updated: Thursday, 14-Mar-2024 12:15:26 AEDT

  1. Can you give us any hint on how to get started?

    You could start by scanning the map into a 2-dimensional array. Then, make a list of all places where a brigde might occur – in other words, places where two islands appear on the same row or same column, with no other island between them. It may be helpful to think of multiple bridges between the same pair of islands as a single bridge with multiple "planks". The puzzle then becomes a Constraint Satisfaction Problem where the Variables are the bridges, and the Value of each variable is the number of planks in that bridge, which could be 0, 1, 2 or 3.

  2. Can you provide any starter code?

    The file scan_print_map.py in the tools directory provides code for scanning the map into a 2D numpy array.

    The file cryptarith.py in the code directory cantains code for solving cryptarithmetic puzzles with a basic backtracking search. This might help you to get started with a basic search (which you could then improve on).

  3. What will be the maximum size of the input, and maximum runtime?

    Your program will be tested on a variety of inputs ranging from small to large. There will be no more than 40 rows, 40 columns, 500 islands and 800 bridges. The maximum runtime will be two minutes (120 seconds) for each input.

  4. Can you be more specific about the input and output?

    Your program should read the input (map) from stdin, and print the solution to stout.
    bridgen generates a map and prints it to stdout.
    bridgecheck takes the name of the file with the map as a command-line argument, reads the (putative) solution from stdin, and prints its output to stdout.
    On a Unix system, you could test your code like this:

      ./bridgen 10 20 > s1.in
      ./hashi < s1.in > s1.out
      ./bridgecheck s1.in < s1.out
    
    Note: You do not need to include bridgen or bridgecheck in your submission. They are just provided as tools, to help you test your code.

  5. Does our program need to handle erroneous input, or puzzles without any solution?

    No, you can assume the input will be in the correct format, and that at least one solution exists.


Back to Project 1 | Back to the main page