首页 > > 详细

代写Programming作业、代做Python程序语言作业、代写data课程作业、代做Python实验作业 代写R语言程序|代做数据库SQL

Programming Concepts Assignment (March 2020)

The purpose of this assignment is to show how well you can develop a programming project. It will give you an opportunity to display your knowledge of the Python programming language. This assignment is marked initially with a maximum score of 100. It is then weighted to contribute 25% to your overall module assessment.

Scenario: Missile Crisis
In the early 1960s the 'Cold War' between America and the Soviet Union became the theme of some children's games. In Britain one particular example was Missile Crisis which became briefly popular until protests from indignant parents, who claimed that it trivialised a dangerous political threat to world security, led to the Home Secretary placing a ban upon further sales. The manufacturer later went into voluntary liquidation.

It is hard now to understand the concern expressed. Missile Crisis consisted simply of a colourful cardboard sheet representing two oceans separated by a narrow strait. The oceans were shown as grids of squares. The two players each initially occupied their own ocean and navigated a small plastic aircraft carrier which they could move up, down, left or right into a neighbouring square. Diagonal moves were not permitted. Each player started at the far coastline of their ocean and alternated in taking moves. However before moving their aircraft carrier they had to throw a six on a dice. If they did not achieve a six the turn immediately passed to the other player, who needed to do the same. (Some parents also complained that the game was extremely boring and unimaginative.)

The object was to reach your opponent's ocean by passing through the strait before they managed to. The first player to do this was the winner of this particular game, which then proceeded to the next highest level. Players could agree on which level they wanted to begin and which level they would stop. Levels ranged from 1 to 10.

What you have to do:

You will create your own version of Missile Crisis as a computer game. You are given some code already and have to develop it further into a game for the two players who move across an hour-glass shaped grid by entering the letters U, D, L or R (for up, down, left or right). They take alternate turns and have to throw six on a (computer) dice before they can move. They begin at opposite sides of the grid and have to reach the narrow middle section before the other in order to win. Before the game starts they must agree at which level they begin and which level they should end their game.

Here is the Python program code you will develop into a fully operational version of Missile Crisis. Your code should only appear in main(). Do not alter any of the code in the other functions. This is not necessary and will not gain any marks. (You do not have to understand the code here.)

# Missile Crisis

def dice():
# Value returned is throw of dice
import random
score = 7
while (score > 6):
N = random.random()
score = int( N * 10) + 1
return score

def move(A, B, C):
# Values pased to local variables:
# A is game level
# B is current player position
# C is direction chosen
# Value returned is new player position
D = 0
IR = A * 2 + 1
SV = 2 * A + 3
N = 0
for i in range(IR):
MP = int (IR / 2)
DEC = -2 * i
INC = 4 * (i - MP) * (i > MP)
JR = SV + DEC + INC
for j in range(JR):
N = N + 1
if (N == B):
D = i
D = D + (C == "D")
IR = A * 2 + 1
MP = int (IR / 2)
FVAL = - 2 * A
DVAL = 2 * (D - 2)
IVAL = ((D - MP) * 4 - 2) * (D > MP)
U = FVAL + DVAL - IVAL
if (C == "D"):
U = -U
if (C == "U"):
E = B + U
if (C == "D"):
E = B + U
if (C == "L"):
E = B - 1
if (C == "R"):
E = B + 1
return E

def board(A, B):
# Values passed to local variables:
# A is game level
# B is sea array
IR = A * 2 + 1
SV = 2 * A + 3
C = 0
for i in range(IR):
MP = int (IR / 2)
DEC = -2 * i
INC = 4 * (i - MP) * (i > MP)
IND = i - 2 * (i - MP) * (i > MP)
JR = SV + DEC + INC
for j in range(IND):
print chr(32),
for j in range(JR):
C = C + 1
if (i == 0 or i == IR - 1):
B[C] = 35
if (j == 0 or j == JR - 1):
B[C] = 35
print chr(B[C]),
print

def main():
sea = [126] * 717
# This section lets you test board() function
# L = input("Enter level ")
# board(L, sea)

# This section lets you test dice() function
# print("You threw a "),
# print dice()

