Permalink
Browse files

Fixed treble bob

  • Loading branch information...
1 parent ddc2006 commit cc033ef36c4523161fe5ecf7b8e2ba470b29c059 @jwholdsworth committed Apr 8, 2012
Showing with 60 additions and 69 deletions.
  1. +1 −1 index.html
  2. +0 −15 js/frontend.js
  3. +43 −52 js/methodlib.js
  4. +16 −1 js/pealprover.js
View
@@ -57,7 +57,7 @@
<option value="D">Delight</option>
<option value="P">Plain</option>
<option value="S" selected="selected">Surprise</option>
- <option value="TB">Treble Bob</option>
+ <option value="T">Treble Bob</option>
</select>
<input type="button" value="Load Method from Library" id="searchMethod" /> <input type="button" value="+" id="moreMethods" />
</div>
View
@@ -129,21 +129,6 @@ function checkMethodLetterIsUnique(letter, method_name, method_symbol) {
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) {
switch (stage) {
case '6':
View
@@ -341,59 +341,50 @@ function Shorthand(shorthand, method) {
// returns number of leads until you insert the next call
that.ringToNextCall = function(call, callType, fn, isSingle, c) {
var moreLeads = true;
- var tenorPosition = this.rank-1;
- call = call.toLowerCase();
- switch(call) {
- case "h":
- tenorPosition = this.rank-1;
- break;
- case "w":
- tenorPosition = this.rank-2;
- break;
- case "m":
- tenorPosition = this.rank-3;
- break;
- case "i":
- // won't this break if using n-2 place calls?
- if(isSingle) {
- // single 3rds
- tenorPosition = 2;
- } else {
- // run in
- tenorPosition = 1;
- }
- break;
- case "b":
- if(isSingle) {
- tenorPosition = 1;
- } else {
+ var tenorPosition = bell_index(call);
+ // couldn't find index
+ if(tenorPosition < 1) {
+ call = call.toLowerCase();
+ switch(call) {
+ case "h":
+ tenorPosition = this.rank-1;
+ break;
+ case "w":
+ tenorPosition = this.rank-2;
+ break;
+ case "m":
+ tenorPosition = this.rank-3;
+ break;
+ case "i":
+ // won't this break if using n-2 place calls?
+ if(isSingle) {
+ // single 3rds
+ tenorPosition = 2;
+ } else {
+ // run in
+ tenorPosition = 1;
+ }
+ break;
+ case "b":
+ case "o":
+ if(isSingle) {
+ tenorPosition = 1;
+ } else {
+ tenorPosition = 2;
+ }
+ break;
+ case "t":
tenorPosition = 2;
- }
- break;
- case "t":
- tenorPosition = 2;
- break;
- case "f":
- tenorPosition = 3;
- break;
- case "v":
- 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";
+ break;
+ case "f":
+ tenorPosition = 3;
+ break;
+ case "v":
+ tenorPosition = 4;
+ break;
+ default:
+ throw "Calling Position " + call + " not found";
+ }
}
if(tenorPosition >= this.rank) {
View
@@ -79,7 +79,6 @@ function do_prove() {
var changes = 0;
var rounds = 0;
var music = MusicBox();
- var musicOutput;
function test_row(c, le) {
var r;
@@ -101,6 +100,7 @@ function do_prove() {
var gc = get_composition();
var comp = gc[0];
var txtCalls = gc[1];
+ var musicOutput;
// add 4-bell run patterns whatever the stage (rank)
for(i=0; i < comp.rank; i++) {
@@ -219,6 +219,21 @@ function do_prove() {
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) {
var vm = validate_method(methodID);
var s = Shorthand($('#shorthand').val(), vm[1]);

0 comments on commit cc033ef

Please sign in to comment.