Himalaya_'s blog

By Himalaya_, history, 7 months ago, In English

Hello Codeforces!

Like many of you, I struggle to visualize grid/coordinate geometry problems when I don't have a pen and paper handy. Debugging DFS/BFS paths or complex geometry on a blank screen is painful.

I couldn't find a simple, lightweight tool that did exactly what I wanted, so I built CP Grid Visualizer.

It's a single-file, browser-based tool to instantly plot points and lines on an infinite grid.

Link: https://himalaya-pahar.github.io/cp-grid-visualization/

github repo: https://github.com/himalaya-pahar/cp-grid-visualization

Features:

  • Infinite Grid: Handles negative coordinates and large ranges easily.

  • Fast I/O: Left-click to add points. Click any two points to draw a line.

  • Interactive: Click points to connect them with lines.

  • Precision Control: Switch between Snap-to-Grid (Integers) and Decimal Mode (Floats) instantly.

  • Safe Mode: Toggle "Allow Adding Points" OFF to lock the board and prevent accidental clicks.

  • Fast Edit: Right-Click any point to delete it instantly.

  • Live Distances: Hover over any line to see Manhattan & Euclidean lengths instantly.

  • Export: One-click "Download Image" to save your visualization (great for editorials or asking for help).

  • Dark Mode: Because we are programmers.

How to use:

  • Add Point: Left-click empty space (or type coordinates in the sidebar).

  • Connect: Click Point A, then Click Point B to draw a line.

  • Delete: Right-Click any point to remove it instantly.

  • Navigate: Drag to pan, Scroll to zoom.

  • Settings: Use the sidebar to Lock the board or switch to Decimal mode.

UI of CP Grid Visualizer

My Visualizer UI

Visualizing the third sample case for 2193F — Pizza Delivery. Calculated the optimal path visually in seconds

My Visualizer UI

Problem link: https://codeforces.me/contest/2193/problem/F

I kept it very simple (just HTML/JS) so it's fast and works offline if you save the file.

Let me know if you find any bugs or have feature requests!

  • Vote: I like it
  • +235
  • Vote: I do not like it

»
7 months ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

Great job! Do u want to make a service from your MVP?

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it +8 Vote: I do not like it

    Thanks! Honestly, I just built this to fix my own struggle with geometry problems. I haven't thought that far ahead. Just happy if it helps others!

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

honestly good stuff!!!

»
7 months ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

Things nobody asked for but everybody needs

Very good job

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

This is pretty useful!

one thing -- an ability/toggle to be able to click to add or drag points would be amazing

»
7 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

cool! i have a suggestion: maybe clicking on two points could show their manhattan and euclidean distance.

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Himalaya_ (previous revision, new revision, compare).

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Himalaya_ (previous revision, new revision, compare).

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

nice but can u make this more easy like instead of enterin one by one enterin an hole case like

1 1

2 2

3 3

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    You're right, that could save time. However, test case structures vary from problem to problem, which is why I stuck to adding points one by one.

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Honestly amazing work! You could even add a graph mode, which shows all the nodes and the distances between them to visualize graphs. Like this one

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Finally someone did it

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Thanks! Good tool

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

orz

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

very helpful good job, also could you add ctrl + z to remove recently added points ?

  • »
    »
    7 months ago, hide # ^ |
     
    Vote: I like it +8 Vote: I do not like it

    Thanks for the suggestion. You can do it now.

    • »
      »
      »
      7 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      good work, i also suggest that instead of left clicking a line to delete it, its right click

      because if you wanted to add a new point on top of a line as of right now you are forced to left click the line therefore removing it

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

this is exactly what I need to prepare for MO

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Himalaya_ (previous revision, new revision, compare).

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Very helpful. Awesome job!

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Also, can u add the feature to add a list of points (and lines also maybe)

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Nice. When already clicking on a vertex, and you drag out a new line, if you click it removes it, could you add an option to automatically place a new point and connect the current line to the new point instead?

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Thanks it really helpful!

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

amazing

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Very nice! Could you add a toggle for "Connect bulk input points in order"?

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

this is great! definitely using this for future cf problems

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

i have a suggestion: make a save code

»
7 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

This is peak