OP 2024 Computer Competition Instructions
by Dr. Robert Hasker
contributions by Drs. D. Rothe, E. Durant, H. Welch, and C. Tritt
Friday 22 November 2024
Contents
MSOE Laptops
- Click on the "Sign in" button on the welcome screen. No password is needed.
- 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. Teams in the ITC will connect to DirectSupplyGuest
with password bettywhite
.
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.
- Double-click the IntelliJ icon on the desktop.
- In the Welcome panel, click on New Project in the upper right.
- Ensure Java is selected, change the Name to
practice, and click Create. When working on problems, you
will use names like Problem1, Problem2, etc. For
the project location, browse to a convenient folder such as your
Documents folder.
- You will see an initial program. You can run this if you like, but you
will want to change its name as discussed in the next step. If IntelliJ
asks about excluding folders from Microsoft Defender, you can answer yes,
but either answer works fine.
- Important: the class and file will be
named
Main.java
. You must change this so judges
know what problem is being solved. Right click on the class
name (right after public class
), select Refactor and
then Rename..., and rename the Main
class to Practice
. For solutions to problems, use the
names Problem1, Problem2, etc. Doing this will also change
the filename, which is good since the judge will use that to know which
problem is being solved.
- Click on any of the green arrows to run your program. You will see a
console output window with your text on it. If prompted, select Run 'Main'.
- Modify and re-run the program until it is adequately tested and works
on all cases.
- Select Save All from the File menu.
- Follow the instructions at Submitting
Programs for Judging to submit your solution.
IntelliJ Notes
- Red squiggles mark source code errors. You can hover your mouse over
the text to get an error message or click on the Problems tab at the
bottom of the screen to see a full list of issues.
- You can use the same project for all of your solutions, just naming
them
Problem1
, Problem2
, and so on. Each will
have its own main
, and you can use the drop-down next to the
green arrow in the upper right to control which solution is being run.
- When a problem will be opening a data file, be sure the data file is in
the "top level" project directory; this is a directory that will contain
src
as a subdirectory
BlueJ is provided for teams that prefer it.
- Double-click the BlueJ icon on the desktop.
- Project | New Project...
- Enter "C:\BlueJProjects\" in the Location name field.
- Enter probN (e.g., "prob3") in the Name field.
- Click "OK"
- Click New Class...
- Enter "ProbN" for the name.
- Click "OK".
- Double-click the "probN" block icon. This will open an edit window for your program.
- Add the declaration for
main()
:
public static void main(String[] args) {
}
It is important to add this since it is required for judges running your program.
- Write your program. For practice, greet the user:
System.out.println("Hello from MSOE!");
- Click "Compile". If there are errors, fix them and recompile.
- 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.
- When you are satisfied, select Project | Close
- 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 C:\BlueJProjects\[project name]\[class name].java. This is the file to submit for judging.
The Java command line compiler and JVM are available for those who prefer that environment.
- Double-click the Notepad++ icon on the desktop. This is a good,
light-weight text editor for Java code. It will start with a new blank file. Select File | Save As and navigate to C:\JavaCode and save the file with a name such as ProbN.java where N is the problem you are working on.
- Enter your Java program. Make sure there is a
main
method,
since that is where the judge will start your
program. See Hello.java
for an example.
- When you are ready to test your program, save the file. You may close Notepad++ or leave it open.
- Use the Windows Start button to open a Command Prompt.
- Change directory to C:\JavaCode:
cd C:\JavaCode
- Compile the program by running the compiler:
javac ProbN.java
If errors are found, fix them by editing the source file.
- Run the program:
java ProbN
- Follow the instructions at Submitting Programs for Judging to submit your solution. Your source file will be located at C:\JavaCode\[class name].java. This is the file to submit for judging.
- Click on the Visual Studio Code icon on the taskbar.
- Select File | New File... and enter a file name such as "prob1.cpp". VSCode will prompt you
for a location, select
C:\cpp
. Other problems will be
"prob2.cpp", etc.
- Create a main and write your
code. See
hello.cpp
for an example.
- Find the open triangle ▷ in the upper right corner and
downarrow just to its right. Select Run C/C++ File.
There will be a prompt at the top of the screen saying
"Select a debug configuration". Pick the option "C/C++: g++.exe build and
debug active file". If there are any errors, click on the PROBLEMS
tab to review them. Recompile after fixing them.
- The program will run in the TERMINAL tab. Correct any errors and
run until it is working.
- When you are ready for your program to be judged, 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
C:\cpp\[name].cpp
.
- Click on the Spyder icon on the desk top.
- Click on File|Save As..., browse to C:\PythonCode, and save the file
with the name of the problem such as "prob1.py" or "prob2.py".
- Enter the program.
- Click on the green arrow at the top to run your program. The output
will show up in the Console window in the lower right.
- Follow the instructions at Submitting Programs for Judging to submit your solution.
- Use Notepad++ or another text editor to edit your Python source
code. Save it in C:\PythonCode\. It is recommended that you use filenames
like prob5.py.
- Run "Anaconda Prompt" from the desktop.
- Change to the python code directory:
cd \PythonCode
- Run your code; for example,
python prob5.py
- If your leading whitespace is a mixture of tabs and spaces, you may
violate Python formatting rules. In Notepad++, select Edit|Blank
Operations|Tab to Space (or "Space to Tab (Leading)") to clean up the formatting.
- Follow the instructions at Submitting Programs for Judging to submit your solution.
Some of the programming problems in this competition
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
contest. The same format will be used when scoring.
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
- Java with IntelliJ: in the top directory of your project, the directory
that contains your
src
directory.
- Java with BlueJ: in the project subdirectory, C:\BlueJProjects\prob7\data.txt
- C++: in the source subdirectory, C:\cpp\data.txt
- Java from the Command Line: in the source subdirectory, C:\JavaCode\data.txt
- Python using Spyder or Anaconda: in the source subdirectory,
C:\PythonCode\data.txt
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.
If your computer isn't configured to show these extensions, do the
following if you have a Windows11 laptop:
- Open File Explorer
- Select View | Show > | File name extensions
For Windows 10 laptops:
- Search for "Folder Options" on the start menu and select the resulting shortcut.
- Select the "View" tab.
- Clear the box for the option Hide extensions for known file
types. This will be about half-way down the list.
- Click Ok.
Using the competition management website
NOTE: You will not be able to submit solutions until the contest
starts. But read through these directions so that you can submit
when the time comes.
- Visit
msoeopcomp.org
.
- Click on New User.
- Enter the Username you received when you registered. Note this is different
than your school name. Pick a reasonably good password: two randomly
chosen words work well. Click Set Password Make sure you write
the password somewhere safe! It can be reset, but it will take time.
- You can click on the Standings tab to view standings across all
teams. However, the standings should be displayed from a public computer
where you can see them. A good hint is to look at solving problems many
other teams have already solved!
- To submit, click on the Home tab and click on the small error at
the right end of the box for the problem you wish to submit.
Practice: there is a practice tool built into the submittal
system. Click on the Hello World problem and submit a trivial source
file. The language is not important - judges will not see these
solutions. Click on the Submit button; the system will respond with an
"incorrect solution" message. This is to show you the appearance of an
incorrect solution message. Resubmit, and this time the system will
automatically mark your solution as correct. NOTE: this is
the only place where the system responds automatically. The real
solutions are judged by hand and any response is entered manually.
- During the contest, when you have a solution to a problem you will
repeat the above for that problem, clicking on choose File to select the
source code file (e.g., prob1.java) to submit from your C:\ drive.
- Click on the green Submit button.
- Once it is scored, you will see a small red circle if it failed or a
green checkbox if it passed. You can click on the arrow to view the
feedback.
- You may see a small white box at the top of the screen next to the
Announcements tab. This indicates a new announcement; browse to the
Announcements tab to view it.
You can resubmit solutions, but note that you lose points for each
incorrect solution you submit. Let a student worker know if you have
additional questions about why a submission was incorrect.