diff --git a/assessment/libs/virtmanip.php b/assessment/libs/virtmanip.php index 05b1a609d9..9dc303b979 100644 --- a/assessment/libs/virtmanip.php +++ b/assessment/libs/virtmanip.php @@ -130,7 +130,7 @@ function vmchipmodelgetcount($state) { } //vmsetupnumbertiles(stuans,qn,[part]) -//Set up a number tiles manipulative +//Set up a number tiles manipulative with 100, 10 and 1 blocks function vmsetupnumbertiles($state,$qn,$part=null) { if ($part !== null) {$qn = 1000*($qn)+$part;} else {$qn--;} $initbase = "[]"; @@ -150,6 +150,28 @@ function vmsetupnumbertiles($state,$qn,$part=null) { return $out; } +//vmsetupnumbertiles_ten_one(stuans,qn,[part]) +//Set up a number tiles manipulative with 10 and 1 blocks +//This VM uses vmnumbertilesgetcount to get the user input, with the 100's always at zero +function vmsetupnumbertiles_ten_one($state,$qn,$part=null) { + if ($part !== null) {$qn = 1000*($qn)+$part;} else {$qn--;} + $initbase = "[]"; + $initobj = "[]"; + if ($state!="") { + list($initbasestr,$initobjstr,$cont) = explode('|',$state); + if ($initbasestr != '') { + $initbase = '[['.str_replace(';','],[',$initbasestr).']]'; + $initbase = preg_replace('/\[([^\[\]]+?),/','["$1",',$initbase); + } + if ($initobjstr != '') { + $initobj = '[['.str_replace(';','],[',$initobjstr).']]'; + $initobj = preg_replace('/\[([^\[\]]+?),/','["$1",',$initobj); + } + } + $out = ''; + return $out; +} + //vmnumbertilesgetcount(stuans) //return an array array(hundredcount,tencount,onecount) of the count of //hundred blocks, ten blocks, and ones blocks in the drop area