randRange( 0, 3 )
[
[ school(1), school(2), school(3), school(4) ],
[ person(1), person(2), person(3), person(4) ],
[ person(1), person(2), person(3), person(4) ],
[ $._("Alabama"), $._("Michigan"), $._("New York"), $._("Wyoming") ]
][ INDEX ]
[
[ $._("3rd grade"), $._("4th grade"), $._("5th grade"), $._("Total") ],
[ $._("January"), $._("February"), $._("March"), $._("Total") ],
[ $._("1st Quarter"), $._("2nd Quarter"), $._("3rd Quarter"), $._("4th Quarter"), $._("Total") ],
[ $._("Q1"), $._("Q2"), $._("Q3"), $._("Q4"), $._("Total") ] ][ INDEX ]
(function() {
var enrollments = [];
var classMin = [ 60, 0, 2, 20 ][ INDEX ];
var classMax = [ 80, 6, 10, 40 ][ INDEX ];
for ( var i = 0; i < ROWS.length; i++ ) {
var enroll = randRange( classMin, classMax, COLUMNS.length - 1 );
var total = 0;
$.each( enroll, function( i, e ) {
total += e;
} );
enroll.push( total );
enrollments.push( enroll );
}
return enrollments;
})()
randRange( 0, COLUMNS.length - 1 )
randRange( 0, ROWS.length - 1 )
ENROLLMENTS[ ROW_INDEX ][ COL_INDEX ]
[
$._("shows the enrollment at four different elementary schools that have 3rd through 5th grade students"),
$._("shows the number of chickens sold by four farmers from January to March"),
$._("indicates the points scored by four players in a charity basketball game"),
$._("shows solar panel installations by state during the last fiscal year")
][ INDEX ]
(function() {
if ( COL_INDEX === COLUMNS.length - 1 ) {
var dict = {name: ROWS[ROW_INDEX]};
return [
$._("How many students does %(name)s Elementary School have in total?", dict),
$._("How many chickens did %(name)s sell in total?", dict),
$._("How many points did %(name)s have in total?", dict),
$._("How many total solar panels were installed last year in %(name)s?", dict)
][ INDEX ];
} else {
return [
$._("How many %(grade)s students does %(name)s Elementary School have?", {grade: COLUMNS[COL_INDEX], name: ROWS[ROW_INDEX]}),
$._("How many chickens did %(name)s sell in %(month)s?", {name: ROWS[ROW_INDEX], month: COLUMNS[COL_INDEX]}),
$._("How many points did %(name)s score in the %(time_period)s?", {name: ROWS[ROW_INDEX], time_period: COLUMNS[COL_INDEX]}),
$._("How many solar panels were installed in %(state)s in %(time_period)s?", {state: ROWS[ROW_INDEX], time_period: COLUMNS[COL_INDEX]})
][ INDEX ];
}
})()
[
$._("students"),
$._("chicken(s)"),
$._("points"),
$._("solar panels")
][ INDEX ]
[
$._("the student enrollment at %(name)s", {name: ROWS[ROW_INDEX]}),
$._("the number of chickens sold by %(name)s", {name: ROWS[ROW_INDEX]}),
$._("the number of points scored by %(name)s", {name: ROWS[ROW_INDEX]}),
$._("the number of solar panels installed in %(state)s", {state: ROWS[ROW_INDEX]})
][ INDEX ]
(function() {
if ( COL_INDEX === COLUMNS.length - 1 ) {
return [
$._("the total number of students at each school"),
$._("the total number of chickens sold by each person"),
$._("the total number of points scored by each person"),
$._("the total number of solar panels installed in each state")
][ INDEX ];
} else {
return [
$._("the number of %(grade)s students at each school", {grade: COLUMNS[COL_INDEX]}),
$._("the number of chickens sold in %(month)s", {month: COLUMNS[COL_INDEX]}),
$._("the number of points scored in the %(time_period)s", {time_period: COLUMNS[COL_INDEX]}),
$._("the number of solar panels installed in %(time_period)s" + COLUMNS[ COL_INDEX ], {time_period: COLUMNS[COL_INDEX]})
][ INDEX ];
}
})()
[
$._("There are %(num)s %(grade)s students at %(school_name)s.", {num: ANSWER, grade: COLUMNS[COL_INDEX], school_name: ROWS[ROW_INDEX]}),
(COL_INDEX === COLUMNS.length - 1 ?
$.ngettext("%(name)s sold %(num)s chicken in total.",
"%(name)s sold %(num)s chickens in total.", ANSWER, {name: ROWS[ROW_INDEX]}) :
$.ngettext("%(name)s sold %(num)s chicken in %(month)s.",
"%(name)s sold %(num)s chickens in %(month)s.", ANSWER, {name: ROWS[ROW_INDEX], month: COLUMNS[COL_INDEX]})),
(COL_INDEX === COLUMNS.length - 1 ?
$._("%(name)s scored %(num)s points in total.", {name: ROWS[ROW_INDEX], num: ANSWER}) :
$._("%(name)s scored %(num)s points in the %(time_period)s.", {name: ROWS[ROW_INDEX], num: ANSWER, time_period: COLUMNS[COL_INDEX]})),
(COL_INDEX === COLUMNS.length - 1 ?
$._("There were %(num)s solar panels installed in %(state)s last year.", {num: ANSWER, state: ROWS[ROW_INDEX]}) :
$._("There were %(num)s solar panels installed in %(state)s in %(month)s.", {num: ANSWER, state: ROWS[ROW_INDEX], month: COLUMNS[COL_INDEX]}))
][ INDEX ]
The table below PROBLEM.
QUESTION
rowenrollment
ANSWER UNIT
The blue row shows ROW_HINT.
$( ".fake_row" ).eq( ROW_INDEX ).find( "span" )
.css( "background", KhanUtil.BLUE );
The orange column shows COL_HINT.
var nth = ":nth-child(" + ( COL_INDEX + 2 ) + ")";
$( ".fake_row span" + nth )
.css( "background", KhanUtil.ORANGE );
$( ".fake_header span" + nth )
.css( "background", KhanUtil.ORANGE );
$( ".fake_row" ).eq( ROW_INDEX ).find( "span" + nth )
.css( "background", "#aaa" );
FINAL_HINT