Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Programming 1 (PRG1) SCHOOL OF INFOCOMM TECHNOLOGY Diploma in Cyber Security & Forensics Diploma in Data Science Diploma in Immersive Media Diploma in Information Technology Common ICT Programme  ASSIGNMENT   Due on 9 August 2021 (Monday), 2359 hours       Weightage:                         30% of Module   Individual/Team/Both: Individual                 Format:                                Programming and Presentation                                                 Basic Requirement (80%)                                                 Additional Requirement (20%)                                                   Penalty for late submission:        •             10% per day from the due date

Programming 1 (PRG1) SCHOOL OF INFOCOMM TECHNOLOGY Diploma in Cyber Security & Forensics Diploma in Data Science Diploma in Immersive Media Diploma in Information Technology Common ICT Programme  ASSIGNMENT   Due on 9 August 2021 (Monday), 2359 hours       Weightage:                         30% of Module   Individual/Team/Both: Individual                 Format:                                Programming and Presentation                                                 Basic Requirement (80%)                                                 Additional Requirement (20%)                                                   Penalty for late submission:        •             10% per day from the due date

Computer Science

Programming 1 (PRG1)

SCHOOL OF INFOCOMM TECHNOLOGY

Diploma in Cyber Security & Forensics

Diploma in Data Science

Diploma in Immersive Media

Diploma in Information Technology

Common ICT Programme

 ASSIGNMENT

 

Due on 9 August 2021 (Monday), 2359 hours

 

 

 

Weightage:                         30% of Module

 

Individual/Team/Both: Individual

               

Format:                                Programming and Presentation

                                                Basic Requirement (80%)

                                                Additional Requirement (20%)

                                               

 

Penalty for late submission:       

•             10% per day from the due date.

•             NO submission shall be entertained after 7 calendar days of the due date.

 

 

There are a total of 15 pages (including this page) in this handout.

 

 

WARNING

 

If a student is found to have submitted work not done by him/her, he/she will not be awarded any marks for this assignment. Disciplinary action will also be taken.

Similar action will be taken for the student who allows other student(s) to copy his/her work.

 

 

1.  OBJECTIVE

 

This assignment assesses the student’s ability to apply relevant programming concepts to develop a simple application using Python programming language.

 

2.  BACKGROUND

 

Develop a city-building strategy game called Simp City.

 

3.  SCOPE

 

You are the mayor of Simp City, and you want to build the happiest and most prosperous city possible, i.e., score the most points.

 

This city-building strategy game is played over 16 turns. In each turn, you will build one of two randomly-selected buildings in your 4x4 city. In the first turn, you can build anywhere in the city. In subsequent turns, you can only build on squares that are connected to existing buildings. The other building that you did not build is discarded.

 

Each building scores in a different way. The objective of the game is to build a city that scores as many points as possible.

 

There are 5 types of buildings, with 8 copies of each:

•             Beach (BCH): Scores 3 points if it is built on the left or right side of the city, or 1 point otherwise

•             Factory (FAC): Scores 1 point per factory (FAC) in the city, up to a maximum of 4 points for the first 4 factories. All subsequent factories only score 1 point each.

•             House (HSE): If it is next to a factory (FAC), then it scores 1 point only. Otherwise, it scores 1 point for each adjacent house (HSE) or shop (SHP), and 2 points for each adjacent beach (BCH).

•             Shop (SHP): Scores 1 point per different type of building adjacent to it.

•             Highway (HWY): Scores 1 point per connected highway (HWY) in the same row.

 

See Section 4 part 4 for more information on how these buildings score.

 

The assignment consists of “Basic Requirements” and “Advanced Requirements” as described in sections 4 and 5 respectively. You are advised to complete the basic requirements BEFORE proceeding with the advanced requirements. 

 

For this assignment, you are expected to:

•             Understand the problem completely and plan your program layout before you start coding

•             Develop the solution for each task by using functions

•             Functions developed should be as generic as possible - values used in functions should be passed in as the function parameters

•             You may use global variables sparingly

•             Implement and test each feature as it is developed  

