Skip to content

Commit

Permalink
Fixed treble bob
Browse files Browse the repository at this point in the history
  • Loading branch information
jwholdsworth committed Apr 8, 2012
1 parent ddc2006 commit cc033ef
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 69 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h2>Methods</h2>
<option value="D">Delight</option> <option value="D">Delight</option>
<option value="P">Plain</option> <option value="P">Plain</option>
<option value="S" selected="selected">Surprise</option> <option value="S" selected="selected">Surprise</option>
<option value="TB">Treble Bob</option> <option value="T">Treble Bob</option>
</select> </select>
<input type="button" value="Load Method from Library" id="searchMethod" /> <input type="button" value="+" id="moreMethods" /> <input type="button" value="Load Method from Library" id="searchMethod" /> <input type="button" value="+" id="moreMethods" />
</div> </div>
Expand Down
15 changes: 0 additions & 15 deletions js/frontend.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -129,21 +129,6 @@ function checkMethodLetterIsUnique(letter, method_name, method_symbol) {
return is_unique; return is_unique;
} }


// parses a music pattern and converts it into jsprove format
function readUserMusicPatterns(patternList) {
patternList = patternList.split("\n");

for(j=0; j < patternList.length; j++) {
var pattern = patternList[j].split("");
for(i=0; i < pattern.length; i++) {
// do the opposite of what we do in do_prove() - convert bell numbers into array items
pattern[i] = bell_index(pattern[i]);
}
patternList[j] = pattern;
}
return patternList;
}

function loadMethodsForStage(stage) { function loadMethodsForStage(stage) {
switch (stage) { switch (stage) {
case '6': case '6':
Expand Down
95 changes: 43 additions & 52 deletions js/methodlib.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -341,59 +341,50 @@ function Shorthand(shorthand, method) {
// returns number of leads until you insert the next call // returns number of leads until you insert the next call
that.ringToNextCall = function(call, callType, fn, isSingle, c) { that.ringToNextCall = function(call, callType, fn, isSingle, c) {
var moreLeads = true; var moreLeads = true;
var tenorPosition = this.rank-1; var tenorPosition = bell_index(call);
call = call.toLowerCase(); // couldn't find index
switch(call) { if(tenorPosition < 1) {
case "h": call = call.toLowerCase();
tenorPosition = this.rank-1; switch(call) {
break; case "h":
case "w": tenorPosition = this.rank-1;
tenorPosition = this.rank-2; break;
break; case "w":
case "m": tenorPosition = this.rank-2;
tenorPosition = this.rank-3; break;
break; case "m":
case "i": tenorPosition = this.rank-3;
// won't this break if using n-2 place calls? break;
if(isSingle) { case "i":
// single 3rds // won't this break if using n-2 place calls?
tenorPosition = 2; if(isSingle) {
} else { // single 3rds
// run in tenorPosition = 2;
tenorPosition = 1; } else {
} // run in
break; tenorPosition = 1;
case "b": }
if(isSingle) { break;
tenorPosition = 1; case "b":
} else { case "o":
if(isSingle) {
tenorPosition = 1;
} else {
tenorPosition = 2;
}
break;
case "t":
tenorPosition = 2; tenorPosition = 2;
} break;
break; case "f":
case "t": tenorPosition = 3;
tenorPosition = 2; break;
break; case "v":
case "f": tenorPosition = 4;
tenorPosition = 3; break;
break; default:
case "v": throw "Calling Position " + call + " not found";
tenorPosition = 4; }
break;
case "6":
tenorPosition = 5;
break;
case "7":
tenorPosition = 6;
break;
case "8":
tenorPosition = 7;
break;
case "9":
tenorPosition = 8;
break;

default:
throw "Calling Position " + call + " not found";
} }


if(tenorPosition >= this.rank) { if(tenorPosition >= this.rank) {
Expand Down
17 changes: 16 additions & 1 deletion js/pealprover.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ function do_prove() {
var changes = 0; var changes = 0;
var rounds = 0; var rounds = 0;
var music = MusicBox(); var music = MusicBox();
var musicOutput;


function test_row(c, le) { function test_row(c, le) {
var r; var r;
Expand All @@ -101,6 +100,7 @@ function do_prove() {
var gc = get_composition(); var gc = get_composition();
var comp = gc[0]; var comp = gc[0];
var txtCalls = gc[1]; var txtCalls = gc[1];
var musicOutput;


// add 4-bell run patterns whatever the stage (rank) // add 4-bell run patterns whatever the stage (rank)
for(i=0; i < comp.rank; i++) { for(i=0; i < comp.rank; i++) {
Expand Down Expand Up @@ -219,6 +219,21 @@ function do_prove() {
return [res, musicOutput, courses]; return [res, musicOutput, courses];
} }


// parses a music pattern and converts it into jsprove format
function readUserMusicPatterns(patternList) {
patternList = patternList.split("\n");

for(j=0; j < patternList.length; j++) {
var pattern = patternList[j].split("");
for(i=0; i < pattern.length; i++) {
// do the opposite of what we do in do_prove() - convert bell numbers into array items
pattern[i] = bell_index(pattern[i]);
}
patternList[j] = pattern;
}
return patternList;
}

function generateShorthand(methodID, bob, single) { function generateShorthand(methodID, bob, single) {
var vm = validate_method(methodID); var vm = validate_method(methodID);
var s = Shorthand($('#shorthand').val(), vm[1]); var s = Shorthand($('#shorthand').val(), vm[1]);
Expand Down

0 comments on commit cc033ef

Please sign in to comment.