From b475f104abe8e5b67f44eaf89be269dcb4b119d8 Mon Sep 17 00:00:00 2001 From: hitman Date: Wed, 30 Sep 2009 09:37:11 +0000 Subject: deleted rename.js and added rename.txt, which holds new names I will use after refactoring adding_up according to the dojo style guide. This is the last commit before I refactor adding up according to the style guide. --- diff --git a/examples/adding_up_to_10/js/rename.js b/examples/adding_up_to_10/js/rename.js deleted file mode 100644 index 29f039a..0000000 --- a/examples/adding_up_to_10/js/rename.js +++ /dev/null @@ -1,317 +0,0 @@ -$(document).ready(function(){ - - - var k = $.karma ({container: "#karma-main", lang: "en"}); - - k.init({ - images: [ - {name: "ball", file: "ball37px.png", localized : false }, - {name: "balloon", file: "balloon37px.png", localized : false }, - {name: "banana", file: "banana37px.png", localized : false }, - {name: "chilli", file: "chilli.png", localized : false }, - {name: "fish" , file: "fish64px.png", localized : false }, - {name: "flower", file: "flower37px.png", localized : false }, - {name: "normalChimp", file: "normalChimp_120x125.png", localized : false}, - {name: "happyChimp", file: "happyChimp_120x125.png", localized: false}, - {name: "sadChimp", file: "sadChimp_120x125.png", localized : false} - ] - , - sounds: [ - {name: "correct", file: "correct.ogg"}, - {name: "incorrect", file: "incorrect.ogg"}, - {name: "trigger", file: "trigger.ogg", localized: false} - ], - - }); - - -k.main(function() { - - - var imgNames = ["ball", "banana", "balloon","chilli", "fish", "flower"]; - //game logic - var total, time, n0, n1, correct; - var level = 0, d=160; - var choices=[], score = 0, speed = 12000; - var playerCorrect = 0, endTimerX = 80, startTimerY = 25, - endTimerY = 100, offsetTimerY = 5; - var timerPaper, timerRect, - chimpPaper, normalChimp, sadChimp, happyChimp, - topLtBox, topRtBox, bottomLtBox, bottomMdBox, bottomRtBox; - var buttons=[]; - var stopTimer = false; - var chooseMe; - - var createBox = function (paperName) { - var set, paper, box; - paper = Raphael(paperName+"Paper", 200, 200); - set = paper.set(); - return { "paper": paper, "prefix": paperName, "set": set}; - }; - - topLtBox = createBox("topLt"); - topRtBox = createBox("topRt"); - bottomLtBox = createBox("bottomLt"); - bottomMdBox = createBox("bottomMd"); - bottomRtBox = createBox("bottomRt"); - - boxes = [ topLtBox, topRtBox, bottomLtBox, - bottomMdBox, bottomRtBox]; - - sets = [topLtBox["set"], topRtBox["set"], bottomLtBox["set"], - bottomMdBox["set"], bottomRtBox["set"]]; - - - function game () { - boxes.forEach(function (box) { - box.set.remove(); - }); - - total = k.math.rand( 2, 5 + level ); //the total - n0 = total - k.math.rand(1, total - 1 ); //first number - n1 = total - n0; //second number - - //chose one option (the correct option) - //and then put the correct value into it - correct = k.math.rand( 0, 2 ); - choices[ correct ] = total; - - for (var i=0; i<3; i++) { - //generate the two other options - if ( choices[i] === total) { - continue; - } else { - // generate the other options - choices[ i ] = k.math.rand( 2, 10 ); - for (var j = 0; j < i; j++){ - if (choices[i] === choices[j]) { - choices[ i ] = k.math.rand( 2, 10 ); - } - } - } - } - - var imgId = imgNames[ level ] ; - - - var card = function (box, n, d) { - var pos = []; - var x, y, flag; - var imgVarNames = {}; - var prefix = box["prefix"]; - imgVarNames[prefix] = []; - box["set"] = box["paper"].set(); - - for (var i=0; i