4.  BASIC REQUIREMENTS 

 

The application should provide the following basic features:

 

1.            Display main menu

When the program is first run, it should display the main menu as shown in Figure 1.  When a user enters an option 1, 2 or 0, the program will process the option accordingly.

 

Welcome, mayor of Simp City!

----------------------------

1. Start new game

2. Load saved game

 

0. Exit

Your choice?

Figure 1 - Main Menu

 

1.1.         Start New Game

This option starts a new game. The player is given an empty 4x4 board; the building “pool” is initialized with 8 copies of each building (40 buildings in total); and two buildings are randomly selected from the pool:

 

Your choice? 1

 

Turn 1

     A     B     C     D 

  +-----+-----+-----+-----+

 1|     |     |     |     |

  +-----+-----+-----+-----+

 2|     |     |     |     |

  +-----+-----+-----+-----+

 3|     |     |     |     |

  +-----+-----+-----+-----+

 4|     |     |     |     |

  +-----+-----+-----+-----+

1. Build a HSE

2. Build a BCH

3. See remaining buildings

4. See current score

 

5. Save game

0. Exit to main menu

Your choice?

Figure 1.1 – New Game

 

1.2.         Load Saved Game

This option reads the save file and restores the game state. Since you can only save one game.

 

1.3.         Exit Game

This option quits the game and exits.

 

2.            Playing the Game

 

When you are playing the game, it should display the game menu as shown in Figure 1.1.  When a user enters an option from 1 to 5 (or 0), the program will process the option accordingly.

 

2.1.         Build a Building

When the player chooses option 1 or 2, the game will ask for a location expressed as a letter-number pair.

 

Your choice? 1

Build where? b2

 

Turn 2

     A     B     C     D 

  +-----+-----+-----+-----+

 1|     |     |     |     |

  +-----+-----+-----+-----+

 2|     | HSE |     |     |

  +-----+-----+-----+-----+

 3|     |     |     |     |

  +-----+-----+-----+-----+

 4|     |     |     |     |

  +-----+-----+-----+-----+

1. Build a SHP

2. Build a SHP

3. See remaining buildings

4. See current score

 

5. Save game

0. Exit to main menu

Your choice?

Figure 2.1a – Building on Turn 1

 

The player may build on any square on Turn 1. In subsequent turns, buildings must be built orthogonally adjacent to existing buildings.

 

Your choice? 2

Build where? c3

You must build next to an existing building.

 

Turn 2

     A     B     C     D 

  +-----+-----+-----+-----+

 1|     |     |     |     |

  +-----+-----+-----+-----+

 2|     | HSE |     |     |

  +-----+-----+-----+-----+

 3|     |     |     |     |

  +-----+-----+-----+-----+

 4|     |     |     |     |

  +-----+-----+-----+-----+

1. Build a SHP

2. Build a SHP

3. See remaining buildings

4. See current score

 

5. Save game

0. Exit to main menu

Your choice?

Figure 2.1b – Illegal placement: not next to existing building

 

2.2.         See Remaining Buildings

When the player chooses option 3, a list of buildings still remaining in the “pool” is displayed.

 

Your choice? 3

 

Building           Remaining

--------           ---------

HSE                7

FAC                8

SHP                6

HWY                8

BCH                7

Figure 2.2 – See Remaining Buildings

2.3.         See Current Score

This shows the current score of the player if the game were to end now.

 

Turn 8

     A     B     C     D

  +-----+-----+-----+-----+

 1|     | HWY |     |     |

  +-----+-----+-----+-----+

 2|     | SHP | HSE | BCH |

  +-----+-----+-----+-----+

 3|     | HSE | HSE | BCH |

  +-----+-----+-----+-----+

 4|     |     |     |     |

  +-----+-----+-----+-----+

1. Build a SHP

2. Build a HSE

3. See remaining buildings

4. See current score

 

5. Save game

0. Exit to main menu

Your choice? 4

 

HSE: 4 + 2 + 4 = 10

FAC: 0

SHP: 2 = 2

HWY: 1 = 1

