Calculated Objects - new question type

Calculated Objects - new question type

by Nick Freear -
Number of replies: 31

Hi,

I've recently developed my first question type, calculated objects which extends the built-in calculated question type.

Teachers can use it to create questions like ‘How much is {apples} + {oranges}?
-- where the {wildcards} become M and N x images of apples and oranges respectively (also {pineapples} {pears}...). Its aimed at primary-school pupils (age 4+).

I've submitted it to Moodle Contrib and I thought I'd mention it here in case it sounds useful.
tracker.moodle.org/browse/CONTRIB-2308 - 1st version of code and details here.

Feedback welcome

Nick

Screenshot, {cookies} - {walnuts}

Average of ratings: Useful (1)
In reply to Nick Freear

Ang: Calculated Objects - new question type

by Morten Brydensholt -

Hi Nick

Very nice work.

The only trouble is the lack of meaning; one cannot subtract or divide different objects.

3 apples + 2 apples would make absolutely sense though.

'6 apples' divided by '2' is '3 apples'. This is probably what you want.

'6 apples' divided by '2 apples' is '4 apples'.

Best regards
Morten

Average of ratings: Useful (1)
In reply to Morten Brydensholt

Re: Ang: Calculated Objects - new question type

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Morten:

a. 3 apples + 2 apples would make absolutely sense though.

b. '6 apples' divided by '2' is '3 apples'. This is probably what you want.

c. '6 apples' divided by '2 apples' is '4 apples'.

I've always been poor at maths. I understand a and b allright. But I have no idea what is meant by c. '6 apples' divided by '2 apples' is '4 apples'.thoughtful
In reply to Joseph Rézeau

Ang: Re: Ang: Calculated Objects - new question type

by Morten Brydensholt -

Joseph,

I also feel a bit ashamed of myself by shooting at Nicks fine question type, but...

xxxxxx/xx = xxxx , by reduction.

Best regards
Morten

In reply to Morten Brydensholt

Re: Ang: Re: Ang: Calculated Objects - new question type

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
xxxxxx/xx = xxxx , by reduction
I don't understandsadsad
In reply to Mary Cooch

Re: Ang: Re: Ang: Calculated Objects - new question type

by Itamar Tzadok -
It's quite simple Mary. When apples divide apples between themselves it's usually because they want to eat them. This, of course, reduces to total number of apples in the universe, hence 'reduction'. Another thing to consider is that eating more than 1 apple may give the eater a stomachache. Now we come to 6/2=4. Admittedly that may be a bit of a challenge for 4+ because the 4+ have to understand the kind of considerations 2 apples dividing 6 others may make. In this case the 2 dividing apples may realize that it is better to allow 2 apples from the 6-pack to join them so that the 4 of them divide between themselves 4 apples such that each 1 apple eats only 1 apple and don't get a stomachache. At the end of such an encounter 4 apples would be left, and so 6/2=4! smile
In reply to Morten Brydensholt

Re: Ang: Re: Ang: Calculated Objects - new question type

by Jeff Forssell -
Isn't "six apples" more like 6x than xxxxxx (which you treat as x*x*x*x*x*x)?

What do we do with "apples squared" smile, not to mention to the power of six!
In reply to Jeff Forssell

Ang: Re: Ang: Re: Ang: Calculated Objects - new question type

by Morten Brydensholt -

Jeff,

Pierre has allready given the correct and clarified way to use this question type (below).

I was referring to the confusion that these pictures might rise.

Six apples on a row divided with two pineapples on a row. What does it mean?

Six apples on a row divided with two apples on a row. What does it mean? Are the apples summed or multiplied in the rows?

Best regards
Morten

In reply to Morten Brydensholt

Re: Ang: Calculated Objects - new question type

by Pierre Pichet -
To clarify this philophical problem, you can do normal * or / with numbers.

When you set the {apple} = 3 , and the answer as {apple}*2 you get the following.

Pierre

P.S. It will be nice to illustrate the 6 apples response , but this is a much harder problem...
Attachment 6pommes.jpg
In reply to Pierre Pichet

Re: Ang: Calculated Objects - new question type

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
I'm really sorry; Itamar lost me in the first sentence - I think I had better leave this well alone and stick to teaching Frenchsad

In reply to Pierre Pichet

Re: Ang: Calculated Objects - new question type

by Itamar Tzadok -
but only the harder problem captures the correct answer. smile
Attachment 6apples.png
In reply to Itamar Tzadok

Re: Ang: Calculated Objects - new question type

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Hey everyone, we have had a splendid display of maths pedantry in this thread, and I can appreciate that, but can we remember that what Nick is trying to do is make a bright colourful question type for children.

However, I would agree that the best way to phrase these questions would be:

  1. I have 4 apples and 3 oranges, how many pieces of fruit do I have?
  2. I have 7 oranges, and I give away 3 oranges, how many oranges do I have left?
  3. I have 6 oranges, and I share them out between 3 people, how many oranges does each person get?

Average of ratings: Useful (3)
In reply to Tim Hunt

Re: Ang: Calculated Objects - new question type

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Thanks, Tim, your re-phrasing is well-adapted to my elementary level in maths.
In reply to Joseph Rézeau

Re: Ang: Calculated Objects - new question type

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
moi aussi Josephsmile
In reply to Mary Cooch

Re: Ang: Calculated Objects - new question type

by hon wai lau -
Number and its operation is an abstract concept. When we do calculation, we always isolate the number out. Different objects can't simply be added, so only the following questions make sense:

6 apple + 2 apple = (6+2) apple = 8 apple
6 apple - 2 apple = (6-2) apple = 4 apple
6 apple * 2 = (6*2) apple = 12 apple
6 apple / 2 = (6/2) apple = 3 apple

The middle column is the abstraction to calculate the number only and the students should learn it. Otherwise, the concept of students will be polluted and a long time to recover from it. Say, if you told them 6 apple/2 apple is 4 apple, they may build up some idea like apple6/apple2 = apple4, which is correct if the notation is something to the power something but it is not what you want. wink

For the division, you may simply arrange it in the n x m matrix of the apple so that they can see the answer should be side of the matrix.
In reply to Morten Brydensholt

Re: Ang: Calculated Objects - new question type

by Nick Freear -
Hi Morten and Everyone,

Thanks for your feedback, much appreciated.

I agree that 3 apples + 2 apples would make more sense (unless you use Tim's phrasing). I'd already thought a little about this.

The problem in terms of the calculation, is that we need to differentiate between the apples. So, which do people prefer in the editor?
  • {apples-1} + {apples-2} + {apples-3}
  • {apples-A} + {apples-B} + ...
  • Something else?
Oh, and I'll steer clear of apples * apples and apples / apples !

Cheers,

Nick
In reply to Nick Freear

Re: Ang: Calculated Objects - new question type

by Nick Freear -

Hi all,

I'm happy to say that the question type is now in the Modules & Plugins database. And I've addressed various issues:

  1. The plug-in is now more self-contained and easier to install - details.
  2. Support for 'like' objects - "{apples_1} - {apples_2}" as in the screen shot.
  3. Support for arbitrary single-character wildcards. Eg. "{pears} / {x}"
  4. Support for more textual questions - if the operator or sign doesn't appear in the question text, put it in square brackets, between the wildcards. Eg. "I have {apples_1}, and give away [-] {apples_2}. How...?"
  5. Improved layout.

Enjoy! Yours,

Nick

Screen shot, {apples_1} - {apples_2}

Average of ratings: Useful (1)
In reply to Nick Freear

Re: Ang: Calculated Objects - new question type

by B K -

Hi Nick

thank you for your contribution to Moodle

i tried to understand your creation but i don't understand how it is different to a standard moodle "calculated question" type.


e.g. in moodle you can do the same thing: create two variabes; {apples1} and {apples2}


and then create a question like: John as {apples1} apples, and he eats {apples2} apples. How many does he have left?


i don't understand what your plug in does per se that isn't already being done?


chrs


BK

In reply to Nick Freear

Re: Calculated Objects - new question type

by Pierre Pichet -
Hi Nick,

Very interesting new question type big grin.
I installed it and it worked perfectly

As you can give to your images any values, this could lead to other applications for example in geometry or simulate counting with the small cubes(1 unit), bar(10 units), square(100 units) and big cube (1000 units) as used in elementary schools.

Thanks again.

Pierre



Average of ratings: Useful (1)
In reply to Pierre Pichet

Re: Calculated Objects - new question type

by Nick Freear -
Hi Pierre,

Great. I like your idea about small cubes, bars and so on. Alas, I haven't yet found the full set of shapes - just odd ones, like
en.wikipedia.org/wiki/File:Golden_Cube.svg
flickr.com/search/?q=cube... - Open content searches.

If anyone is good at creating 3-D graphics as flat images, feel free to chip in!

Yours,

Nick
In reply to Nick Freear

Re: Calculated Objects - new question type

by Pierre Pichet -
Hi Nick,
If you have two kind of apples you could build questions with * or / wink.

You should look at school materials stores like cameleon.com and perhaps could get authorization to use their images.

You should design an easy way to add new items see the proposal of Calculated extended plug-in of Dmitry Pupinin .

Pierre

Here an example.http://www.cameleon.com/fr/catalogue.php?cat=86&page=49

Attachment multibase.jpg
In reply to Nick Freear

Re: Calculated Objects - new question type - What did I do wrong ??

by Jennie Lawrence -
I am using a Moodle 1.9.9 build, on a Windows 7 system, hosted at Godaddy.com

I have installed per directions as a question/type on root and server.

I did figure out the {apples} + {apples} aspect and got the pages to move forward to enter in other figures. This screenshot however is my result. Is there something else that I need to configure?

Below is an excerpt from your README.txt .. These are things I have not done - as it states if I want to Upgrade. Is this the problem with my install that I need to upgrade to 2.0 and make the below changes?

=====

Upgrade.
To upgrade from previous versions:
1. Delete the 'question/type/calculatedobjects' directory.
2. Delete '{MOODLE}/lang/en_utf8/help/quiz/calculatedobjects.html
3. Follow the install instructions above.


TODO/ limitations:
* Add support for multiple operators (currently only 1 supported).
* Test with browsers.
* Test with Moodle 2 beta.
* More testing of backup and restore.
* Evaluate ereg and preg* calls.
* Work on validation functions (qtype_calculatedobjects_find_formula_errors).
* Tidy up.
* If there's demand, add ability to use custom icons/images.
* If there's demand, translation.


Acknowledgements - see file, pix/acknowledgements.txt

=====

Thank you for taking the time to review this request for help and assistance on what I have done improperly in installing your new application.

Best,

Jennie
In reply to Jennie Lawrence

Re: Calculated Objects - new question type - What did I do wrong ??

by Nick Freear -
Hi Jennie,

Sorry, I've only just read your post.

Thanks for trying the Calculated Objects question type and posting your experiences.

First, the reference to "Upgrade" in the readme only referred to upgrading from the pre-release version of the question type to the latest version - nothing to do with Moodle 2.0.

I've created a bug, CONTRIB-2367 for your problem. I haven't worked it out yet - it seems like something (a Moodle filter perhaps?) is post-processing the output from the question type, and replacing new-lines in the HTML source with the <BR> HTML line-break tag.

Please can you send me a HTML save of the page at Site Admin.-Modules-Filters-Manage Filters for your Moodle install?

I'm afraid I'm busy at present, but I hope to look at this urgently middle of next week. I hope this helps.

Many thanks,

Nick
In reply to Jennie Lawrence

Re: Calculated Objects - new question type - What did I do wrong ??

by Nick Freear -
Hi Jennie,

Are you still having this problem? It would be really useful to know!

Thanks,

Nick
In reply to Nick Freear

Re: Calculated Objects - new question type - What did I do wrong ??

by Ivan Kosak -

I installed new 2.2.3+ Moodle on brand new site and this question doesnt work with new version of Moodle.

Can you upgrade this plugin for 2.2.3?

 

Thanks in advance

Average of ratings: Useful (1)
In reply to Ivan Kosak

Re: Calculated Objects - new question type - What did I do wrong ??

by Nick Freear -

Hi Ivan,

Thanks for your post.

I've done some investigation, and it seems that the question engine changed a lot between Moodle 2.0.x and 2.1.x. I'll start figuring out how to make the Calculated Objects plugin work with Moodle 2.1.x onwards. Please be patient, as I have various plugins which need maintenance.

I'll post here as I make progress. Best wishes,

Nick

 

(FYI, this plugin was initially written for the book, Moodle 2 for Teaching 4-9 Year Olds.)

In reply to Nick Freear

Re: Calculated Objects - new question type - What did I do wrong ? Answer: nothing

by Nick Freear -

Hi Ivan and everyone,

Thank you for your patience!

I've taken advantage of the long weekend here in the UK, and re-written the Calculated Objects question type for Moodle 2.1 onwards.

I look forward to your feedback. Best wishes,

Nick

In reply to Nick Freear

Re: Calculated Objects - new question type - What did I do wrong ? Answer: nothing

by Nick Freear -

Hi,

I've fixed another bug CONTRIB-3692 that appeared in the admin interface on first install "Fatal error: Class 'qtype_renderer' not found".

Download the latest Zip - 2.1.x/2.2.x (2.3.x) branch.

I'll package a new release in the next day or two (yes I will!) Best wishes,

Nick

In reply to Nick Freear

Re: Calculated Objects - new question type - What did I do wrong ? Answer: nothing

by james aco -
In reply to james aco

Re: Calculated Objects - new question type - What did I do wrong ? Answer: nothing

by Jean-Michel Védrine -

Hello James,

Activate Debugging and most probably an error message will be displayed.

Message to Tim : maybe you could change the text diplayed in from of the forum to tell all people in big red letters

  • to say what Moodle version they are using (it's already here, but not emphasized enough IMHO)
  • to activate debugging when something in not working and to post the exact error message

 

Average of ratings: Useful (1)
In reply to Jean-Michel Védrine

Re: Calculated Objects - new question type - What did I do wrong ? Answer: nothing

by james aco -

Hello and thank you for replay,

adding this parameter to the question:

Question text: How much is {apples} + {oranges}

Correct answer formula= {apples} + {oranges}

debug - 

Fatal error: Call to undefined method qtype_calculated_variable_substituter::get_maths_operators() in public_html/moodle/question/type/calculatedobjects/renderer.php on line 42

Thank you