"use strict";

var assert = require('assert');

var calculateScore = function(guess, secret) {
    var cows = 0;
    var bulls = 0;

    return { cows: 0, bulls: 0 };
};

describe('cows and bulls', function() {
    describe('scoring', function() {
	it('no matches scores zero cows and bulls', function() {
	    var score = calculateScore('1234','5678');
	    
	    assert.equal(score.cows, 0);
	    assert.equal(score.bulls, 0);
	});
	
	it('single match in wrong place scores one cows', function() {
	    var score = calculateScore('1234', '5671');
	    
	    assert.equal(score.cows, 1);
	    assert.equal(score.bulls, 0);
	});
    });
});

@@ -126,16 +126,145 @@
 s = 0;%0A%0A
+    for (var i=0;i%3Csecret.length;++i) %7B%0A%09var secretChar = secret%5Bi%5D;%0A%09if (guess.indexOf(secretChar) !== -1) %0A%09    cows++;%0A    %7D%0A%0A
     retu
@@ -274,17 +274,20 @@
 %7B cows: 
-0
+cows
 , bulls:
@@ -287,17 +287,21 @@
  bulls: 
-0
+bulls
  %7D;%0A%7D;%0A%0A

can find a single cow