BCH: 3 + 3 = 6

Total score: 19

Figure 2.2 – See Current Score

 

2.4.         Save Game

This saves the current state of the game, so that after the player quits the game, they can return to the current state by selecting “Load Saved Game” in the main menu (see 1.2).

 

Enter choice: 5

 

Game saved!

Figure 2.3 – Save Game

 

2.5.         Exit to Main Menu

This option ends the current game and returns to the main menu.

 

Your choice? 0

 

1. Start new game

2. Load saved game

 

0. Exit

Your choice?

Figure 2.4 – Save to Main Menu

 

3.            End of Game

 

When the player fills up the board after Turn 16, the score will be computed and displayed.

 

Turn 16

     A     B     C     D 

  +-----+-----+-----+-----+

 1| SHP | SHP | HSE |     |

  +-----+-----+-----+-----+

 2| BCH | HSE | HSE | BCH |

  +-----+-----+-----+-----+

 3| BCH | SHP | HSE | HSE |

  +-----+-----+-----+-----+

 4| HWY | HWY | HWY | HWY |

  +-----+-----+-----+-----+

1. Build a HWY

2. Build a FAC

3. See remaining buildings

 

4. Save game

0. Exit to main menu

Your choice? 2

Build where? d1

 

Final layout of Simp City:

     A     B     C     D 

  +-----+-----+-----+-----+

 1| SHP | SHP | HSE | FAC |

  +-----+-----+-----+-----+

 2| BCH | HSE | HSE | BCH |

  +-----+-----+-----+-----+

 3| BCH | SHP | HSE | HSE |

  +-----+-----+-----+-----+

 4| HWY | HWY | HWY | HWY |

  +-----+-----+-----+-----+

HSE: 1 + 5 + 5 + 3 + 3 = 17

FAC: 1 = 1

SHP: 2 + 2 + 3 = 7

HWY: 4 + 4 + 4 + 4 = 16

BCH: 3 + 3 + 3 = 9

Total score: 50

Figure 3 – End of Game

 

The game will then return to the main menu.

 

4.            Additional Clarifications on Buildings

 

4.1.         Beach (BCH)

A Beach (BCH) scores 3 points if it is built in column A or column D, or 1 point otherwise.

 

4.2.         Factory (FAC)

A Factory (FAC) scores 1 point per factory (FAC) in the city, up to a maximum of 4 points for the first 4 factories; all subsequent factories only score 1 point each. For example,

•             If there are 3 factories in the city, each factory will score 3 points, for a total of 3+3+3 = 9 points.

•             If there are 5 factories in the city, the first 4 factories will score 4 points each while the 5th factory will score 1 point, for a total of 4+4+4+4+1 = 17 points.

 

4.3.         House (HSE)

If a House (HSE) is next to a factory (FAC), then it scores 1 point only. Otherwise, it scores 1 point for each adjacent house (HSE) or shop (SHP), and 2 points for each adjacent beach (BCH).

 

     A     B     C     D 

  +-----+-----+-----+-----+

 1| HWY | HWY | HWY | FAC |

  +-----+-----+-----+-----+

 2| BCH | HSE | HSE | SHP |

  +-----+-----+-----+-----+

 3| BCH | SHP | HSE | FAC |

  +-----+-----+-----+-----+

 4| HWY | FAC | HWY | HWY |

  +-----+-----+-----+-----+

HSE: 4 + 3 + 1 = 8

 

In the above example,

•             The HSE at B2 scores 2 points for being next to the BCH at A2, 1 point for being next to the HSE at C2, and 1 point for being next to the SHP at B3, for a total of 2+1+1 = 4 points.

•             The HSE at C2 scores 3 points for being next to two HSE and one SHP. It does not score any points for being next to a HWY.

•             The HSE at C3 scores only 1 point as it is next to a FAC at D3.

4.4.         Shop (SHP)

