Giter Club home page Giter Club logo

cstory's Introduction

Hi there šŸ‘‹

  • šŸ‘ØšŸ»ā€šŸŽ“ Assistant Professor in Information Systems @ University of Texas as Dallas, Naveen Jindal School of Management
  • šŸ‘ØšŸ»ā€šŸŽ“ Ph.D. from Carlson School of Management, Information & Decision Sciences
  • šŸ“ø Iā€™m a photographer! foto.zenan.ch
  • šŸ‘Æ Iā€™m looking to collaborate on ... anything! Shoot me an email.
  • šŸ’¬ Ask me about anything: blog.zenan.ch/ask
  • šŸ“« How to reach me: contact at zenan.ch
  • šŸ˜„ Pronouns: He/Him

cstory's People

Contributors

alanzchen avatar karashan avatar lucaschenzq avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cstory's Issues

Message natural delay

To mimic the human's typing, the message should be delayed naturally by the length of itself.

For example, message with 10 character should take 10/10 seconds to type, resulting a 1 second delay.

This should be implemented in Story class, specifically void Story::set_up_msg(Session session, long msg_time, std::string content).

But note that a challenge is that the next message from the same session should also be delayed correctly.

For example:
Message 1 was supposed to be sent at time 1. Because of the delay of 3 seconds, it will be sent at 1+3 = 4.
Message 2 was supposed to be sent at time 2. Because of the delay of 1 second, it will be sent at 2+1 = 3.

This will lead to a chaotic situation. To avoid such embarrassment, Story needs to record the cumulative delay as session.delay.

So now the situation is:

Message 1 was supposed to be sent at time 1. Because of the delay of 3 seconds, it will be sent at 1+3 = 4. Record session.delay = 3.
Message 2 was supposed to be sent at time 2. Because of the delay of 1 second, it will be sent at 2+session.delay+1 = 6. Record session.delay += 1.

Remember to reset session.delay to 0 after sending a choice!

Generate UUID

We need to generate unique ids for session, currently we use the server timestamp as the session_id for the sake of convenience when debugging, but this is in practice very problematic.

We need a function to get a string as a unique ID.

string generate_uuid();

Note that Boost already has a uuid library builtin. Try your best to leverage it.

@Karashan

Implement the "choice" functionality

The choices should be present to the client as a message. Specifically, try to give me a json object.

It should look like:

{
  "<scenario_id_1>": "å•Šå“ˆä½ č§‰å¾—å¦‚ä½•ļ¼Ÿ",
  "<scenario_id_2>": "å…¶å®žęˆ‘äøå–œę¬¢čæ™ę ·ć€‚"
}

Creating a json object is super easy:

json j;
j["<scenario_id_1>"] = "å•Šå“ˆä½ č§‰å¾—å¦‚ä½•ļ¼Ÿ";
j["<scenario_id_2>"] = "å…¶å®žęˆ‘äøå–œę¬¢čæ™ę ·ć€‚";

and the object j is what you should give me.

Story class compilation error

/Users/alan/Developer/CStory/session.cpp:55:11: error: call to implicitly-deleted copy constructor of 'Story'
    Story story = (*story_pool)[story_id];
          ^       ~~~~~~~~~~~~~~~~~~~~~~~
/Users/alan/Developer/CStory/./story.h:38:19: note: copy constructor of 'Story' is implicitly deleted because field 'story_input' has a deleted copy constructor
    std::ifstream story_input;
                  ^

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.