Difference between revisions of "Merlin Builder"

From Coder Merlin
Line 19: Line 19:


== Getting Started ==
== Getting Started ==
'''Please note: this section of the page is currently in progress'''
* For this example, navigate to your Experiences directory and create an empty directory named CtoF
* Run '''merlin builder init''' inside your newly-created directory. This creates the required Merlin Builder directory structure
{{ConsoleLine|john-williams@codermerlin:~/Experiences/CtoF| merlin builder init}}
* Navigate to the '''sources''' directory, and open '''instructions.txt''' in emacs. These are the instructions that the student will see when they prepare the mission
{{ConsoleLine|john-williams@codermerlin:~/Experiences/CtoF/sources| emacs instructions.txt}}
* Since this mission will require the user to convert a given temperature from Celsius to Farenheight, delete the contents of 2. append the following to instructons.txt: Given input c, a Double in degrees celsius, print the equivalent temperature in Fahrenheit
* Save and exit emacs
*Next, open '''main.swift''' in emacs
{{ConsoleLine|john-williams@codermerlin:~/Experiences/CtoF/sources| emacs main.swift}}
* replace '''let s = "Hello, World"''', with '''let c = 21.2'''
* above the print statement, append '''let degreesF = 0'''
* replace '''print("Hello, World!")''', with '''print(degreesF)'''
* Save and exit emacs

Revision as of 19:24, 26 January 2021

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Overview[edit]

Merlin Builder is a tool available to  Merlin Mavens™  that provides the required functionality to build a challenge for use by  Merlin Mission Manager . Any supported language may be used for the challenge (though the generator and verifier must be written in Swift).

The  Merlin Mission Manager  verifies challenges through a multi-step process. The following steps occur each and every time that a student executes merlin test:

  1. A generator generates a problem set. The problem set serves as input to the student's program by providing:
    1. Standard input (e.g. simulates a user's keyboard input)
    2. Command line arguments
    3. Text replacement within zero or more of the student's program files. This is referred to as excision because a portion of the student's program file is removed during this process.
    4. Expected standard output
  2. After the problem set is generated, the student's program is built using make.sh. The program will include any text replaced during the excision process.
  3. The student's (potentially modified) program is executed using run.sh and both standard output and standard input are spooled to a file
  4. A verifier compares the actual standard output with the expected standard output and determines whether or not the execution was successful

Usage[edit]

There are only three builder subcommands as the majority of the process involves coding of the generator.

  • merlin builder init: Initializes the directory structure and must be the first command executed in an empty directory
  • merlin builder prepare: Similar to the parallel merlin prepare copies the source files to serve as a starting point for the student
  • merlin builder test: Similar to the parallel merlin test executes the generator and verifier

Getting Started[edit]

Please note: this section of the page is currently in progress

  • For this example, navigate to your Experiences directory and create an empty directory named CtoF
  • Run merlin builder init inside your newly-created directory. This creates the required Merlin Builder directory structure

john-williams@codermerlin:~/Experiences/CtoF  merlin builder init


  • Navigate to the sources directory, and open instructions.txt in emacs. These are the instructions that the student will see when they prepare the mission

john-williams@codermerlin:~/Experiences/CtoF/sources  emacs instructions.txt

  • Since this mission will require the user to convert a given temperature from Celsius to Farenheight, delete the contents of 2. append the following to instructons.txt: Given input c, a Double in degrees celsius, print the equivalent temperature in Fahrenheit
  • Save and exit emacs


  • Next, open main.swift in emacs

john-williams@codermerlin:~/Experiences/CtoF/sources  emacs main.swift

  • replace let s = "Hello, World", with let c = 21.2
  • above the print statement, append let degreesF = 0
  • replace print("Hello, World!"), with print(degreesF)
  • Save and exit emacs