giorgiemccombe
    • 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
    # CS50 Nuggets #### Claire Draeger, Camden Hao, Nicholas Irwin, Giorgiana McCombe - May 2021 ## Design Spec According to the [Nuggets Requirements Spec](REQUIREMENTS.md), Nuggets is a multiplayer exploration game run by a game server. The *server* is a program which runs and initializes the game, allows players to connect and quit, and keeps clients updated on the progress of the game. The *player* is a program which handles clients who wish to participate in the game, and is in charge of initializing the display and network. ### User interface The nuggets's first interface with the user is on the command-line. The user first needs to set up a server which can have either one or two command line arguments. Then, a user can initialize play or spectate the game with a separate set of either two or three command line arguments and subsequent keystroke commands. ### Inputs and outputs **Input**: In the command line the Player can input various key strokes for different purposes, see [Requirements Spec](REQUIREMENTS.md) for more detailed command line inputs. *Key Strokes*: Player `Q` quit the game. `h` move left, if possible `l` move right, if possible `j` move down, if possible `k` move up , if possible `y` move diagonally up and left, if possible `u` move diagonally up and right, if possible `b` move diagonally down and left, if possible `n` move diagonally down and right, if possible where possible means the adjacent gridpoint in the given direction is an empty spot, a pile of gold, or another player. for each move key, the corresponding Capitalized character will move as far as possible automatically and repeatedly in that direction, until it is no longer possible. Spectator `Q` quit the game. **Output**: The server is responsible for outputting a `quit` messages when a player quits or the spectator quits/is replaced. See [Requirements Spec](REQUIREMENTS.md) for detailed quit messages. When all the gold is collected the game is done and the server will send the ending message to the players ```c QUIT GAME OVER: A 4 Alice B 16 Bob C 230 Carol ``` ### Functional decomposition into modules We anticipate the following modules or functions: Server - keeps track of the current map and where the players are - Player - retrieves map from server and displays to player - holds player leter, full name, gold score, and address handleVis() - calculates what parts of the grid the player can see - Grid - gridpoint struct, for each character in the string - function to load the map file into grid struct - setters and getters for gold and player Client - handles the player/spectator, utilizes grid and player structures as well And some helper modules that provide data structures: 1. *grid*, a module providing the data structure to represent the grid for the game of NR rows and NC columns, functions to call on grid; 2. *game*, a module providing the data structure to represent the game, stores current map, players positions and scores. 3. *messages*, a module provided to send messages between server and players (provided) 4. *log*, a module provided to log messages to an output file (provided) 5. *player* struct to hold player info(address, gold score) Functions to handle messages (needed by message_loop in message.c) - handleMessage - takes the address from which the message was provided and a string containing the contents of the message. - handleTimeout - called when time passes without input or message. - handleInput - handles the input from stdin, reads once from stdin and processes it ### Pseudo code for logic/algorithmic flow The nuggets will run as follows: Server: - Parse the command line, validate parameters, and Initialize the game when prompted - Load map into grid data structure and drop gold nuggets into random spots - Initialize the network and wait for clients to join - Accepts players and one spectator to the game - Sends updated grid messages to player each time a player moves (keystroke) or gold is collected - Handles inbound messages from player - handles keystrokes or moves / when gold is picked up - handles quit messages from client - everytime server gets a message, it will update the map - update visibilitys for each player with updateVis(), then sends the grid string to cleint - the spectator alwayshas perfect visibility - If player quits, remove player’s symbol from the grid - Constantly monitors gold number, when all gold is collected, prints a tabular summary and sends a quit message to all players and exits Client: - Verify its arguments - Join as either a player (name provided) or spectator (no name provided) - Initialize the display and the network - Waits for grid message from server and upon receiving ensures display is large enough for grid - Shows the status line on the first line of display and grid on subsequent lines - Updates the display when prompted with messages from the server - If quit key is pressed, sends quit message to the server - Quits when told to do by the server - After game ends or quit, print a game over summary and exit ### Major data structures The server will implement a `hashtable` structure to store the players who are connected to the game. The player struct will contain information such as the playerID, gold score, full name, and address.The grid struct will be a 2D array of chars, each char is a point of the map (gridpoint struct) and the grid module will have different functions to allow the game to access the grid and the players at each gridpoint. The client will utilize the grid and player structs as well. ### Testing plan *Unit testing* test each module - grid - test loading grid - test creating all the gridpoints - setters and getters - use `#IFDEF` directive for testing at points such as loadMap and the getters/setters - player - test creating a player and moving it - test setters and getters - testing gold - is it at the expected value after a player picks up - messageHandler - verify messages are parsed correctly *Integration testing* - play the game a variety of different ways - use a human script to test, which is a script containing instructions for how to launch different types of games - ex) launch game, join with 20 players with 3 of them having invalid names - ex) test spectator - join with a spectator then join as spectator again to make sure the new spectator replaces the old one *System testing* 1a. Test `server` with various invalid arguments. 1. no arguments 2. three or more arguments 3. invalid `map` (non-existent path) 4. invalid `map` (not a valid grid or txt file?) 5. invalid `seed` (zero or negative integer) 6. invalid `seed` (non-integer) 1b. Test `client` with various invalid arguments 1. no arguments 2. four or more arguments 3. invalid `hostname` or IP address (not a host) 4. invalid 0. Run *nuggets* on a variety of maps. 0. Run *valgrind* on both *nuggets* and *indextest* to ensure no memory leaks or errors. ### Individual Team Member Roles Server - main = Giorgie - players = Camden - grid = Claire Client = Nick

    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