sgimenez / laby

Learn programming, playing with ants and spider webs ;-)
https://sgimenez.github.io/laby/
Other
99 stars 39 forks source link

Ideas for improvement #22

Open AmitAmely opened 11 years ago

AmitAmely commented 11 years ago

Loved your game! Great work!

I think that it is a nice challenge for advanced programmers, not only for kids and beginners.

I challenged myself to write a complete algorithm for fully automated ant, which is capable of finding the exit without prior knowledge of what the maze looks like, and that gave me some fine challenge for a couple of days: figuring out how to navigate the short sighted ant which is only capable of looking 1 tile ahead at a time, mapping its surrounding, navigating around without going in circles.

To challenge my algorithm, I built some advanced levels.

I added them to the Wiki page, and also added a simple English guide for Java (more or less like the German C guide). I hope that I didn't make any serious mistakes in the French and Spanish text translations - I used Google Translate, so I can't tell for sure.

Question:

I noticed that dropping a rock on top of rubble was forbidden, however there's no way to tell that the tile is occupied by rubble other than trying to drop rock on top of it and failing. Is this a bug, or is this a deliberate complication to challenge the advanced programmers playing the game?

Bug: (fixed in d850fa0efc572e204fc3ee54c1e2df663f1bb7a9)

The error message which is displayed when trying to take a rock while already carrying a rock is incorrect - it says that there's no rock to take instead of saying that only one rock can be carried at a time.

Simple enhancement suggestions:
  1. Have the methods drop(), take(), forward(), and escape() return a boolean value, giving an indication to whether the action was successful or not.
  2. Do not cache map list and the maps themselves - they are small files anyway. I was required to restart laby anytime I made a change to my test maps, and when adding new maps.
    Advanced enhancements (may I should challenge myself on these ones :) ):
  3. Energy
    • Robot ant has a property of energy, whose initial value is defined in the map file.
    • Each forward move reduced 1 energy point.
    • Moving around carrying a rock reduce 5 energy points.
    • A new Tile type is introduced: Grain
    • A new method is introduced: boolean eat();
    • If a grain is located in the tile in front of the ant, it will eat it and energy will raise by 20 points and the return value is true.
    • If no grain is located in the tile in front, error message will be displayed in the console and the return value is false.
    • When there's not enough energy to move forward, forward() will return false and an error message will be displayed in the console.
  4. Support random walls (like web and rock), using capital O in the map.

Again, great job! Well done!

malo-denielou commented 11 years ago

Hi Amit, Thanks for your message and the many suggestions. I will try to find time to implement some of them. Cheers, Malo

AmitAmely commented 11 years ago

Regarding the rubble issue - I gave it another thought and now I think that since finding a programming solution for it was a good challenge, I suggest you leave it as is so other advanced programmers who play this game can challenge themselves. Same for the boolean return value for drop/take/forward.

I will soon add some new challenging levels to the Wiki page, and maybe some more Wiki documentation.