msoe.edu > OP > Instructions

OP 2016 Computer Competition Instructions

by Eric A. Durant, PhD, MBA, PE
contributions by Darrin Rothe, PhD, PE; Henry L. Welch, PhD, PE; and Charles S. Tritt, PhD
Friday 18 November 2016

Contents


Setting Up Your Laptop

MSOE Laptops

  1. Click on user "op" on the welcome screen. No password is needed.
  2. Laptops have been configured to access wireless network "MSOE-Guest". Ensure you are connected to this network.

Note: Occasionally, the laptop may ask if you want to download and install various updates. You should always decline these prompts.

Team-Supplied Laptops

Connect to the Wi-Fi network "MSOE-Guest." No password is needed.

Monitoring Scores on the Web

The score website works in Firefox and Chrome; it might not work in Internet Explorer: live data during competition (no login required; just click View Scores)

Note: All file locations discussed in these instructions are recommendations, not requirements. You may set up the projects and files in any fashion you choose. The contents of the laptop are not visible to the judges. Only the source files that you submit via the scoring website will be used for evaluation.

Using Eclipse for Java Projects

  1. Double-click the Eclipse icon on the desktop.
  2. The "Workspace Launcher" should prompt you for a workspace. If it doesn't, select "File|Switch Workspace|Other..."
  3. Browse to "D:\EclipseWorkspace" if it is not already selected. Click OK.
  4. Select File | New | Java Project...
  5. For the "Project name," enter "probN" (e.g., "prob1", "prob7").
  6. Under "Project Layout" select "Use project folder as root for sources and class files."
  7. Select "Finish".
  8. If you don't see the Package Explorer (usually the left pane), select the arrow in the upper right corner of the Eclipse Welcome Screen to move to the Workbench.
  9. Click on your new project and ensure it is selected in the Package Explorer.
  10. Select File | New | Class.
  11. Enter "ProbN" for the name.
  12. Select the check-box that indicates a public static void main stub is to be generated.
  13. Click "Finish".
  14. Enter your Java program, which will start in the main method.
  15. When you are ready to test your program, select Run | Run As | Java Application (Alt-Shift-X followed by J) or press Ctrl-F11.
  16. Select "OK" to save your work.
  17. Your program runs and the output is shown in the Console tab.
  18. If necessary, edit your program and try again.
  19. When you are satisfied, right-click the top-level probN icon in the Package Explorer and select Close Project.
  20. Follow the instructions at Submitting Programs for Judging to submit your solution. Note, if you followed the instructions above, the Java source file for you to submit will be located at D:\EclipseWorkspace\[project name]\[class name].java.
  21. Begin working on another problem (step 3).
  22. For help with the java language consult Sun's Javadoc.

Notes

Using BlueJ for Java Projects

BlueJ is provided for teams that prefer it.

  1. Double-click the BlueJ icon on the desktop.
  2. Project | New Project...
  3. Enter "D:\BlueJProjects\[probN]" in the Folder name field (e.g., "prob3").
  4. Click "Create"
  5. Click New Class...
  6. Enter "ProbN" for the name.
  7. Click "OK".
  8. Double-click the "probN" block icon. This will open an edit window for your program.
  9. Enter your Java program. Make sure there is a public static void main(String[] args) method, since that is where the judge will start your program.
  10. When you are ready to test your program, click "Compile"
  11. Continue to click "Compile" in the Class window fixing errors until you compile without errors. Close the class editor when finished.
  12. To run program, right-click on the block icon in the project screen. Select void main(String[] args) from the menu. Click "Ok" to specify no arguments. A console window will appear with your program's output and will accept your keyboard input.
  13. When you are satisfied, select Project | Close
  14. Follow the instructions at Submitting Programs for Judging to submit your solution. Note, if you followed these instructions, your source file will be located at D:\BlueJProjects\[project name]\[class name].java. This is the file to submit for judging.
  15. Begin working on another problem (step 2).
  16. For help with the java language consult Sun's Javadoc.

Using Java from the Command Line

The Java command line compiler and JVM are available for those who prefer that environment.

  1. Double-click the Notepad++ icon on the desktop. Notepad++ is a good text editor for Java code.
  2. Notepad++ will start with a new blank file. Select File | Save As and navigate to D:\JavaCode and save the file with a name such as ProbN.java where N is the problem you are working on.
  3. Enter your Java program. Make sure there is a main method, since that is where the judge will start your program.
  4. When you are ready to test your program, save the file. You may close Notepad++ or leave it open.
  5. Double-click the "cmd" (Command Prompt) icon on the desktop.
  6. Change directory to D:\JavaCode.
  7. Compile the program by running the compiler - javac ProbN.java.
  8. If errors are found, fix errors by editing source file. If no errors are found, run the program by invoking the JVM - java ProbN (no extension!) at the command prompt.
  9. Follow the instructions at Submitting Programs for Judging to submit your solution. Note, if you followed these instructions, your source file will be located at D:\JavaCode\[class name].java. This is the file to submit for judging.
  10. Begin working on another problem (step 1).
  11. For help with the java language consult Sun's Javadoc.