A Shop (SHP) scores 1 point per different type of building adjacent to it.

 

     A     B     C     D 

  +-----+-----+-----+-----+

 1| HWY | HWY | HWY | FAC |

  +-----+-----+-----+-----+

 2| BCH | HSE | HSE | SHP |

  +-----+-----+-----+-----+

 3| BCH | SHP | HSE | FAC |

  +-----+-----+-----+-----+

 4| HWY | FAC | HWY | HWY |

  +-----+-----+-----+-----+

SHP: 4 + 3 = 7

 

In the above example,

•             The SHP at D2 scores 2 points for being next a FAC at D1 and a HSE at C2. The additional FAC at D3 does not add to the score.

•             The SHP at B3 scores 3 points for being next to a HSE, a BCH and a FAC.

 

 

4.5.         Highway (HWY)

A Highway (HWY) scores 1 point per connected highway (HWY) in the same row (not column).

 

     A     B     C     D 

  +-----+-----+-----+-----+

 1| HWY | HWY | HWY | FAC |

  +-----+-----+-----+-----+

 2| BCH | HSE | HSE | SHP |

  +-----+-----+-----+-----+

 3| BCH | SHP | HSE | FAC |

  +-----+-----+-----+-----+

 4| HWY | FAC | HWY | HWY |

  +-----+-----+-----+-----+

HWY: 3 + 3 + 3 + 1 + 2 + 2 = 14

 

In the above example,

•             The three HWY at A1, B1 and C1 score 3 points each as they are all part of a 3-square highway.

•             The HWY at A4 scores 1 point. Even though it is in the same row as the HWY at C4 and D4, they are not connected.

•             The HWY at C4 and D4 score 2 points each.

 

 

5.            Program documentation

The program should have sufficient comments, which includes your name, class, date, overall description of what the program does, as well as the description of the functions.

 

                6.  ADVANCED REQUIREMENTS

 

•             Program validation -- 10 marks

Add appropriate validation for the basic requirements of the program.

 

•             Show High Scores -- 10 marks

Add an option 3 to the main menu to list the top 10 players who have played the game in descending order of score.

1. Start new game

2. Load saved game

3. Show high scores

 

0. Exit

Your choice? 3

 

--------- HIGH SCORES ---------

Pos Player                Score

--- ------                -----

 1. Never                    56

 2. Gonna                    53

 3. Give                     52

 4. You                      52

 5. Up                       51

 6. Gonna                    50

 7. Let                      49

 8. You                      49

 9. Down                     48

-------------------------------

 

If the player scores enough points to get into the top score list, the program prompts for a name and updates the high score list accordingly. Note that if the player’s score is equal to another score that is already on the board, the new score is considered lower.

 

Turn 16

     A     B     C     D 

  +-----+-----+-----+-----+

 1| SHP | SHP | HSE |     |

  +-----+-----+-----+-----+

 2| BCH | HSE | HSE | BCH |

  +-----+-----+-----+-----+

 3| BCH | SHP | HSE | HSE |

  +-----+-----+-----+-----+

 4| HWY | HWY | HWY | HWY |

  +-----+-----+-----+-----+

1. Build a HWY

2. Build a FAC

3. See remaining buildings

 

4. Save game

0. Exit to main menu

Your choice? 1

Build where? d1

 

Final layout of Simp City:

     A     B     C     D 

  +-----+-----+-----+-----+

 1| SHP | SHP | HSE | HWY |

  +-----+-----+-----+-----+

 2| BCH | HSE | HSE | BCH |

  +-----+-----+-----+-----+

 3| BCH | SHP | HSE | HSE |

  +-----+-----+-----+-----+

 4| HWY | HWY | HWY | HWY |

  +-----+-----+-----+-----+

HSE: 2 + 5 + 5 + 3 + 3 = 18

FAC: 0

SHP: 2 + 2 + 3 = 7

HWY: 1 + 4 + 4 + 4 + 4 = 17

BCH: 3 + 3 + 3 = 9

Total score: 51

Congratulations! You made the high score board at position 6!

Please enter your name (max 20 chars): Never

 

--------- HIGH SCORES ---------

Pos Player                Score

--- ------                -----

 1. Never                    56

 2. Gonna                    53

 3. Give                     52

 4. You                      52

 5. Up                       51

 6. Never                    51

 7. Gonna                    50

 8. Let                      49

 9. You                      49

