Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow slides that are not orthogonal or diagonals #66

Merged
merged 64 commits into from
Jul 22, 2024

Conversation

Idonotus
Copy link
Contributor

@Idonotus Idonotus commented Jul 11, 2024

Should implement #11

Pieces can slide along lines that aren't diagonal. This implements fairy riders like the knightrider. All slides use organized lines to implement slides quickly

TODO:

  • Generate legal slide lines
  • Implement checkdetection
  • Allow for line step multiples
  • Optimize organized lines by tracking needed lines
  • Max slide based on steps
  • Highlightlines.js and long distance slide lines
  • Horizontal and vertical highlight lines
  • Arrows of distant sliders + fix arrows.js
  • Rewrite highlight.js to render diagonals

Clean up

  • Optimize arrows
  • finetune highlighting
  • Documentation

@Naviary2
Copy link
Member

Naviary2 commented Jul 11, 2024

@Idonotus There's more complex stuff with this. Because there can be an organized line (2,0) that begins on square (0,0), and an organized line also (2,0) that begins on square (1,0). They both are (2,0), yet they are completely different and do not intersect. Because of this, the keys of the organized lines also need to specify their starting x or y intercept.

In mine and ScorpioneOrzione conversation from a while ago (scroll up to read it all), we came to the conclusion that keys would need to include the nearest (x,y) coordinate they start on after crossing, for example, the x axis. So basically, [dx,dy,x,y].

You may be able to use these, but Scorpione made these two desmos graphs that can, if I remember, take the coordinates of any piece, and auto calculate the nearest point that organized line intersects after the x/y axis!

https://www.desmos.com/calculator/d0uf1sqipn
https://www.desmos.com/calculator/t9wkt3kbfo

@Naviary2 Naviary2 added the enhancement New feature or request label Jul 12, 2024
if (!gradient) gradient = line[0]/line[1]
if (!isAproxEqual(line[0]/line[1], gradient)) return false;
for (const line of lines) {
console.log(line)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not needed anymore at this point, but is comparing the c value of the lines enough to tell if they are colinear? If c's are equal => colinear.

@Naviary2
Copy link
Member

And these as well! Are they for arrows.js?

Screen Shot 2024-07-18 at 10 17 42 PM

@Idonotus
Copy link
Contributor Author

Idonotus commented Jul 19, 2024

Is it alright if i delete this function?
From what I can see it has been replaced and doesn't work with all slopes
image
Replaced by
image

@Idonotus Idonotus requested a review from Naviary2 July 19, 2024 18:25
@Naviary2 Naviary2 merged commit 3e30956 into Infinite-Chess:main Jul 22, 2024
1 check passed
@Idonotus Idonotus deleted the exoticslides branch July 22, 2024 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants