Giter Club home page Giter Club logo

csc2s-a2's Introduction

Falling Words - Java Parallelism and Concurrency Assignment 2

A multithreaded typing game implemented in Java, ensuring both thread safety and sufficient concurrency. The game operates as follows:

  • When the start button is pressed, a specified number of words start falling from the top of the panel, but fall at different speeds โ€“ some faster, some slower.
  • Words disappear when they reach the red zone, whereupon the Missed counter is incremented by one and a new word starts falling (with a different speed).
  • The user attempts to type all the words before they hit the red zone, pressing enter after each one.
  • If a user types a word correctly, that word disappears, the Caught counter is incremented by one, and the Score is incremented by the length of the word. A new word then starts falling (with a different speed).
  • If a user types a word incorrectly, it is ignored.
  • The game continues until the specified maximum number of words is reached (whereupon a suitable message is displayed) or the user presses the End button. The user can then play again, beginning a new game by pressing the Start button.
  • The user presses the Quit button to end the game.

Input

The program takes the following command-line parameters:

  • - The number of words that will fall
  • - The number of words displayed at any point
  • - The name of a file containing a list of words (one per line) to be used as a dictionary for generating words. The first line of the file will be the total number of words in the file.

Controls

The program has the following buttons:

  • Start/Restart button (starts a game from scratch)
  • Pause button (halts game but does not quit)
  • Quit button

Code Architecture

The program follows the Model-View-Controller pattern for user interfaces. The model comprises the classes WordDictionary, the array of WordRecords, and the Score. The view is the GUI and the controllers are the threads that alter the model and the view, moving the word positions, performing animation, adding and removing words as necessary, and updating the counters and the score.

Credits

Wordlist obtained from https://github.com/dwyl/english-words

csc2s-a2's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.