use JavaFX to add a graphical user interface

Assignment Help Programming Languages
Reference no: EM132307635

Java Programming Assignment

Your solution must be clearly separated into two separate parts, in separate Java packages:

• Part 1: (in moduleboardgame_engine): your Game Engineclasses with Unit Tests.
• Part 2: (in moduleboardgame-gui): a JavaFX GUI that allows users to play your game.

Overview
Your first task is to choose a simple one-player, two-dimensional (2D) boardgame, and then implement the 'engine' of that game in Java. You should write some unit tests to check that your game logic works correctly.

You second task is to use JavaFX to add a graphical user interface (GUI) to your game, which displays the 2D board and allows the user to play the game. So you must keep the basic game idea fairly simple, and ensure that it is not too hard to add the GUI to it.You MUST use JavaFX, not any other Java GUI libraries.

Learning Objectives
1. Learn to use object-oriented design (OOD) to design Java programs;
2. Be able to use inheritance and subtyping relationships between classes;
3. Be able to use association or composition relationships between classes;
4. Be able to develop a comprehensive suite of unit tests for the core logic classes of an application (e.g., for the game engine);
5. Build simple graphical user interfaces using JavaFX.

Choice of Game
Your game needs to be a simple 2D game that uses a discrete 2D grid for the playing board, like a chessboard, a Tetris board, a Crosswords board, or a maze.

