首页 > > 详细

ICS 46编程设计代做、代写c/c++语言编程、代做c++程序课程代做R语言编程|代做R语言编程

ICS 46 Winter 2020 Assignment 1: Combinatorial Puzzles
Due Tuesday, October 20, 8:59 AM.
Introduction
In the first three lectures, we saw that recursion can make some seemingly laborious problem
solving into a straight-forward exercise. In project 0, we saw that we can check if a solution is
valid to summation puzzles. In this assignment, we’re going to solve summation puzzles.
In a summation puzzle, you are given three strings of the form POT + PAN = BIB. Typically
each is a word, often with a theme to the three chosen. Your goal is to assign a distinct digit to
each letter in the equation in order to make the resulting true. For example, if the puzzle is POT
+ PAN = BIB, the mapping P:2, O:3, T:1, A:7, N:4, B:5, I:0 will solve this, as 231 + 274 = 505.
Getting Started
Before you begin work on this project, there are a couple of chores you'll need to complete on
your ICS 46 VM to get it set up to proceed.
Refreshing your ICS 46 VM environment
Even if you previously downloaded your ICS 46 VM, you will probably need to refresh its
environment before proceeding with this project. Log into your VM and issue the command
ics46 version to see what version of the ICS 46 environment you currently have stored on your
VM. Note, in particular, the timestamp; if you see a version with a timestamp older than the one
listed below, you'll want to refresh your environment by running the command ics46 refresh to
download the latest one before you proceed with this project.
If you're unable to get outgoing network access to work on the ICS 46 VM — something that
afflicts a handful of students each quarter — then the ics46 refresh command won't work, but an
alternative approach is to download the latest environment from the link below, then to upload
the file to your ICS 46 VM using SCP. (See the Project #0 write-up for more details on using
SCP.) Once the file is on your VM, you can run the command ics46 refresh_local
NAME_OF_ENVIRONMENT_FILE, replacing NAME_OF_ENVIRONMENT_FILE with the name
of the file you uploaded; note that you'd need to be in the same directory where the file is when
you run the command.
The file is linked from the “public” ICS 46 page; click this link and enjoy the amazing web
design skill that put it together: https://www.ics.uci.edu/~mikes/ics46/
Creating your project directory on your ICS 46 VM
A project template has been created specifically for this project, containing a similar structure to
the basic template you saw in Project #0.
Decide on a name for your project directory, then issue the command ics46 start
YOUR_CHOSEN_PROJECT_NAME project1 to create your new project directory using the
project1 template. (For example, if you wanted to call your project directory proj1, you would
issue the command ics46 start proj1 project1 to create it.) Now you're ready to proceed!
Reviewing related material
If you are using the Goodrich/Tamassia textbook, in the second edition, section 3.5 deals with
recursion. This book is good at getting to the point, so this should not be a long read.
Furthermore, you should look at your notes from lecture when we discussed the n Queens
problem and solving it via recursion. The video is available on Canvas.
Requirements
You are required to implement the function puzzleSolver in proj1.cpp. This function should
return true if, and only if, the puzzle is solvable: that is, if there is a mapping of the letters that
appear in the three strings to distinct digits such that the sum of the first two is the third. No
string will have a value larger than 4,294,967,295 in its correct substitution, nor will the addition
have any integer-overflow to check for. If you do not know what integer overflow is, you do not
need to check during this assignment (although it’s worth knowing in general).
For this project, you have a few requirements:
● You must implement the function puzzleSolver in proj1.cpp. You may assume it is called
with three valid non-empty strings as parameters and with an otherwise empty map. The
strings will always consist only of all-capital letters.
● Your solution must explicitly use recursion in a meaningful way towards solving the
problem. You may not solve this by using a function like std::next_permutation (from
) to enumerate possibilities.
○ The function puzzleSolver itself need not be recursive if you would prefer to
have a helper function that is.
● The function must return a boolean indicating whether or not the puzzle has a solution.
○ If the puzzle does not have a solution, your function should return false.
○ If the puzzle does have a solution your function should return true and have the
map

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp
热点文章
程序代写更多图片

联系我们 - QQ: 99515681 微信:codinghelp
© 2014 www.7daixie.com
程序代写网!