diff --git a/4-Beyond-Classical-Search/c_erraticVacuum.js b/4-Beyond-Classical-Search/c_erraticVacuum.js index a8399b3..27e099a 100644 --- a/4-Beyond-Classical-Search/c_erraticVacuum.js +++ b/4-Beyond-Classical-Search/c_erraticVacuum.js @@ -1,217 +1,244 @@ -$(document).ready(function() { +class MovesRecorder { + constructor(element) { + this.list = element; + //Clears the existing elements + this.clear(); + this.moves = []; + } - class MovesRecorder { + clear() { + this.moves = []; + this.list.selectAll('*').remove(); + } - constructor(selector) { - this.list = $(selector); - //Clears the existing elements - this.clear(); - this.moves = []; - } + addLeft() { + this.moves.push('left'); + this.list.append('li') + .attr('class', 'list-group-item text-center moves-list-item waiting-move') + .text('Left'); + } - clear() { - this.moves = []; - this.list.empty(); - } + addRight() { + this.moves.push('right'); + this.list.append('li') + .attr('class', 'list-group-item text-center moves-list-item waiting-move') + .text('Right'); + } - addLeft() { - this.moves.push('left'); - this.list.append( - $('
Given below is a 5 tile erratic vacuum world. You can record a sequence of actions which you believe will clean up all the dirt. Use the play the button to execute that sequence. - Play the sequence multiple times to see how they can result in different end state sometimes. Use restart button to generate a new initial state. Use clear button to clear the recorded sequence - and record a new one.
-Given below is a 5 tile erratic vacuum world. You can record a sequence of actions which you believe will clean up all the dirt. Use the play the button to execute that sequence. Play the sequence multiple times to see how they can result in different + end state sometimes. Use restart button to generate a new initial state. Use clear button to clear the recorded sequence and record a new one.
+In this world, the vacuum cleaner has no idea initially about its own location and the location of dirt in the world. Since the robot has no percept, it should be able to figure out a sequence of actions that will work despite its current state.
+Given below are 8 random initial states. You can record a sequence of actions and see it in action just like before. Assume that illegal moves (like moving right in the right-most tile) have no effect on the world.
+Try to find a sequence of actions that will lead to a final state (Clean all the dirt), no matter what the initial state of the world.
+