1. Homepage
  2. Programming
  3. SCC.212 Advanced Programming - Week 4 Task: Bomb Sweeper

SCC.212 Advanced Programming - Week 4 Task: Bomb Sweeper

Engage in a Conversation
Lancaster UniversitySCC.212Advanced ProgrammingBomb SweeperJava

Week 4: Bomb Sweeper

This exercise focusses upon testing and strengthening your understanding of inheritance, object references and implementing recursive algorithms. The aim is for you to gain experience of writing more algorithmically complex code in Java while maintaining code elegance through using a combination of iteration and recursion. CourseNana.COM

The Task

Your task this week is to implement the logic behind the well-known game of minesweeper. The graphical functionality has been provided for you, as has a template for a (reasonably!) elegant object model. For this task, you should only need to modify the BombSquare class, which provides a basic template for the exercise. CourseNana.COM

You are not permitted to modify the GameBoard or GameSquare classes. Restrict your work to the BombSquare class, and/or any other new classes you may wish to create. CourseNana.COM

CourseNana.COM

Task 1: Detecting Bombs

Review the Javadoc documentation for the provided classes and study the BombSquare source code. Note that the BombSquare class is a subclass ofGameSquare, which also holds application specific information. Note also that in addition to its inherited instance variables, the BombSquare class holds information on whether or not a given square contains a bomb. This is generated by a random process in the constructor, such that 1:10 squares contain a bomb. CourseNana.COM

Based on the resources provided, develop the BombSquare class such that when a square is clicked it, it obeys the following rules. Try to implement this code in as elegant a fashion as you can. CourseNana.COM

  • Displays an image of a bomb if that square has a bomb on it. CourseNana.COM

  • Displays the number of bombs in surrounding squares otherwise. Note that surrounding squares a classified as the eight squares that are horizontally, vertically or diagonally adjacent to the square. CourseNana.COM

  • Your program must work for a board of any size or shape (you can modify this in the main method in the Driver class). CourseNana.COM

Hint: You’ll need to study the methods and instance variables you have inherited from the GameSquare class… CourseNana.COM

Task 2: Expanding into Empty Space

Traditionally, minesweeper implementations enhance the playing experience by reducing unnecessary work for the player. CourseNana.COM

Using recursion, update your program such that when a square is clicked that has zero bombs in its surrounding squares, it not only reveals that square, but also any adjacent squares (horizontally, vertically or diagonally adjacent). CourseNana.COM

Portfolio Contribution

As discussed in the introductory lecture, all practical work this term will contribute to your portfolio assessment due in week 5. CourseNana.COM

This piece of work will carry marks for: CourseNana.COM

  • core functionality related to the accurate implementation of the specification and constrains described above. CourseNana.COM

  • maintaining object-oriented paradigm. Solutions following a procedural/functional paradigm will be significantly penalised. CourseNana.COM

  • scalable and extensible solutions that do not make unnecessary assumptions. CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
Lancaster University代写,SCC.212代写,Advanced Programming代写,Bomb Sweeper代写,Java代写,Lancaster University代编,SCC.212代编,Advanced Programming代编,Bomb Sweeper代编,Java代编,Lancaster University代考,SCC.212代考,Advanced Programming代考,Bomb Sweeper代考,Java代考,Lancaster Universityhelp,SCC.212help,Advanced Programminghelp,Bomb Sweeperhelp,Javahelp,Lancaster University作业代写,SCC.212作业代写,Advanced Programming作业代写,Bomb Sweeper作业代写,Java作业代写,Lancaster University编程代写,SCC.212编程代写,Advanced Programming编程代写,Bomb Sweeper编程代写,Java编程代写,Lancaster Universityprogramming help,SCC.212programming help,Advanced Programmingprogramming help,Bomb Sweeperprogramming help,Javaprogramming help,Lancaster Universityassignment help,SCC.212assignment help,Advanced Programmingassignment help,Bomb Sweeperassignment help,Javaassignment help,Lancaster Universitysolution,SCC.212solution,Advanced Programmingsolution,Bomb Sweepersolution,Javasolution,