Using Microsoft Visual Studio (MSVS) C++ Projects

  1. Double-click on Microsoft Visual Studio icon on the desktop.
  2. If prompted to sign in, select "Not now, maybe later."
  3. Select File | New Project...
  4. Select Visual C++ | Win32 | Win32 Console Application as the project type.
  5. The project location should be defaulted to D:\VisualStudioProjects If necessary, select this directory.
  6. In "Name", enter the project name, which should be "probN" (e.g., "prob1", "prob7").
  7. Ensure "Create directory for solution" is checked.
  8. Click "OK"
  9. On the "Win32 Application Wizard" that appears, select "Next".
  10. For "Application type" ensure "Console application" is selected.
  11. Select the "Empty project" check-box.
  12. Select "Finish".
  13. Right-click on "Source Files" in the "Solution Explorer" pane (usually on the right).
  14. Select Add | New Item...
  15. In the Visual C++ category, select the "Code" sub-category and then the "C++ File (.cpp)" template.
  16. Enter the name "probN.cpp" (e.g., "prob7.cpp") for your file.
  17. Click "Add".
  18. Enter your program in the window that appears
  19. Press Ctrl+Shift+B (Build | Build Solution) to build your project.
  20. Press Ctrl+F5 (Debug | Start Without Debugging) to run your program normally. (You are welcome to try the debugger.)
  21. When you are ready for your program to be judged, select "File | Close Solution".
  22. Follow the instructions at Submitting Programs for Judging to submit your solution. If you followed these instructions, the file you should submit will be located at D:\VisualStudioProjects\[project name]\[project name]\[class name].cpp.
  23. Go to step 3 to get started on the next problem.

To switch to another, existing project, select "File | Recent Projects". If the project you are looking for isn't there, use "File | Open | Project" and locate the desired project on your D:\ drive.

Minimal example program

#include <cstdio>

void main() {
	printf("%s\n","Hello, World!");
}

Finding Data Files

Some of the programming problems in this competition may require data files. These files should be present in the folder specified below in order to be found when the program runs. All required files will be available from this link. When you click a particular file on this page, if your browser displays the file rather than opening the download dialog, then go Back to the data page, right-click the file name and select the Save link [or target] as...option. Complete the Save as dialog box to save the file in the project folder and click Save to save the file. Data files must be used exactly as they are provided and/or described in the problem statement. You may not add or remove lines or reformat the contents of these files in any way. These files will be used in this same format for evaluating your program. DO NOT cut and paste the files from the browser window; use the Save link feature to ensure that you get the entire file in its proper form.

Where to store your data files

Note: All file locations discussed in these instructions are recommendations, not requirements. You may set up the projects and files in any fashion you choose. The contents of the laptop are not visible to the judges. Only the source files that you submit via the scoring website will be used for evaluation.

Take care with file extensions

When saving a data file, Windows sometimes adds an extra extension. For example, input.txt actually gets saved as input.txt.txt, making it hard for your program to find the file it needs. To allow these extensions to be seen when you're browsing your files, do the following.

Submitting Programs for Judging

Using the competition management website

  1. Log in to http://sapphire.msoe.edu:8080/OpComp/ using your team's Scorer Username (OPXX) and password.
  2. Make sure you're viewing the "Dashboard" tab.
  3. Click on the problem you wish to submit.
  4. Click Choose File and select the source code file (e.g., prob1.java) to submit from your D:\ drive.
  5. If you have multiple files to submit (e.g., .h and .cpp files for C++ projects), click Choose File by file 2 (3, 4, etc.) and select additional files.
  6. Click Submit Solution.
  7. Notes...

Namespace and Library Issues (MSVS/C++ only)

Teams may use any combination of standard C libraries, standard C++ and STL libraries in their programs.

For convenience, the following line placed near the start of your code will allow STL and ANSI C++ items to be used by their unqualified names (e.g., string and cout). If you are familiar with more narrowly targeted alternatives (e.g., using specific classes and objects or qualifying names as they are used to reduce ambiguity), it is recommended that you use those methods.

using namespace std;

The following table lists some commonly used functions of the most popular standard libraries.

New C++ Name Use and functions
iostream Defines insertion (<<) and extraction (>>) operators and defines the console stream objects like cin and cout.
iomanip Provides a variety of steam formatting and manipulation tools.
fstream Required for file I/O operations.
cmath Provides a wide range of mathematical functions. These include the trigonometric functions (with angles expressed in radians), exp(double x), log(double x), log10(double x), pow(double base, double power), sqrt(double x), fabs(double x) and fmod(double numerator, double denominator).
cstdlib Miscellaneous stuff. Including the void srand(int seed) and int rand() pseudorandom random number functions and the int system(const char command[]) system command function.
cassert Provides the assert debugging mechanism.
string Provides the ANSI string class. Note that <string> is different than the old <string.h> library (now <cstring>).
vector Provides the Standard Template Library (STL) implementation of a 1-dimensional, random access sequence of items. Generally replaces the use of 1-dimensional C/C++ arrays.
ctime Types and functions associated with calendar and time operations. Includes both processor and actual time and date functions.
complex Provides a template class for storing and manipulating complex numbers.

Using STL Classes (MSVS/C++ only)

The STL classes (Standard Template Library) are used by professional programmers. You may use the STL in your programs. To use the STL, #include the appropriate header file at the beginning of your program. The STL functions are in the std namespace. Two methods of accessing items in the std namespace are preceding each name with std:: or putting using namespace std; near the start of your file. Some STL includes are listed below.

Header Contents
algorithm Generic algorithms such as copy, for_each, sort, find, and generate.

vector

An ordered container of elements with random and sequential access and associated functions.

string

An ordered container of characters with random access and associated functions.

list

An ordered container having bidirectional access with the ability to efficiently add and delete items anywhere in the list

stack

An ordered container having only the ability to add and remove items from one "end" of the container using the push and pop operations and having Last In First Out (LIFO) behavior.

queue

An ordered container having only the ability to add and remove items from one "end" of the container using the push and pop operations and having First In First Out (FIFO) behavior.


This page was last updated on $Date: 2016/11/04 03:40:08 $.