logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Using the code editor to your left, your task is to implement a solver for the Boggle game

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

1. Assignment #1

Using the code editor to your left, your task is to implement a solver for the Boggle game. Given a valid grid of letters and an arbitrary dictionary of words, return a list of contained words.

Your program must be contained in a single file boggle_solver.js that exports the function

     exports.findAllSolutions = function(grid, dictionary) { …… }

We have provide the file and function for you. Feel free to add additional helper functions and data structures as needed to the boggle_solver.js file.

RULES

Words must use adjacent tiles, including diagonals.

Each word may not use a cube more than once.

Words must be at least 3 letters long.

Warning: The “Qu” tile counts as 2 letters. There are no raw “Q” tiles. The “St” tile counts as 2 letters. There are no raw “S” tiles.

Examples:

Input: grid = [[“A”, “B”], [“C”, “D”]],

dictionary = [“A”, “B”, “AC”, “ACA”, “ACB”, “DE”]

Output: [“ACB”]

Input: grid = [[“A”, “B”, “C”, “D”], [“E”, “F”, “G”, “H”], [“I”, “J”, “K”, “L”], [“A”, “B”, “C”, “D”]]

Dictionary = [“ABEF”, “AFJIEB”, “DGKD”, “DGKA”]

Output: [“ABEF”, “AFJIEB”, “DGKD”]

Code given:

/**

 * Given a Boggle board and a dictionary, returns a list of available words in

 * the dictionary present inside of the Boggle board.

 * @param {string[][]} grid - The Boggle game board.

 * @param {string[]} dictionary - The list of available words.

 * @returns {string[]} solutions - Possible solutions to the Boggle board.

 */

 exports.findAllSolutions = function(grid, dictionary) {

  let solutions = [];

 

  return solutions;

}

 

var grid = [['T', 'W', 'Y', 'R'],

              ['E', 'N', 'P', 'H'],

              ['G', 'Z', 'Qu', 'R'],

              ['St', 'N', 'T', 'A']];

var dictionary = ['art', 'ego', 'gent', 'get', 'net', 'new', 'newt', 'prat',

                    'pry', 'qua', 'quart', 'quartz', 'rat', 'tar', 'tarp',

                    'ten', 'went', 'wet', 'arty', 'egg', 'not', 'quar'];

 

console.log(exports.findAllSolutions(grid, dictionary));

 

(5/5)
Attachments:

Expert's Answer

188 Times Downloaded

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

188 Times Downloaded

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Atharva PatilComputer science

690 Answers

Hire Me
expert
Chrisantus MakokhaComputer science

798 Answers

Hire Me
expert
AyooluwaEducation

532 Answers

Hire Me
expert
RIZWANAMathematics

731 Answers

Hire Me

Get Free Quote!

255 Experts Online