Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Function Name: willage Inputs: 1. (double) A 9x9 array of numbers Outputs: 1. (d

ID: 3753466 • Letter: F

Question

Function Name: willage Inputs: 1. (double) A 9x9 array of numbers Outputs: 1. (double) A completed 9x9 array of numbers Background: Your friend from the other school in Athens (u(sic)ga) frantically calls you while you are sitting in West Village having a peaceful meal. They tell you that they can't figure out the last number of their sudoku puzzle. They believe you can help them out, since you go to Georgia Tech. But alas, you have no time to figure the puzzle out by hand, so you set out to create a function with MATLAB to figure out the missing number Function Description number in the puzzle. Then, replace the zero with the appropriate number to finish the puzzle Example Write a function that takes in a 9x9 array and find the zero, which represents the missing puzzle -[452391876 completedPuzzle [452391876 318675294 679428315 831564729 245907163 967213548 796852431 183749652 524136987] 318675294 679428315 831564729 245987163 967213548 796852431 183749652 524136987] >completedPuzzle - willage (puzzle) Notes: e In sudoku, each row and each column has numbers 1-9 once, which means that each row and column should add up to 45 . There will only be one missing number but it will not always be in the center row or column Hints: "find()" a function to help you look for the zero

Explanation / Answer

The script can be written in many ways as ensuring sum 45 can be done from both column and row. Assuming as only one entry is wrong, one check will suffice.

Please find the required function as the following: (Note: The function name must be the same as file name iti is contained in)

%==============================================

function [ completedpuzzle ] = willage( puzzle )

completedpuzzle=puzzle; % Initialization

[row,col]=find(puzzle==0);

completedpuzzle(row,col) = 45-sum(completedpuzzle(row,:));

end

%==============================================

Hope this helps! PLEASE THUMBS UP!!!!!!!!!!!!