You must choose one of the following games (from

1. Car Champ. A puzzle involving moving cars around to escape.
2. Word Grid. Like crosswords, but with a given set of words.
3. Minesweeper. A well-known logic puzzle.
4. Peggy. A bit like draughts/checkers but simpler.
5. Columns. This is like the classic Tetris game, but simpler. Or you could do ColorLines, which is also similar, but you will have to implement a 'path-finding' algorithm to move the balls around.
6. Raku. A color-flipping puzzle.
7. Sokoban. A block-pushing puzzle.
8. Concentration memory game

Part 1: Game Engine

1. Set up your GitRepository.When you click on the Blackboard link for this assignment, you will automatically create your own private GitHub repository containing two simple modules: boardgame_engine and boardgame-gui.
a. Clone this repository onto your computer using IntelliJ.
b. Make sure you also have Java JDK 11 installed on your computer.

2. Check you canrun JavaFX.I have set up the boardgame-gui project to use the 'Gradle' build tool, which means that it should automatically download and install the necessary JavaFX and JUnit libraries when you build and run the project on each new computer.(You may see a popup message down the bottom of IntelliJ: "Gradle projects need to be imported". Click on "Enable Auto-Import" and IntelliJ will automatically download and install JavaFX for you! If IntelliJ asks you for the location of Gradle, you may need to turn off the "Use local gradle distribution" and select the alternative option: "Usegradle 'wrapper' task configuration" - this uses the gradle that is built into IntelliJ). Run the RunGame class to check that you can run the GUI - it should show a simple GUI with a single button that says: "Amazing Board Game coming soon...". (If this does not work on your computer, then follow the same steps that you did in Task 1 to create a JavaFX library and add it to your project (See Blackboard / Learning Materials / Resources and Links if you need instructions). Then check that you can run RunGame.java.)

3. Data Design Decisions:Think carefully about whether each cell in your board should be a primitive value (like a boolean, an integer, or an enum value), or should it be an object? Using objects is more flexible, since it allows you to use Java subtyping to make different cells have different behaviour. But many of the games suggested above do not require the cells to have fancy behaviour, so a primitive value might be sufficient for your game.

4. Implement and Test Your Game Engine:I strongly suggest that you use TDD to develop your unit tests and game engine at the same time, in parallel. Recall: Write a test for each new feature and check that it fails, then implement that feature in your engine classes and rerun the test to check that it now passes. Repeat... You can refactor (rename and reorganise) your code at any stage, if you see a way of making it simpler and more elegant. By the time you have finished implementing your game engine, one (or several) of your tests should be stepping through a complete game from start to end, calling the methods of your engine API and checking the results, including the game win/lose verdict at the end.

5. Class Relationships:To get high marks, your engine needs to include several Java classes, with some association/composition relationships between them, and if possible, some inheritance relationships. Think about where you can best use these Java features.

Part 2: Game GUI

The goal of this stageis to use JavaFX to add an elegant and fully functional GUI to your game so that it can more easily be played on desktop computers. Your GUIshould have the following features:
• event-handling of mouse and/or keyboard events;
• display of bitmap images (I recommend you use some large images for the background of the whole game or each panel, so that the game looks professional and entertaining);
• multiple panels, with a main gaming panel to display the game, plus one or more panels around the edges to display game options, score information, and control and help buttons etc.;
• correct resize behaviour when the user adjusts the main window to different sizes for different devices;
• a clean separation between theback-end (game engine) and front-end (GUI) classes using different Java package names, as described above;
• [optional] use of a timer to have ongoing real-time activity in the game (for example, to make the blocks fall in the Columns game).
Start by drawing one or two paper sketches of the GUI you plan to build. Take a photo of each sketch, as you will need to include these in your final report.

Attachment:- Java Programming Assignment.rar

Reference no: EM132307635

Questions Cloud

Describe an evidence-based protocol for labor stimulation : Describe an evidence-based protocol for labor stimulation (augmentation and induction) and the nursing care management essential for the safe and compassionate.
Evaluate the importance of innovation for the long term : Evaluate the importance of innovation for the long term survival for your chosen company as well as the industry that your chosen company fits in.
Explain implications of electronic medical health records : Provide 1000 words APA written summary of at least two peer reviewed article related to electronic medical health records including a short history background.
Values referred to as organizations guiding principles : Why are values referred to as organizations guiding principles? in what sense do values constitute a directional strategy for the organization?
use JavaFX to add a graphical user interface : ICT221 Object-Oriented Programming - The University of the Sunshine Coast - choose a simple one-player, two-dimensional (2D) boardgame, and then implement
Explain the difference between the two genres : There are six different art genres listed horizontally across - African, Renaissance, Impressionism, Cubism, Surrealism, and Pop Art.
What are current best practices in corporate cybersecurity : What are current best practices in corporate cybersecurity? What does your group feel is most important when considering cybersecurity?
How does the material move you towards your final goal : How is this relevant to you, your workplace or community? Have you applied the "new" learning to your workplace or community?
Best employees has been watching basketball games : March Madness begins and one of your best employees has been watching basketball games off and on all day in a minimized browser on his computer.

Reviews

len2307635

5/16/2019 10:18:09 PM

5. [20%] Documentation (Report.docx): this should contain four sections: A. Introduction: one paragraph to explain what your game does, how a player can win the game, what features you implemented, etc. B. Your UML diagram: that shows full details of all your game engine classes, plus the GUI classesthat you have written. It should also show the main JavaFX classes you have used (just the class name is enough – you do not need to include all their data fields and methods!), and the relationships between them and your classes. You do not need to includeyour unit testing classes in your UML diagram. C. GUI sketches: that shows your original ideas for the GUI you plan to build for your game. This should be drawn by hand and then scanned or photographed and inserted into the Microsoft Word document. It just needs to be a rough sketch, possibly with some labels to show the contents of each panel or the function of certain buttons, if that is not obvious. D. Reflection: a brief discussion of what went well in your game development, any difficulties that you encountered, and what you would do differently if you were doing it again.

len2307635

5/16/2019 10:18:02 PM

4. [20%] GUI code: this will be marked using the following criteria: good use of event-driven programming; good OOD of the GUI classes with strong encapsulation of the data fields within classes; good use of inheritance and subtype polymorphism; adherence to recommended Java coding style (naming conventions, code formatting etc.); concise elegant code with no duplicated code; and good use of exception handling to catch and report any I/O or game errors.

len2307635

5/16/2019 10:17:55 PM

2. [20%] Game Engine JUnit Tests: these tests will be marked according to:how thoroughly they test all the Game Engine classes; and how well they follow correct JUnit naming conventions (eg. tests of mygame.engine.Foo.java should be in the Java source file mygame.engine.FooTest.java). 3. [20%] GUI functionality: this will be marked using the following criteria: a playable and robust game; good use of JavaFX widgets, layout panes, and controls to build an elegant and functional user interface; appropriate use of bitmap images in the GUI; good resize behaviour when the main window is resized; and saving/restoring of games states or high score tables. This will also demonstrate that your textual user interface still works after you have added the GUI.

len2307635

5/16/2019 10:17:48 PM

Your submission will be marked using the following criteria: 1. [20%] Game Engine Java code: this will be marked using the following criteria: good OOD of the game engine classes with strong encapsulation of the data fields within classes; correct implementation of association or composition relationships between classes; good use of inheritance and subtype polymorphism; good choice of data structures; adherence to recommended Java coding style (naming conventions, code formatting etc.); and concise elegant code with no duplicated code.

len2307635

5/16/2019 10:17:41 PM

You must submit a single Microsoft Word Report to Blackboard, based on the report template given in the Assessment / Task 2 area on Blackboard. You do NOT need to submit your code, as we already have access to your GitHub repository. You are reminded that your submission must be completely your own individual work, in your own words, and you must correctly reference any external sources that you use in your report, or in your code.

len2307635

5/16/2019 10:17:27 PM

1. You should implement at least three levels of the puzzle. 2. You should allow the player to choose which level they want to play. 3. Your game should show a "Oops!. Try again?" message when the player is stuck. (Either as a popup Alert, or as a message on the main window). 4. Your game should keep track of the total time (NNN seconds) spent on each level and report that time when the user finally passes the level. 5. Your game should show a "You won in NNN seconds!" message when they succeed in passing the current level (visiting all empty cells). 6. To get full marks some of your levels should be different size boards (e.g. 5x5 board for an easier level and 7x7 for a harder level). 7. You should use images to make the game look more visually interesting.

Write a Review

Programming Languages Questions & Answers

  Agorithm based on the linear search to insert a new element

Describe an algorithm based on the linear search for determining the correct position in which to insert a new element in an already sorted list.

  Modularizing code and sorting techniques

Modularizing Code and Sorting Techniques-Imagine you are a part of a team that is tasked with writing a mobile application (app) that will allow users to send pictures to their friends

  Discuss the linux process

Displaying Linux Processes (Optional) Time Required: 10 minutes Objective: View processes running in Linux.

  Define a command block called circle that takesx

Define a command block called Circle that takesx, yandlength as parameters. Circle draws a 20 sided figure with the length of each side equal to length starting

  Create a math program to practice math skills

Creating a Math Program to practice Math Skills. Ask the user what type of math problem they would like (addition, subtraction, multiplication, division, modulas).

  Script that displays the results of rolling a die n times

The example in the links below shows a script that displays the results of rolling a die n times. It retains (in memory) and can display the results of all rolls. The two links below are the html and js files for this example.

  Architecting web-applications using web-services

Architecting web-applications using web-services has advantages. Forexample, you can gain increased security. Describe other advantages otherthan security gained by using web-services.

  Why script programming is particularly suited for problem

Write a Perl script to automate task - Your script will be tested against several other directories, using different combinations of parameters

  Write a program that uses a random number generator

Write a program that uses a random number generator to generate a two digit positive integer

  Write a c api program under mysql to solve database query

In earlier assignment, we created a database with the following three relation schemes, where the data type for the attributes s and p is Varchar(10) under the SQL-standard, the data type of the attribute c is Char(6) and the attribute sec is of type..

  Program display meal cost and tax amount

The program should then display the meal cost,taxAmt, and total bill respectively and use named constants Tax and tip to initialize the tax and the tip values.

  Write a complete generic program that implements the adt bag

Write a complete generic program that implements the ADT Bag using a singly-linked list. A Bag is just a container for a collection of items.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd