By: CS2103T-F14-1 Since: Aug 2019 Licence: MIT

1. Introduction

Duke Academy is a coding practice platform that operates entirely on your local machine without the need for an internet connection. Whether you are revising for a test, practicing for a tech interview, or just coding for the sheer joy of it, DukeAcademy gives you access to a wide range of programming problems from various categories. Easily find something that suits your needs and interests and start honing your skills today!

Duke Academy features a built-in list of problem sets and its very own text editor. Simply choose a problem statement that catches your eye, load it up in the problem display panel and start coding away! Duke Academy also features your very own profile page for you to immediately view all of your accomplishments at a glance. Your profile page also helps you keep track of the problems that you have attempted and those you have bookmarked, so that you can get back to them easily at a later time.

For educators, you can use Duke Academy as a platform to administer your assignments or practice questions. If you have questions of your own you would like to test your students, you can use the built-in question loader in DukeAcademy to set your own questions and then distribute the updated questionBank.json file to your students through your favourite communication channels.

Duke Academy is optimized for those who prefer to work with a CLI (Command Line Interface) while still enjoying the benefits of a GUI (Graphical User Interface). If you are unfamiliar with using a CLI (which is an important skill for all programmers), you can get used to it while working on your coding skills here in DukeAcademy!

2. Quick Start

  1. Ensure you have Java 11 or above installed in your Computer.

    • Refer to the following links for the complete walk-through (macOS / windows)

  2. Download the latest DukeAcademy.jar here.

  3. Double-click the .jar file to start the app. The GUI should appear in a few seconds. If the app cannot be launched by double-clicking:

    For Windows:

    • Launch Notepad (or any text editor), then copy and paste the following line into the text editor.

      java -jar [name_of_file].jar
    • Replace "[name_of_file]" with whatever name you have saved the .jar file as.

    • Save the text file as a .bat file in the same location as the .jar file.

    • Then double-click on the newly created .bat file to run the app.

  4. When launching the app for the first time, it will create a folder named DukeAcademy in the directory where your jar is located.

    • This folder will contain all of your app’s data. To fix any errors related to corrupted data, delete this folder and the app will be reinstalled.

    image::quickstart1.png[width="800" align="center"]

  5. Once the app is launched, you will immediately be greeted with the main User Interface of the app.

    homepage annotated

    The User Interfaces that are important for now:

    1. Command Box

      This will be the field where you input all your commands. After you press the Enter button, your command will be executed.

      e.g. typing showall, followed by pressing Enter will display all the questions in the app.

      To find out about the commands available in Duke Academy, please visit Section 5, “Features”.

    2. Result Box

      Once you have executed a command, a feedback will be displayed in this field.

      e.g. after executing showall command, "List all questions…​" will be displayed.

    3. Tab Panes

      Consists of 5 different tabs: Home, Questions, Workspace, Notes and Help

  6. After executing showall in the CommandBox, find a question that interests you and type attempt [Qn Index] into the CommandBox to start your DukeAcademy experience.

    Note: the index of a question is the number displayed next to its title.

    questionindex

3. Overview

The application is divided into 5 separate tabs, each one of them serving a specific purpose. You can toggle between the different tabs by entering tab into the CommandBox.

3.1. Dashboard Tab

The Dashboard allows you to keep track of your learning journey and progress made in Duke Academy.

dashboard

On the Dashboard you can:

  1. See the percentage of questions you completed and your current skill tier.

    Novice 0 - 29 %  
    Apprentice 30 - 49 %  
    Master 50 - 69 %  
    Grandmaster 70 - 89 %  
    Duke 90 - 100 %

  2. Keep track of the questions that you are currently attempting.

  3. Keep track of the questions that you bookmarked.

3.2. Questions Tab

The Questions tab contains a list of all the available questions and also a window to view your problem statements.

You can use commands such as browse and find to filter through the list of questions in order to find what you are looking for. browse can lookup any keywords in titles, difficulty, description, topics, etc. find only finds by titles. (View Section 5, “Features” for more details.)

questionspage
  • To quickly see all questions, enter showall into the CommandBox.

  • To view the problem statement for a question, enter view <Qn Index>. The problem statement will then be displayed on the right.

3.3. Workspace Tab

The workspace is where you will work on the various questions.

workspace
  1. Problem Statement Display

    Displays the question that you are currently attempting.

  2. Program Evaluation Panel

    This panel displays the correctness of your program when evaluated against the pre-defined list of test cases tied to the question you are solving.

  3. Editor

    A built-in editor for you to write your code.

  • To submit your attempt, enter submit into the CommandBox.

  • To begin your attempt on a question, enter attempt <Qn Index> into the CommandBox.

  • To submit your attempt, enter submit into the CommandBox.

3.4. Notes Tab

The notes page is where you can record notes or even sketch out some of your ideas to aid your learning process.

