Code Monkey home page Code Monkey logo

lingumichallenge's Introduction

LingumiChallenge

Solution to the C# Lingumi Challenge

Testing Guidelines

All the Tests (2 at the moment) are written in ProgramTest.cs.

To Run a Test Case

Ensure the test exists in ProgramTest.cs. In the Main method of Program.cs, call the test function after instantiating the ProgramTest class.

To Create a Test

Write the test as a function that calls the sendStickers method with the appropriate arguments. Use "Debug.Assert" to check whether the obtained result is correct or not.

Responses to Questions

1. How does the algorithm work from a high-level perspective?

The algorithm accepts the two lists (Words and Word IDs of words learnt in the previous lesson) and creates a word list that has the updated values of numberOfTimesLearned for the Words that were recently learned.
Then it edits this updated list by removing words that have never been learnt.
This list is then sorted in Descending order by numberOfWordsLearned and split into two lists of Words: sent and unsent where 
- sent contains all words that have hasAlreadyCollected as True.
- unsent contains all words that have hasAlreadyCollected as False.
The algorithm then returns 3 words from these 2 lists, where priority is given to the 'unsent' list as the word stickers from that class haven't been awarded yet.

2. Why did you choose to implement the algorithm in this way?

It logically appealed to me: As someone playing the game, i'd like the opportunity to eventually earn all stickers of the words i've learned and not just any 3 random stickers from the huge list of words i've learned
throughout. By prioritising words i've never got stickers for before, that opportunity is given.
Also, it makes sense to earn stickers for a word i've learned many more times than a freshly learned word.
By combining these two thoughts, the current algorithm was created.

3. How could you improve/evolve the algorithm if given more time?

It's honestly my first time programming in C#, so I focussed mainly on getting the functionality in sync with my intended solution.
If given more time, I'd like to explore the language a lot more to understand and apply more efficient ways of writing code in C#.
With respect to the algorithm, since the guideline was open-ended in terms of the implementation, I applied the solution that seemed most appropriate to me, but there might have been something i missed. I'd like to spend a bit more time on understanding the problem completely so that i can find the best solution.
Also, I'm unaware of what kind of inputs will be actually provided to the function, so there was a limited amount of testing.

lingumichallenge's People

Contributors

jitinder avatar

Watchers

James Cloos avatar  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.