AndyDentFree / rbstuff

Automatically exported from code.google.com/p/rbstuff
2 stars 0 forks source link

Beeper Count #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Some Karel missions require doubling the number of beepers in the world on a 
particular 
square. If there is more than one beeper at a single location in JavaKarel then 
the number of 
beepers is displayed in the center of the diamond. Our current beeper design 
doesn't allow us to 
see if there are multiple beepers in a single location.

One Karel mission in particular asks the user to double the number of beepers 
on a square - 
without using counters or other non Karel variables for counting. On square 3,1 
there is a 
beeper with a 5 in the middle so we know there are 5 beepers at this location. 
The trick to 
solving this is to pick up a beeper and place 2 beepers in the square to the 
right and repeat this 
until there are no beepers on the original square. Then by moving all the 
beepers from the new 
big pile back to the original square you have effectively doubled the number of 
beepers which 
were originally there.

These types of missions would require a way of knowing how many beepers are on 
a pile.

One other related topic...our current Karel robot design doesn't allow us to 
see if there is a 
beeper at our current location. So if you finished a mission by placing a 
beeper you would not be 
able to see if it was on your square.

For example if you wanted to fill a row with beepers with something like this...

while frontisclear
placebeeper
move
wend

...in the example above you may assume that all squares now have a beeper but 
in fact the final 
square where front was not clear would not have a beeper but you would not know 
this unless 
you moved off the square.

Original issue reported on code.google.com by jeffreya...@gmail.com on 28 Apr 2009 at 1:40

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
As mentioned in my response to issue #18 the syntax is different for different 
Karel sources - I implemented 
nextToABeeper and notNextToABeeper to tell if one is there.

I think displaying the count is a very good idea, already asked in issue #7.

In terms of robot logic, do you think we need a countBeepers or similar command 
to read the count at a 
location?

Original comment by dentaroo@gmail.com on 28 Apr 2009 at 3:07

GoogleCodeExporter commented 9 years ago
Great re the nextToABeeper ... sry I missed that in #18
Great re displaying the count ... sry missed that in #7

Personally I don't think we need countBeepers. Part of Karels charm is not 
knowing how to count and thus the 
need to use beepers in unique ways to calculate simple addition etc like in my 
example above. However 
displaying the beeper count at a location for the user to see will be great

Original comment by jeffreya...@gmail.com on 28 Apr 2009 at 4:44

GoogleCodeExporter commented 9 years ago

Original comment by dentaroo@gmail.com on 30 Apr 2009 at 11:51