From cfe4d87ac0271d1d33d49f8f28c11c7ac946567a Mon Sep 17 00:00:00 2001 From: William Meacham Date: Thu, 4 Jun 2020 07:31:31 -0700 Subject: [PATCH] Added vmsetupnumbertiles_ten_one A request was made for the numbertiles vm without the 100's block. Added a new function called vmsetupnumbertiles_ten_one. This vm will use the same "vmnumbertilesgetcount" with the 100's block always being zero. Will be doing a pull request to add numbertiles_ten_one.html to the library. --- assessment/libs/virtmanip.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) 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