# This section lets you test move() function
# L = input("Enter level ")
# P = input("Enter position ")
# D = raw_input("Enter direction ")
# print("New position is"),
# print move(L, P, D)

main()
Here is a screen shot showing a typical screen display produced by the program. In this test run only one player was taking part. Your program will show the paths followed by two players. You can choose any two letters to indicate the players. Neither needs to be a letter A!

Important details:

1. Your solution should be written as a Python program employing functions, with variables being passed and returned.

2. The code must be original and not copied from anywhere else.

3. Do not use object-oriented methodology.

4. After your work is submitted you might be interviewed in order to explain sections of your program.

You must upload your work to 'Turnitin' by 4.00pm on Friday in Week 10 of the semester.

The following are the four sections of your work which you will submit. They should form a single Word document, with relevant screen captures.


Section A: Explanation of the problem (30 marks)

In this section you do NOT submit any algorithms or Python code. Instead you should explain informally, in ordinary language, how your computer program will allow your computer game to achieve the objectives described above. You should describe carefully all the ideas you have had for how the program will be made to work. Although you will not present any code in this section you will talk about programming constructs like for and while loops, array locations and subscripts, calling functions, passing and returning variables etc.

Section B: Algorithms required (10 marks)

Select any one of the algorithms needed for your program and formally represent it as a flowchart.

Section C: Program code (50 marks)

Here you give your program listing. Your Python code should show that you understand how a program can achieve the following.

Input
Output
Variables and assignment
Subscripted variables (arrays)
Comments
Conditional statements
Unconditional loops
Conditional loops
Use of functions
Validation of user input

Section D: Testing of your solution (10 marks)

You should present a minimum of two screen shots indicating that you have tested your program. Comment on what the screen shot contains and how this relates to a section of the program code you have given in Section C.

Computer software is often made available for use before it is completely working! Therefore you are not necessarily expected to produce fully operating code. Instead marks will be awarded to how well you have attempted the various tasks described above.

Section A: Learning Outcomes (LO) to be assessed

LO LO Description Comment on LO attainment LO Achieved: Yes/No
A1 That computer programs are designed to solve problems

A2
The success of a program depends on how well the problem is understood and then broken down into identifiable components
A5 A programmer must ensure his program can be easily understood by other programmers with appropriate structure and annotation.

C3
Ability to troubleshoot basic (hardware and) software issues
D4 Abstraction of complex problems into manageable elements.

Section B: ILSC Study Skills Incorporated and Tested

Skills
Yes/No
Comments
Personal Development (Self-reflection, responding to feedback) NO N/A
Presentation Skills YES Flowchart in Section B, Screen capture in Section D
Listening Skills N/A
Self - Directed Study YES Working on versions of main()
Writing Skills (Accuracy, Coherence) NO N/A
Analysis and Problem Solving YES Creating appropriate loops and exit conditions
Planning Aspects (Structure, Content Development) NO N/A
Working with Others N/A N/A

Marking scheme

Section A: Explanation of the problem (30 marks)

After all of the scripts have been read initially (in order to judge how the specific cohort of students has interpreted the problem) a detailed marking scheme will be written for Section A. This will award 3 marks for each relevant explanation of aspects of i) algorithm design ii) programming concepts employed. There is a maximum of 30 for this section.

Section B: Algorithms required (10 marks)

Only ONE of these criteria will be relevant:

A: Relevant flow chart - 4 marks
B: As above plus (mostly) correct symbols – 7 marks
C: As above plus (mostly) correct logic – 10 marks

Section C: Program code (50 marks)

5 marks awarded for each of the following marking criteria up to a maximum of 50:

A: Input of data from user
B: Display of text by program
C: Assignment of values to variables
D: Use of subscripted variables (arrays)
E: Inclusion of explanatory comments
F: Use of conditional structure
G: Use of loop structure
H: Passing a value to a function
I: Returning a value from a function
J: Validation of user input

Section D: Testing of your solution (10 marks)

Any of these criteria will be relevant:

A: First screen shot – 3 marks
B: Discussion of first screen shot – 2 marks
C: Second screen shot – 3 marks
D: Discussion of second screen shot – 2 marks

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

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