Giter Site home page Giter Site logo

neighbour-finding's Introduction

Neighbor Finding

Context

One webpage is composed using multiple carousels, one below the other. But the user can only seen one element at a time (shown in red). Also, each carousel first element is its cover element (shown in black).

To reduce server load and optimize performance and bandwidth, this webpage do not load all elements at once. It builds the pages skeleton, detects the element being viewed by the user (shown in red) and then finds its neighbors. Requesting only them (shown in darker colors).

Case 1

tile

Case 2

The user can navigate up, down, left and right. But only one card at a time. So, if the user move one element down, it would look so:

tile

Case 3

Then, if he moves two steps right, it would look like so:

tile

Case 4

But when he moves one step down again, watch that the previously active carousel continues at its current state, with the last seen card still at its last position.

tile

Case 5

So, if the user moves two steps down and one right, then one up again, it would result in the following:

tile

Exercise

Please, design the algorithm that detects the neighbors. Do not care about double loading elements, another application layer caches them. Make your code pass all the unit tests in this folder, using npm test

function findNeighbors(skeleton: Skeleton, cardIdActive: UUIDv4): UUIDv4[] {
    // code here
}

neighbour-finding's People

Contributors

weldisson 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.