Giter VIP home page Giter VIP logo

clash-search's Introduction

I like learning new programming languages.

Favorites
Julia Crystal Ruby Python Svelte

Currently learning
Haskell Rust Lua RISC-V D-lang Zig

I would like to learn
Clojure Elixir Fortran Fsharp Kotlin Nim Racket

I also know


You can find me on various coding problem sites:

CodinGame | CodeWars | Exercism | Leetcode | code.golf

clash-search's People

Contributors

andriamanitra avatar reeveng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

clash-search's Issues

Searching by special characters does not work properly

There might be a way to configure MeiliSearch to handle special characters. If not, I'm unsure if there is a viable way to fix this problem...

To reproduce:

Search for "////"

Expected behavior

Maybe a few dozen results, just the ones that have //// somewhere in the test cases or statement.

What actually happened

over 1900 results (likely every single puzzle)

Some clashes are missing from the search index

A discord user spotted the following problem:

Today I tried to search "typing speed", but this clash didn't come up in the search results ("Calculate Kyle's typing speed" https://www.codingame.com/contribute/view/26516af8d3092868de55718c12320f25173a0). Any ideas why?

Checking existing clashes against the list of accepted contributions revealed that the clashes with the following ids were missing from the search index (they have since been added manually):

206742cbca985d49050b0e708d9bf432e8d6e
2492a4457aa0e8331b0d70baeb2decc41
26516af8d3092868de55718c12320f25173a0
276692c90be60fd240f56d0e2e4f3cc40a6f9
28198f4b63dbb45476b0bbae0da8dd650a9db
29022cd5093b1aa8f675b9ef3bbd929b718d5
29353d060810d75cc1e6c3c3a14b37dd46642
3050798c63b601d4b53a7034edaeb2522b70a
3060602a61121effef60eb2c061a18d431f90
308702afc9bc0b4d09c7bfa78404ec02ad984
318601dd052ee119ea6f2b5503f1284233824
323d1c75a9f600ffa1eb295049b74eefd

The root cause of the issue should be determined and tests added to make sure this can't happen again.

Add ?q= URL parameter

It would be useful to be able to use clash-search as a search engine and link directly to results of a given search.

Improve how the clash statements are rendered in HTML

Currently the descriptions get rendered as plain text, ignoring special formatting directives used by CodinGame (<<Bold>>, [[Variable]], {{Constant}}, `monospace`). It would also be a good idea to show other sections in addition to the problem statement (input/output description, constraints, test cases).

There are 2 different approaches to render the special formatting directives in a nicer way:

  1. In addition to the plaintext statement the JSON for clashes includes the full statement as HTML that could be used (although currently MeiliSearch is configured to not return it to search clients). This would require some more processing and styling, because the statement HTML includes bunch of unnecessary information and headings etc.
  2. The plaintext statement could be processed to replace the formatting directives with specific styled elements.

Make clash cards look better

Clash cards (in frontend/src/lib/ClashCard.svelte) are rather hastily put together. The paddings and margins are all over the place and the colors could be improved.

Tasks:

  • Use a different background color for input/output boxes
  • Fix the large and weird gaps around titles in the "Details" view
  • Use a couple different text colors to highlight important bits and provide clearer visual separation between titles and body text (may need to adjust app.css of the whole site)
  • Make all of the above work nicely in both light and dark mode

Pull requests are welcome, not sure when I'll have time to get to this issue myself...

Add filtering by clash type

It should be possible for users to specify (with checkboxes or something similar) which types of clashes they are looking for (fastest, reverse, shortest).

When clashes are modified they don't get updated in the db

The script to update clashes looks at timestamps under "statusHistory" key for the clash. Turns out "statusHistory" is not updated when the clash gets updated, for example when someone changes the title of a clash.

statuses = clash["statusHistory"]
clash_timestamps = [status["date"] for status in statuses]
clash_latest_update = max(clash_timestamps, default=0)
if clash_latest_update > last_updated_time:

To fix this I'm writing a new version of the update script that only looks at the "activeVersion" for the clash.

Add regular puzzle search

Currently the system is only indexing Clash of Code puzzles. The old puzzle search could also be used for regular in/out puzzles. Although this feature is probably less used than the clash search, it should not be much work to add because the JSON structure of in/out puzzles is very similar (maybe even identical?) to clashes.

TODO:

  • Update fetch script to check for new in/out puzzles too and store them on disk
  • Make sure they are added to MeiliSearch and it is correctly indexing them
  • Add a way to toggle which puzzles (clashes or in/out puzzles or both) are searched on the web page
  • Update README

Add a button to show random clash

It would be a nice feature for users who just want to play random clashes without the time pressure.

I'm unsure if Meilisearch has any way to get a random document (you could pass in a random offset but that would require knowledge of how many documents there are in total). If not then the implementation might require a separate backend service that is aware of all the clashes.

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.