Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 26 additions & 27 deletions index.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,45 @@ title: Multiple Parson's Problems on One Page
---
# Parsons Practice

## Parsons 1 (Line Based Grader)
## Parsons 1
Re-arrange the blocks below so they print out "Hello World!"

<div id="p1-sortableTrash" class="sortable-code"></div>
<div id="p1-sortable" class="sortable-code"></div>
<div style="clear:both;"></div>
<p>
<input id="p1-feedbackLink" value="Get Feedback" type="button" />
<input id="p1-newInstanceLink" value="Reset Problem" type="button" />
</p>
<script type="text/javascript">
(function() {
var initial = "print(\"Hello\")\n" +
"print(\" \")\n" +
"print(\"World\")\n" +
"print(\"!\")";
<div id="question1-sortableTrash" class="sortable-code"></div>
<div id="question1-sortable" class="sortable-code"></div>
<div style="clear:both;"></div>
<p>
<input id="question1-feedbackLink" value="Get Feedback" type="button" />
<input id="question1-newInstanceLink" value="Reset Problem" type="button" />
</p>
<script type="text/javascript">
(function(){
var initial = "main(){\n" +
" System.out.println(Hello World);\n" +
"}\n" +
"class HelloWorld #distractor";
var parsonsPuzzle = new ParsonsWidget({
"sortableId": "p1-sortable",
"sortableId": "question1-sortable",
"max_wrong_lines": 10,
"grader": ParsonsWidget._graders.LineBasedGrader,
"exec_limit": 2500,
"can_indent": false,
"can_indent": true,
"x_indent": 50,
"lang": "en",
"trashId": "p1-sortableTrash"
"trashId": "question1-sortableTrash"
});
parsonsPuzzle.init(initial);
parsonsPuzzle.shuffleLines();
$("#p1-newInstanceLink").click(function(event){
event.preventDefault();
parsonsPuzzle.shuffleLines();
});
$("#p1-feedbackLink").click(function(event){
event.preventDefault();
parsonsPuzzle.getFeedback();
});
})();
$("#question1-newInstanceLink").click(function(event){
event.preventDefault();
parsonsPuzzle.shuffleLines();
});
$("#question1-feedbackLink").click(function(event){
event.preventDefault();
parsonsPuzzle.getFeedback();
});
})();
</script>


## Parsons 2 (Variable Check Grader)
Construct a program that swaps the values of variables <code>x</code> and <code>y</code> using the helper variable <code>tmp</code>. You can change the names of the variables (<span class="jsparson-toggle"></span>) by clicking them.

Expand Down
48 changes: 23 additions & 25 deletions parsons/example1.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,39 @@ title: Page 2 Example (Variable Check Grader)

Construct a program that swaps the values of variables <code>x</code> and <code>y</code> using the helper variable <code>tmp</code>. You can change the names of the variables (<span class="jsparson-toggle"></span>) by clicking them.

<div id="p1-sortableTrash" class="sortable-code"></div>
<div id="p1-sortable" class="sortable-code"></div>
<div style="clear:both;"></div>
<p>
<input id="p1-feedbackLink" value="Get Feedback" type="button" />
<input id="p1-newInstanceLink" value="Reset Problem" type="button" />
</p>
<script type="text/javascript">
<div id="question1-sortableTrash" class="sortable-code"></div>
<div id="question1-sortable" class="sortable-code"></div>
<div style="clear:both;"></div>
<p>
<input id="question1-feedbackLink" value="Get Feedback" type="button" />
<input id="question1-newInstanceLink" value="Reset Problem" type="button" />
</p>
<script type="text/javascript">
(function(){
var initial = "1\n" +
"2\n" +
"3\n" +
"4\n" +
"5";
var initial = "main(){\n" +
" System.out.println(Hello World);\n" +
"}\n" +
"class HelloWorld #distractor";
var parsonsPuzzle = new ParsonsWidget({
"sortableId": "p1-sortable",
"sortableId": "question1-sortable",
"max_wrong_lines": 10,
"grader": ParsonsWidget._graders.LineBasedGrader,
"exec_limit": 2500,
"can_indent": true,
"x_indent": 50,
"lang": "en",
"trashId": "p1-sortableTrash"
"lang": "en"
});
parsonsPuzzle.init(initial);
parsonsPuzzle.shuffleLines();
$("#p1-newInstanceLink").click(function(event){
event.preventDefault();
parsonsPuzzle.shuffleLines();
});
$("#p1-feedbackLink").click(function(event){
event.preventDefault();
parsonsPuzzle.getFeedback();
});
})();
$("#question1-newInstanceLink").click(function(event){
event.preventDefault();
parsonsPuzzle.shuffleLines();
});
$("#question1-feedbackLink").click(function(event){
event.preventDefault();
parsonsPuzzle.getFeedback();
});
})();
</script>

[Next](./example2.html)