notespage
  1. NotesListDisplay

    Displays all of the notes that you have previously created.

  2. CurrentNoteTitle

    Shows the title of the note that you are currently viewing/editing.

  3. NoteTextInput

    Input space for any text-based notes that you wish to record.

  4. Sketchpad

    A canvas for you to draw any ideas you may have pertaining to data structures!

  • To create a new note, enter newnote <Title> into the CommandBox

  • To open an exiting note, enter `opennote <Id> into the CommandBox.

  • The id of the note is the number that appears next to the title in the NotesListDisplay.

  • To save any changes to your notes, enter savenote into the CommandBox.

3.5. Help Tab

The help tab is where you can get a quick overview of commands used in Duke Academy, and the URL to the official User Guide.

help

4. Before you start

  1. The evaluator searches for a class with the class name Main as the entry point into your program. Please ensure that you declare your main method in a class called Main.

  2. The program evaluator uses stdin to feed your program inputs and stdout to receive your program’s outputs. Thus, it is important that your program uses the Scanner class to read inputs and for you to print your results.

  3. Take note that your program is being evaluated on your local machine and not within a container or a virtual machine. Thus, do not write any code that you would not want to run on your local machine.

  4. Most importantly, remember to have fun!

5. Features

Command Format

  • Commands are entered into the CommandBox

  • Words within square braces [] are the parameters to be supplied by you, the user.

    e.g. in attempt[id], id is a parameter which can be used as attempt 1.

  • Parameters are compulsory.

  • Parameters with ​ after them can accept multiple entries.

    e.g. browse [category]…​ can be used as browse easy linkedlist hashtable recursion (i.e. 4 entries), etc.

5.1. Access Help Tab: help

Navigates to the Help Tab.
The Help tab contains a quick overview of commands used in Duke Academy, and also the URL to the official User Guide.

Format: help

help

5.2. Access Dashboard: dashboard

Navigates to the Dashboard Tab.
The Dashboard allows the user to keep track of his learning journey and progress made in Duke Academy.

Format: dashboard

dashboard

5.3. List all questions: showall

Navigates to the Questions Tab and displays all available questions.

Format: showall

listallquestions

5.4. Adding bookmark: bookmark

Bookmarks a specific question.

Format: bookmark [id]

  • The id of a question can be found next to its title.

  • The bookmarked question will appear in the list of bookmarked questions located within your Personal Dashboard.

bookmark

5.5. Removing bookmark: deletebookmark

Removes the bookmark from a specific question.

Format: deletebookmark [id]

  • The id of a question can be found next to its title.

  • The question with the bookmark removed will disappear from the list of bookmarked questions located within your Personal Dashboard.

5.6. Find question by title : find

Searches for question of which the title contains strictly the keywords entered.

Format: find [keyword]…​

  • NOTE: This function does not work for character sequences!

    e.g. Searching for su will NOT yield questions with titles such as Sudoku or The Supreme Seven

  • The search is case insensitive.

    e.g recursion will match Recursion.

  • The order of the keywords does not matter.

    e.g. Fun tree will match tree Fun.

  • Questions with title matching at least one keyword will be displayed

    e.g. searching for sudoku adder will yield questions with titles such as Valid Sudoku and Two Number Adder.

Examples:

  • find binary search tree
    Finds and displays all questions containing the substrings "binary", "search" and "tree" in their title.

  • find fizz buzz
    Finds and displays all the questions containing the substrings "fizz" and "buzz" in its title, but not questions with titles such as "fizzbuzz".

5.7. Browse by keywords: browse

Searches through all questions with the specified keyword(s). A question is listed as a search result as long as it contains one of the keyword(s) in their title, topics, description, status or difficulty.

Format: browse [keywords]…​

  • NOTE: This function does NOT work for character sequences!

    e.g. Searching for su will not yield questions with titles that do not strictly contain the word "su", such as "super".

  • The category is case insensitive.

    e.g easy will match Easy.

  • Typing browse topic would not list all topics. You can only browse by specific topics. The complete list of topics include: ARRAY, LINKED_LIST, HASHTABLE, TREE, GRAPH, RECURSION, DIVIDE_AND_CONQUER, DYNAMIC_PROGRAMMING, SORTING, OTHERS.

Examples:

  • browse hashtable linkedlist
    Finds and displays all questions that contain "hashtable" and "linkedlist".

  • browse number
    Finds and displays questions that contain strictly the keyword "number".

    Questions that do not and instead contain words with "number" as a substring of a word in their title, topics, description, status or difficulty will not be displayed.

5.8. Viewing the problem statement : view

Displays the problem statement of the question.

Format: view [id]

  • Displays the problem statement with the corresponding id.

  • The id of the question can be seen next to its title.

view

Examples:

  • view 1
    Displays the question with the id "1" in the right side window of the GUI, as shown in the above picture.

5.9. Attempting a question : attempt

Navigates to the Questions tab where you can code your solution to solve the problem statement.

Format: attempt [id]

  • Displays the question with the corresponding id on the upper-left of the GUI.

  • The Editor will appear on the right side for you to code your solution.

attempt

5.10. Submitting your answer: submit

Submits your solution.​ Your code will be compiled and run against test cases. The results will be displayed in the ProgramEvaluationDisplay on the bottom left of the GUI.

Format: submit

  • Make sure to check that your code compiles or you will receive an error message.

  • Remember to import the relevant packages that you have used in your code!

submit

5.11. Creating a new note: newnote

Navigates to the Notes tab and creates a new note with the given title.

Format: newnote [title]

  • The new note will be loaded immediately into the notes tab

  • You can start writing/drawing your ideas in the note text input or the sketchpad.

  • Save any changes you wish to make using the savenote command.

Examples:

newnotecommand
  • newnote Linked Lists
    Creates a new note titled "Linked Lists" and loads it into the Notes page for you to edit/view.

5.12. Saving changes to a note: savenote

Navigates to the Notes tab and saves any changes made to the note that you were previously viewing/editing.

Format: savenote

  • The saved changes will be reflected the next time you open the note again.

5.13. Opening an existing note: opennote

Navigates to the Notes tab and opens the note corresponding to the id for viewing/editing.

Format: opennote [id]

  • Be careful as there is no way to retrieve your notes once they are deleted!

opennotecommand
  • opennote 1
    Navigates to the Notes page after opening the note with the id 1.

5.14. Deleting an existing note: deletenote

Navigates to the Notes tab and deleting the note corresponding to the id.

Format: deletenote [id]

  • Displays the text content of the note into the note text input

  • Displays the sketch of the note into the sketchpad

  • deletenote 1
    Navigates to the Notes page after deleting the note with the id 1.

5.15. Loading new questions: loadquestions

Imports new questions into the application through a text file.

Format: loadquestions [filename]

  • Your text file should be located in the ../DukeAcademy/newQuestions/ directory. The DukeAcademy folder is located in the same directory as where you put the jar file.

  • Your text file should follow the format specified at Section 9, “Format for Custom Questions”.

Examples:

  • loadquestions my_problem_set.txt
    Loads the questions from the file "my_problem_set.txt" located in the ../DukeAcademy/newQuestions/ directory.

We have prepared a dummy problem set for you to try out as shown in diagram below.

default problem set

Type loadquestions NewProblems.txt (case sensitive), and two new questions titled Apple and Banana will be loaded onto Duke Academy.

5.16. Exit the application: exit

Exits the application

Format: exit

6. FAQ

Q: How do I transfer my own problem sets to another computer?

A: Copy the problem set text file into DukeAcademy’s home folder on the other computer and repeat the ​ loadquestions​ command.

Q: How do I transfer data to another computer?

A: Install the app in the other computer and overwrite the empty data file it creates with the file that contains the data of your previous DukeAcademy folder.

Q: What is the format of problem setting?

A: It should contain the following: problem statement, input and output files, difficulty level, solution, as well as algorithm category. Check out Section 9, “Format for Custom Questions” for detailed reference.

Q: What if I want to delete questions?

A: Currently there is no delete question feature implemented. To restore to default setting, delete the DukeAcademy folder located at the same directory as the DukeAcademy.jar, and restart the app.

7. Command Summary

  • Home: home

  • List all questions: showall

  • Adding bookmark: bookmark [id]

  • Removing bookmark: deletebookmark [id]

  • Find by question title: find​ [keyword]…​

  • Browse by category: ​browse​ [keyword]…​

  • View: view​ [id]

  • Attempt a question: attempt​ [id]

  • Submit:​ submit

  • Load questions: ​loadquestions​ [filename]

  • Create a new note: newnote [title]

  • Save current note: savenote

  • Open a note: opennote [id]

  • Delete a note: deletenote [id]

  • Switch tab sequentially: tab

  • Exit: exit

8. Question storage file format

  • The text file is a json list of json objects representing each question.

  • Each question is a json object with the following key-value pairs.

    • title: a string representing the title of the question

    • description: a string representing the description and preamble of the question

    • tc: a list of json objects representing the list of test cases (see below for details)

  • Each test case is another json object with the following key-value pairs.

    • input: the input for the test case

    • result: the expected result for the test case

9. Format for Custom Questions

custom questions
  • Create a .txt file.

  • The format of a question goes like follows:

Question::

Title::

Description::

Difficulty::

Topics::

TestCase::

Input::

Output::
  • All inputs must be in the order stated above.

  • Title, Description can be any non-empty string.

  • Difficulty can only be EASY, MEDIUM or HARD. (Must be capitalized)

  • Topics can only be ARRAY, LINKED_LIST, HASHTABLE, TREE, GRAPH, RECURSION, DIVIDE_AND_CONQUER, DYNAMIC_PROGRAMMING, SORTING, or OTHERS. (Must be capitalized)

  • One question can only have one title, description and difficulty. It can have multiple topics separated by ,. It can have multiple test cases, each begin with a TestCase:: identifier.

  • For sample questions, refer to the ../DukeAcademy/newQuestions/NewProblems.txt file.