10. Down                     48

-------------------------------

 

•             Additional features – up to 10 BONUS marks

You may gain up to 10 bonus marks if you implement additional features to improve the game. Examples include:

 

o             Park (PRK) – A Park is a new type of building depending on how many parks are connected to each other (both horizontally and vertically). The score for a Park is given by the following table:

 

Size        1              2              3              4              5              6              7              8

Score     1              3              8              16           22           23           24           25

 

Note that the score given above is for the entire Park, not for each Park building, so a 4-square Park scores 16 in total, not 16 per building.

 

o             Monument (MON) – A Monument is a new type of building. If it is not built on a corner square (i.e., A1, A4, D1 or D4), it scores 1 point. If it is built on a corner square, it scores 2 points. However, if there are at least 3 monuments in the city that are built on corner squares, then all monuments score 4 points each (including those that are not built on corner squares).

 

o             Choose Building Pool – If you implement additional building types (such as Parks or Monuments given above), provide an option to let the player choose which 5 buildings to use in their game. There will always be 5 building types, 8 copies each.

 

o             Always Show Buildings Remaining – Instead of having “See Remaining Buildings” as a separate option during play, modify the code such that the information on remaining buildings is always shown to the right of the board.

 

o             Choose City Size – Instead of always having the city be a 4x4 grid, allow the player to determine the dimensions of the city. Note that you will have to adjust the number of available buildings appropriately, and you should also implement a different high score board for all the different city sizes.

 

 

Note:

•             You are expected to follow naming conventions introduced in this module.

•             You are encouraged to implement all the basic features before you implement the advanced features.

•             You should think carefully what input is required for each option if there is any.

•             You are allowed to customize your own output for the advanced features.

•             You are required to present your solution to your tutor. Your tutor may ask your questions to verify and assess your understanding of your work. Your tutor may ask you to make some changes to your program to handle another similar feature.

•             NO MARKS will be awarded for the advanced features if all the basic features have NOT been fully implemented (and fully working).

•             Marks will be deducted if you are not able to show your understanding of the program, both basic and advanced features (if applicable), during the presentation. 

 

 

                6.  DELIVERABLES

 

•             Name the file "S10009999A_Assignment.py" where "S10009999A" is your student ID.

 

•             Submit your program into MeL > Assignment > Assignment Submission by 9 August 2021, 2359 hours.

 

•             Demonstrate your application to your tutor during your PRG1 lessons (and other timeslots scheduled by tutor) starting 10 August 2021.

 

 

                7.  ASSESSMENT

 

This assignment constitutes 30% of this module. 

 

Performance Criteria for grading the assignment is as described below. Marks awarded will be based on program code as well as student’s degree of understanding of work done as assessed during the presentation.

 

A Grade 

 

•             Program implements the Basic Requirements with input validation successfully

•             Program implements the Advanced Requirements successfully

•             Program demonstrates good design with the correct use of functions

•             Program complete with good documentation

•             Program has been tested adequately

•             Program is coded with good application of fundamental concepts

•             Excellent demonstration of program and showing excellent understanding of work done during presentation 

 

 

B Grade 

 

•             Program implements the Basic Requirements with input validation successfully

•             Program implements the Advanced Requirements with partial success

•             Program demonstrates good design with the correct use of functions

•             Program complete with good documentation

•             Program has been tested adequately

•             Program is coded with good application of fundamental concepts

•             Good demonstration of program and showing good understanding of work done during presentation 

 

 

C Grade 

 

•             Program implements the Basic Requirements with input validation successfully

•             Program demonstrates good design with the use of functions

•             Program complete with some documentation

•             Program has been tested adequately

•             Some demonstration of program and showing some understanding of work done during presentation 

 

 

D Grade 

 

•             Program implements the Basic Requirements successfully

•             Program complete with some documentation

•             Program has been tested adequately

•             Able to answer some questions during presentation

 

 

name contains what is entered, the ser is asked to choose the correct employee.

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE