联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Matlab编程Matlab编程

日期:2023-06-04 11:09

MATLAB for SCI1022 assignment 4: Solving Sudoku

This assignment contributes 20% of your final mark for the MATLAB module. To complete the

assignment, write a MATLAB live-script or normal script, and provide a pdf-file with your

results including the figures. Each task needs to be clearly coded in the script, with each task

beginning a separate block within the code.

In this assignment you are solving Sudoku puzzles, using data and functions we used in the

lab classes, and a new function to solve any Sudoku puzzle.

1. Task: Solve Sudoku

Try to solve all 17 puzzles of the data file “sudoku.examples.mat”. Note, that the

puzzles are sorted, with the first the easiest and the last the hardest (see variable lvl,

for the difficulty level of each puzzle). Start your code based on the functions

sudoku_notes0 and sudoku_method_1.

? Present two example solutions for two different Sudoku puzzles.

? Clearly state which puzzles your solution can solve or not solve.

? Explain how your method of solving Sudoku puzzles works.

For solving the first 8 puzzles you will get 3 points. If your code can solve at least one

additional puzzle you will get 4 points.

(4 points)

Notes:

? For this task you are not allowed to use the function sudoku_mathworks or

any code derived from it.

? Your code must follow an algorithm, but not just explicitly provide the solution

for each puzzle hard coded (e.g., if puzzle #8, then solution = xyz).

? Solving all puzzles is very difficult. Try to just improve the current code a little

bit. Even this may be a bit of a coding challenge.

? Using the given functions, you will be able to solve the first 8 puzzles.

? Check the quizzes and worksheets for ideas on how to solve at least one of the

other puzzles.

2. Task: Solve Sudoku #16 and #17

Solve the Sudoku puzzles #16 and #17 using the function sudoku_mathworks.

(2 points)

3. Task: Number of function calls

The function sudoku_mathworks uses a recursive function approach.

? Which line of the codes shows that this code is a recursive function?

? For the puzzles #1, #9, #13 and #17: How many times is the function

sudoku_mathworks called to solve these puzzles?

(2 points)

4. Task: Explain the method sudoku_mathworks

Explain how the function sudoku_mathworks works. What approach is this method

using?

Hint: The function includes the function candidates, which is similar to the function

sudoku_notes0.

(2 points)


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp