代做CSC108H Assignment 1: Wordlock帮做Python程序

CSC108H Assignment 1: Wordlock

Due Date:Wednesday September 25,2024 before 4:00 p.m

Wordlock: A Word Game

In this assignment,you will write functions to implement a puzzle game that requires the player to use a number of simple moves to unscrambled a given word.The goal of the game is to discover the correct answer word.

Goals of this Assignment

·Use  the Function Design Recipe (https:/lq.utoronto.calcourses/352998/files/32275858?wrap=1) (https://q.utoronto.calcourses/352998/files/32275858/download?download_frd=1) to  plan,implement, and test functions.

·Write function  bodies  using  variables,numeric types,strings,and  conditional  statements.You can do this whole assignment with only the concepts from the Weeks 1,2,and 3 Prepare Exercises for CSC108.

·Learn to use  Python 3,Wing  101,provided  starter code,a checker module,and other tools.

The Wordlock Game

Before you begin writing any code,you first need to understand the Wordlock game.Gameplay is described in the paragraphs below,so read carefully!

Game Mechanics

In the game,the player is presented with a scrambled version of the answer string.The answer string has been scrambled by first spliting it into sections,each having the same length,and then rearranging each section randomly,as in Figure 1.

Figure 1:Strings are scrambled in sections.

In Figure 1,the section'ROCK' has been scrambled to become'OCKR'and the section|'LAKE'has been

scrambled to become EAKL'

The sections in the string are numbered 1 to N,where N is the total number of sections.The section length is fixed for each run of the game,and every section will have the same length.For example,

consider   the   string 'treerocklake' and   a   section   length   of[4.There  are  3  sections  in  total  and  section  2

is 'rock

The player's objective is to unscramble the string using as few moves as they can.The player has three   types of move available each turn:Check,Rotate,and Swap.Each move is applied to a single section of the string.We will use the phrase game state to refer to the current state of the string that the player is    trying to unscramble.

The   three    move   types:Check,Rotate,and    Swap

The Check move does not modify the game state.It is used to check if a given section of the game state has been correctly rearranged to match the corresponding section in the answer string.

The  Rotate  move  is  a  circular  Rotate  of  the  string  to  the   right,which   means  each  character  is  moved  one position to the right and the last character is moved to the front.For example,the second last character   of the section becomes the last character of the section in the new game state,and the last character

before the rotate is moved to be at the beginning of the section.

In the Swap move,the first and last characters of the section are exchanged in the game state.

The Rotate and Swap moves are illustrated in the figure below.

The   three   modes   of   gameplay:Test,Normal,and   Hint

The game allows for 3 modes of play:Test,Normal,and Hint.Enabling Test mode allows the player to set the correct answer and the number of sections before the game begins.(Otherwise,the player is presented with a scrambled word and told the section size.)Normal mode involves playing the game as we have described above.Hint mode provides one additional move that allows the player to receive hints  on  which  sections  and  moves  to  choose  each  round.

Gameplay

When the game begins,the player is first asked to choose a game mode.Then,the player is repeatedly asked to provide both:

1.The section number corresponding to the section they want to manipulate.(A string with N sections will have its sections numbered 1 to N.)

2.The move they would like to apply to the section.

If the player is playing in Hint mode,they will be offered the chance to get a hint for a section to choose,

or a move to make on a particular section.Getting a hint counts towards the player's total number of moves.

The game continues until the player has completely unscrambled the string and discovered the answer string.When the game is over,the player's total number of moves is reported.

Here is a video of the game being played (note that the video is difficult to see unless you watch it in the highest quality,use the settings gear and set the video quality to the highest number of kbps):

Files to Download

Click here to download the Assianment 1 Files (https://a.utoronto.ca/courses/352998/files/33105723? wrap=1)_山 (https://q.utoronto.calcourses/352998/files/33105723/download?download_frd=1),and  then    extract the zip file.The following paragraphs explain the files you have been given.

Starter code: wordlock functions.py

This file contains some constants,and a complete docstring (but not body!)for the first function you are  to write.You will update this file to include the complete functions that you write.This is the only file you will submit for grading.

Main program code: wordlock game.py

This file contains the main program code for playing the game.When it is run,the functions that you

wrote and put in the wordlock functions.py file will be called.When you have written all of the functions in wordlock functions.py ,you may play the full game by running wordlock game.py].You can further test your   code by running in Test mode where you are prompted for the ANSWER and SECTION LENGTH] that the game  should use.Do NOT make any changes to the wordlock game.py file,as you will  not submit this file.We    do not expect you to understand all of the code in this file at this point in the course.

Checker: a1 checker.py      checker generic.py   and  al   pyta.json

These files provide a checker program that you should use to perform. a simple test of your code.See   below in the section called CSC108 A1 Checker for more information about a1 checker.py].The   checker program requires the files checker generic.py and a1 pyta.json]. You do not need to do anything with

these files,other than keep them all in the same folder as your wordlock functions.py and wordlock game.py file.

What to do

In  the  starter  code  file wordlock functions.py ,complete  the  functions   as   described  in  the  table   below.Use

the Function     Design      Recipe      (https://g,utoronto.calcourses/352998/files/32275858?wrap=1)

(https://q.utoronto.calcourses/352998/files/32275858/download?download_frd=1)       that   we have    been learning  in  class,and  write  complete  docstrings  for  each  function.

Using Constants

The starter code in wordlock functions.py starts with the definition of some constants.Your code should make use of these provided constants.If the value of one of those constants were changed,and your

program rerun,your functions should work with those new values.We will test your code using different   values for the various moves and modes by updating the values of the constants -your code should sill  work with these updated values!The one exception to this is the constant HINT MoDE SECTION LENGTH].This   constant will always be set to 3 and your functions only need to work for this value.(We are constraining this value in order to make the assignment difficulty level appropriate for this stage in the course.)

Your docstring examples can use the values of the constants in the provided starter code,and do not need to changeif we change the values of the constants.

Students often choose to use the literal values of constants when references to the constants should be used instead.If you are confused about the difference,look into Piazza or come in to office hours!

Preconditions

When writing your functions,you may always assume that:1.the game state is a valid scrambling of the answer,and 2.both the game state and answer can be evenly split into sections with the given section    length.Yo u must not make any other assumptions other than this and what is given in the table below for each function.For example,you must not assume all characters are uppercase.

Regarding preconditions:1.You do not have to write any of the preconditions into the docstrings for this assignment,and 2.You can not assume any preconditions other than what we already mention about    the type contracts and parameters in the table below.




热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图