Incorrect answer in the 'cube' task

Bug #572607 reported by Gregory Bonik
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GBrainy
Fix Released
Medium
gbrainy (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Binary package hint: gbrainy

The 'correct' answer in the 'Cube' problem is indeed wrong. The task reads:

"How many cubes do you count in the figure below? (not counting the figure)",

and the picture of a big cube subdivided into n^3 small cubes follows (see attachment). The number n is either 4, 5, or 6. GBrainy says that for each n the correct answer is n^3 (i. e. 64 for n = 4, 125 for n = 5 and 216 for n = 6), but obviously that's wrong.

There are also sub-cubes of sizes 2x2x2, 3x3x3 and so on. For example, in the case of n = 4, one can find 99 cubes:

8 = 2^3 cubes of size 3x3x3,
27 = 3^3 cubes of size 2x2x2
and 64 = 4^3 cubes of size 1x1x1.

So, for an arbitrary n the correct answer is 1^3 + 2^3 + ... + n^3. In particular, the answer for n = 5 is 224, the answer for n = 6 is 440, and, as already mentioned, the answer for n =4 is 99.

Revision history for this message
Gregory Bonik (gregory-bonik) wrote :
Revision history for this message
Victor Vargas (kamus) wrote :

I'm not a math user but I have downloaded gbrainy source and check that algorithm for obtain right answer fot this problem is resolved by:

rows = columns = deepth = 4 + random.Next (max_random);
ans = rows * columns * deepth;
right_answer += ans.ToString ();

For example if your case you have a cube with 4 rows, 4 colums and a deepth of 6 (faces of a regular cube), so in resume we have:
ans = (4 * 4 ) * 6 = 96

Changed in gbrainy (Ubuntu):
importance: Undecided → Low
Changed in gbrainy (Ubuntu):
assignee: nobody → Ben Crisford (bencrisford)
status: New → In Progress
Revision history for this message
Ben Crisford (bencrisford) wrote :

@Kamus: Ok, I'll check it out this weekend when I get 5 minutes.. Thanks for the comment :).

Changed in gbrainy:
status: Unknown → New
Revision history for this message
Gregory Bonik (gregory-bonik) wrote :

@Kamus, what?

If rows = columns = deepth = 4, then ans becomes 4*4*4 = 64. But that's not the correct answer, neither is 96. The correct answer is 99.

'Deepth'" (should be 'depth' of course) is not the number of faces. It's the number of cubes in the third dimension.

The correct code should be

n = random.Next(max_random)
ans = 0
for i in xrange(2, n + 1):
  ans += i**3

Alternatively, one can use the closed-form formula to compute the sum:
n = random.Next(max_random)
ans = (n*(n + 1) / 2)**2 - 1

It should be noted that in the case of unequal dimensions (i. e. rows, cols and depth differ from each other) the task gets a bit harder.

Revision history for this message
Jordi Mas (jmas-softcatala) wrote :

Hello folks,

Thanks for the feedback. I think that the problem is that the question clear enough for everybody bringing this confusion.

I would like to keep the puzzle simple. The user basically should count the 1x1 cubes.

Instead of the current question:

"How many cubes do you count in the figure below? (not counting the figure) Answer using a number"

I would suggest:

"How many single small cubes do you count in the figure below? Answer using a number"

What do you think?

Regards,

Jordi,

Note: See a very similar game[1]

[1] http://www.interactivestuff.org/sums4fun/3dboxes.html

Revision history for this message
Gregory Bonik (gregory-bonik) wrote :

@Jordi Mas, yes, that will be OK but not too interesting to solve. I think almost everyone can easily guess, that he should just raise the number to the power 3. The game you noted is better, because it features boxes and not only cubes, thus taking some time to perceive an image.

Revision history for this message
Jordi Mas (jmas-softcatala) wrote :

gbrainy allows the possibility to show different versions of the puzzle depending on which difficulty level you are playing.

I suggest two actions here:

1. Short term (for the 1.4x) maintenance series, fix the current wording of the question to make it work as it is now (easy / medium difficulty level).

2. Medium term (for gbrainy 1.5x release) include a more complex puzzle for master difficulty level.

Can you please guys confirm that the changes in the wording of proposed in comment #5 will clarify the current puzzle as it is? (easy)

Can you give please provide a version (just the question, and answer, and rationale, I can do the coding) of the same puzzle that is more complex for inclusion on gbrainy 1.5?

Thanks a lot for your help

Jordi,

Revision history for this message
Gregory Bonik (gregory-bonik) wrote :

Yes, I think that wording change from comment #5 will do. But is it an easy fix? Don't forget about i18n. If we consider a short-term maintenance series, maybe it's easier to fix the answer as suggested by me in the comment #4.

Some thoughts about 1.5x version:
1) Easy level:
"How many single small cubes do you count in the figure below? Answer using a number"
The figure is always a cube.
2) Medium level:
Same question, but the figure is any box.
3) Hard level:
"How many cubes do you count in the figure below? (not counting the figure)"
The figure is a cube.

Changed in gbrainy (Ubuntu):
assignee: Ben Crisford (bencrisford) → nobody
status: In Progress → Confirmed
Revision history for this message
Soren Mogensen (soren-mogensen) wrote :

I actually got this one wrong. Or rather, I think the n^3 answer is wrong.

The question says "the figure" below, and while it immediately looks like a cube, there is no way to know whether the figure is hollow. Thus, the only correct answer would have to be the sum of small cubes visible from the three sides visible to the user.

Thus for the 6 x 6 x 6 figure, the answer would be 6x6 + 5x6 + 5x5.

Thus, the question should point out that the figure is a complete cube in order for the n^3 answer to be correct.

Revision history for this message
Jordi Mas (jmas-softcatala) wrote :

Hello,

Some more precision will do no harm. Instead of saying:

"How many single small cubes do you count in the figure below? Answer using a number."

I propose to say:

"How many single small cubes do you count in the large cube below? Answer using a number."

Let me know what you think.

Regards,

Jordi,

Revision history for this message
Robert Ancell (robert-ancell) wrote :

How about "How many small cubes does it take to build the large cube below?" - this implies that you need to count the physical cubes not the logical ones.

Revision history for this message
Jordi Mas (jmas-softcatala) wrote :

Agreed. I commit it the fix. Thanks. Jordi,

Revision history for this message
Victor Vargas (kamus) wrote :

That would be better :)

Changed in gbrainy (Ubuntu):
status: Confirmed → Fix Committed
Changed in gbrainy:
importance: Unknown → Medium
Changed in gbrainy:
status: New → Fix Released
Changed in gbrainy (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.