合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

        代寫0CCS0CSE、代做Python編程設(shè)計(jì)
        代寫0CCS0CSE、代做Python編程設(shè)計(jì)

        時(shí)間:2025-02-05  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯(cuò)



        Introduction to CS & Engineering (0CCS0CSE)
        Homework
        Due Friday Feb. 7
        th
        , 11am
        Activity
        Chess is a two-player board game, played on a chequered board where pieces are moved
        according to precise rules (see Table 1). The object of the game is to attack the opponent’s
        king in such a way that escape is impossible (checkmate). Each square on a chess board
        can be described by a letter (file) and number (rank). For example, in Figure 1, square
        b4 is on file b and rank 4.
        Figure 1: Chess board positions. (www.logicalchess.com)
        For this homework assignment you will design and implement two functions. The first
        function, position(piece, loc), takes the name of a chess piece and its position, and
        returns all the squares that piece can reach after a single move is made. The second
        function, getTo(piece, loc1, loc2), takes the name of a chess piece, two positions,
        and returns true if the piece can reach the second position in exactly two moves. Assume
        there are no other pieces on the board.
        1Chess Pieces
        Piece Moves
        King Moves one square in any direction.
        Queen Any number of squares diagonally, horizontally, or vertically.
        Rook Any number of squares horizontally or vertically.
        Bishop Any number of squares diagonally.
        Knight In an ‘L-shape,’ two squares in a straight direction, and
        then one square perpendicular to that.
        Pawn One square forward
        Table 1: Valid piece names and a description of how they move.
        Requirements
        1. The program should contain at least 3 functions. Furthermore, it should demonstrate
         an understanding how and when to use functions.
        2. The program must contain and use the functions position(piece, loc) and getTo(piece,
        loc1, loc2)
        3. The program should be written without using the chr() function, the ord() function,
         tuples, list comprehension, or nested functions (i.e., closures & decorators)
        4. All of your code should be within a function, i.e., no global variables
        5. Follow all submission requirements
        position(piece, loc)
        1. The function accepts full piece names, e.g., King, Rook or Queen, as a string. The
        function should be case insensitive, that is, King, king, and KING are treated the
        same.
        2. The function should accept positions, as a string, in file-rank format, e.g., b5, h8 or
        f3. The function should be case insensitive, that is, b3 and B3 are treated same.
        3. The function should return a list; the order of the chess squares in the list does not
        matter.
        4. If an invalid piece is passed to the function, i.e., a piece not found in Table 1, the
        function should return an empty list
        5. If the position of the piece is invalid, the function should return an empty list
        6. If the piece is in a position where it has no valid moves, the function should return
        an empty list
        2getTo(piece, loc1, loc2)
        1. The function accepts full piece names, e.g., King, Rook or Queen, as a string. The
        function should be case insensitive, that is, King, king, and KING are treated the
        same.
        2. The function should accept positions, as a string, in file-rank format, e.g., b5, h8 or
        f3. The function should be case insensitive, that is, b3 and B3 are treated same.
        3. The function should return True or False. If the piece can get from position 1
        to position 2 in exactly two moves, the function should return True, otherwise it
        should return False.
        4. If the piece can get from position 1 to position 2 in one move, return False
        5. If the piece is already on position 2, return False
        6. The function must use the position(piece, loc) function appropriately.
        Sample Test Cases
        For testing purposes, here are some of the test cases your submission must pass.
        1 position ('King ', 'f3 ')
        2 # Returns ['e4 ','f4 ','g4 ','e3 ','g3 ','e2 ','f2 ','g2 ']
        3
        4 position ('Rook ','i4 ')
        5 # Returns []
        6
        7 position ('knight ','d4 ')
        8 # Returns ['e6 ','f5 ','f3 ','e2 ','b3 ','c2 ','b5 ','c6 ']
        9
        10 getTo ('king ', 'e1 ', 'e3 ')
        11 # Returns True
        12
        13 getTo ('pawn ', 'c2 ', 'c8 ')
        14 # Returns False
        15
        16 getTo ('knight ', 'g1 ', 'e5 ')
        17 # Returns True
        3Submission Instructions
        Failure to follow all submission instructions may result in a lower grade.
        1. At the top of your program put the following comments:
        # [Your Full Name]
        # [Your K number]
        # Homework 1
        2. Name your solution hw1.py —exactly as you see it here. One word all lowercase,
        with the *.py extension.
        3. Submit the Python file (*.py) on KEATS —You do not need to include a cover
        sheet
        4. If asked for a submission title, enter your full name.
        Marking
        The mark is split 60% functionality and 40% implementation. Meaning, if your program
        works and passes all test cases you automatically get a 60. The remaining 40% will be
        given based on how well you implemented your solution., e.g., appropriate use of functions,
         use of descriptive variable names, following submission instructions, and meeting
        program requirements.
        Note:
        • if your program crashes during testing, you will receive a 40 regardless
        of the error that caused the crash
        • if your program uses any of the following, chr() function, the ord() function,
         tuples, list comprehension, or nested functions (i.e., closures & decorators),
         you will receive a zero
        • any submission that significantly deviates from the assignment will receive
         a zero.
        Rubric for Implementation
        • Requirements. All specified requirements have been met (15 points)
        • Functions. The solution demonstrates good use of functions; the code is reusable;
        the code is efficient without sacrificing readability; and the solution is well organised
        and easy to understand (15 points)
        • Variable & function names. The solution uses meaningful identifier names, i.e.,
        good function and variables names (5 points)
        • Comments. The solution contains function level comments; few in-line comments
        are used; and comments do not make code difficult to read/understand (5 points)
        4Late Submission Policy
        All coursework must be submitted on time. If you submit coursework late and have not
        applied for an extension or have not had a mitigating circumstances claim upheld, you
        will have an automatic penalty applied. If you submit late, but within 24 hours of the
        stated deadline, the work will be marked, and 10 raw marks will be deducted. All work
        submitted more than 24 hours late will receive a mark of zero.
        • Any program submitted within 24 hours after the deadline will lose 10 points
        • Any program submitted after the 24 hour grace period will receive a 0


        請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp





         

        掃一掃在手機(jī)打開當(dāng)前頁
      1. 上一篇:ENG 5220代做、代寫Java/Python/c++程序
      2. 下一篇:小花分期自動(dòng)下款怎么客服?小花分期客服電話是什么?
      3. 無相關(guān)信息
        合肥生活資訊

        合肥圖文信息
        急尋熱仿真分析?代做熱仿真服務(wù)+熱設(shè)計(jì)優(yōu)化
        急尋熱仿真分析?代做熱仿真服務(wù)+熱設(shè)計(jì)優(yōu)化
        出評 開團(tuán)工具
        出評 開團(tuán)工具
        挖掘機(jī)濾芯提升發(fā)動(dòng)機(jī)性能
        挖掘機(jī)濾芯提升發(fā)動(dòng)機(jī)性能
        海信羅馬假日洗衣機(jī)亮相AWE  復(fù)古美學(xué)與現(xiàn)代科技完美結(jié)合
        海信羅馬假日洗衣機(jī)亮相AWE 復(fù)古美學(xué)與現(xiàn)代
        合肥機(jī)場巴士4號線
        合肥機(jī)場巴士4號線
        合肥機(jī)場巴士3號線
        合肥機(jī)場巴士3號線
        合肥機(jī)場巴士2號線
        合肥機(jī)場巴士2號線
        合肥機(jī)場巴士1號線
        合肥機(jī)場巴士1號線
      4. 短信驗(yàn)證碼 酒店vi設(shè)計(jì) deepseek 幣安下載 AI生圖 AI寫作 aippt AI生成PPT 阿里商辦

        關(guān)于我們 | 打賞支持 | 廣告服務(wù) | 聯(lián)系我們 | 網(wǎng)站地圖 | 免責(zé)聲明 | 幫助中心 | 友情鏈接 |

        Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網(wǎng) 版權(quán)所有
        ICP備06013414號-3 公安備 42010502001045

        久久久久久久99精品国产片| 国产国产精品人在线视| 精品久久国产一区二区三区香蕉| 无码人妻精品一区二区三 | 国产成人精品无码专区| 亚洲国产精品无码一线岛国| 国产精品久久久精品三级| 久久精品国产9久久综合| 国产99视频精品草莓免视看| 99精品国产成人a∨免费看| 伊人久久大香线蕉精品不卡| 中文字幕精品一二三四五六七八 | 99re6这里有精品热视频| 日韩精品内射视频免费观看| 网友自拍区视频精品| 日韩精品成人一区二区三区| 日韩亚洲国产综合高清| 国产精品第一区揄拍| 久久精品免费电影| 日韩一级在线播放免费观看| 四虎国产精品免费久久| 亚洲精品综合一二三区在线| 好湿好大硬得深一点动态图91精品福利一区二区| 99久久综合国产精品免费| 伊人久久精品线影院| 久久这里有精品视频| 精品乱人伦一区二区| 国产精品白丝喷水在线观看者相| 99热在线只有精品| 国内精品久久国产大陆| 日韩一级二级三级| 国拍在线精品视频免费观看| 少妇人妻偷人精品视频| 国内大量偷窥精品视频| 日本精品一区二区久久久| 国产午夜久久精品| 精品久久久中文字幕| 99久久久国产精品免费无卡顿 | 亚洲精品国产免费| 久久精品九九热无码免贵| 香蕉久久综合精品首页|