ameer50
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    CS 308 Final Project Team Contract Team number: 13 Team name: Hirudinea Focus: Strategy games. We are interested in strategy games because they provide us the chance to implement a wide variety of techniques (including but not limited to techniques we have learned in this class). Even better, strategy games are simple and versatile enough for us to implement various techniques on an ad-hoc basis (to demonstrate what we have learned). Extensions: checkers, chess, connect4, etc. dark mode save/load games Contract: a) We will respect each other’s ideas and work. b) We will be active members and hold each other accountable. c) If we can't meet the deadlines we will be sure to communicate to each other to minimize delays. d) If a teammate reaches out to us, we will do our best to help them understand and solve their problem. e) We will maintain strong communication throughout the project. f) We will be sure to maintain easy-to-understand APIs for fellow members. ** PLAN ** DESIGN_PLAN.md ## Introduction: We want this project to accommodate a variety of strategy-based games that consist of pieces on a rectangular grid. The most basic instances of this would be checkers, Go, and chess. The more complicated instances of this would be essentially extensions of chess, with different types of pieces that can interact with other pieces in more unique ways. In addition, more complicated versions of this archetype could include different types of cells on the board (for instance, cells that act as walls). The key components of the game will be the board, the cells, the pieces, the players, and events that correspond to players' chosen moves. The priority, then, will be to provide an easy way to specify the types and properies of pieces and cells -- this would include the conditions that must be satisfied for a piece to be 'defeated', or removed, and the conditions that must be satisfied in order for a piece to perform certain moves. To allow for this to happen, the file associated with a certain game type would have to include different 'Event' types, too. ## Overview: At a high level, we will look to implement a Board class that represents the full gameboard -- it will contain all of the Cell objects, which represent each spot on the board, and all of the Piece object, which represent the various active pieces (such as a knight in a chess). Player objects will interact with the Board to determine which options are available to make pieces perform actions and then choose an action. In order to determine the rules of the game, we will have an XMLReader parse an XML file that either represents a predetermined game type or a game type that is inputted by the user. To allow an XML file to specify types of Pieces and Events, there will ultimately have to be some structure imposed on these that can be leveraged by the XML file. We have decided that, for sufficient generality, a Piece object will have *health*, *move types*, and *status*. *Health* is straightforward -- each Piece has a certain amount of health, which can be modified by Events, and once that health reaches zero, the piece is removed from the board. *Move types* are instances of the Event class that are associated with a certain type of piece. They will be accessed to determine what a piece can do and to perform that move. *Status* is probably the most complex property of a Piece, but may be necessary in order to implement more 'exotic' games. Essentially, a status is a property that performs an Event on a Piece on each turn. This Event could be contingent on certain condions or not. The most straightforward example of this could be the 'poisoned' condition, in which a Piece loses one health each turn. The information contained in an XML file will be able to determine the number of Pieces, the types of Pieces (including names, which could be used for an enum), the properties of these types (health and move types), and the Events that are associated with particular move types and statuses. ## APIs: ### Frontend API: - GameView: - Display Winner - PieceView: * Due to the fact that animations associated with certain events are a possible extension (even though we do not plan to implement them), we should have a PieceView class associated with each Piece. In practice, this class will probably just contain an Image. The GameView would move this image or remove it from the view based on the moves that are performed. - MoveAnimation, KilledAnimation - CellView: * We plan to have the user interact with pieces by clicking on them and then viewing available moves. Part of this would include 'lighting up' cells that the piece can move to. Due to this, there would need to be a CellView class with methods that light it up or turn it off. - MoveDisplayer: * This class will take in the possible moves of a piece that is clicked on and then call various methods on the GameView to visualize moves. For instance, it could call GameView.lightUpCell(2, 3) to light up cell B3. ### Backend API: - Board (Abstract Class) - checkWon(): external; return 'true' if a player has won. - checkValidMoves(int, int): external; return valid moves the piece at the index - called when user clicks on piece - getPieceAt(int, int): external; returns the type of piece at the cell, or null if there is no cell - doMove(index, index, String): external; once a move is determined to be valid, it will move the piece at the index (using reflection on the String) and update the board - initStartingPosition(): internal; load configuration from the XML - isValidCell(index, index): internal; checks if the index is valid in the board - CellInterface - getState(): returns whether the cell is open or 'blocked' - PieceInterface - getMovePattern(): external; returns move type - getHealth(): external; returns the health of a piece (could be used in more complex games) - getValue(): external; returns the score of killing a certain page - isActive(): external; returns if the piece can be moved on this turn - changeActive(): external; makes the piece active if it is active and inactive if it is not active - PlayerInterface - isCPU(): returns true if the player is a CPU - getScore(): returns the player's current score - getName(): returns the player's name - getColor(): returns the color of their pieces - CPU - generateMove(StrategyType) ## Design Details: The controller will call isCPU() on the PlayerInterface to determine whether the move will be determined by the user or whether the controller will consult the AI. Control will be passed to the AI by calling generateMove on the CPU with the StrategyType enum. Then, doMove() will be called using the data that is returned. It will call getScore(), getName(), and getColor() in order to pass relevant information to the view. The controller will call isActive() to determine whether the user can interact with a piece. When the user clicks a piece, the controller calls getPieceAt() and checkValidMoves() to receive the moves that are possible with this piece. It will then call doMove() with the indexes of the cell that the user clicks to move to (using the string associated with the move type). On the frontend side of this, the GameDisplayer will be called by the controller with data generated from checkValidMoves(). ## Example Games: Three example games are chess, checkers, and Go. These three games are completely different in terms of the way they are played, including how the pieces operate and move, how players win and interact with one another, etc. However, our design is generalizable enough to work on any games that incorporate boards that are grids and players that move pieces. For instance, chess pieces are moved differently from checker pieces, but this can merely be accounted for by different implementations of checkValidMoves() for respective pieces in each game. Pieces can be captured in each game, and each game can have different implementations of checkWin() to indicate a player winning. ## Design Considerations: We spent time considering how to implement different types of moves. Initially we considered having different types of Piece classes that extend from a single Piece interface. However, we realized this would severely limit the customizability for the user in terms of what rules they could input. We wanted to ensure that users could take existing games like chess and make semi-significant changes to how each piece can move in the game. As a result, we decided that having a single Piece concrete class with several instantiated objects with different parameters would be a smarter move. In order to account for different types of movements, we will have users follow some sort of naming convention when defining various move patterns that will be stored in the corresponding Piece object. Then, we will use reflection in the Board class to determine what cells would be valid to move into and which cells to light up. We were deciding on the feasibility between having a single Board class that accepts the type of board game as a parameter, which would allow us to execute the board functionalities. However, we later realized how ineffective this would be as the board would need to be passed around to determine when the game was one, etc. We ultimately decided it was better to have a single Board Game Interface which would accomodate the different game types with methods such as checkWon which could check if the different games were won based on their specific criteria.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully