neural nets.
neural nets.
@cneuralnetwork
Sep 17 7 months ago 2 tweets Read on X
AI Summary

Studying math makes coding easier! For knights on a chessboard, they threaten in an L-shape (2x3 or 3x2). There are (n-2)(n-1) such positions, and with two knights, total threats are 4(n-2)(n-1). Total safe spots = total positions minus threatened ones, calculated as n^2(n^2-1)/2 - 4(n-2)(n-1).

study math. code becomes shorter :P

Tweet image 1

logic is very simple

for knights to threaten, they have to be L shape => 2x3 or 3x2 box
how many 2x3 boxes in NxN? (n-2).(n-1)
and 3x2 is also (n-2).(n-1)
and two knights are there so total is
4.(n-2).(n-1)

Safe places = total ways - threaten
= n^2(n^2-1)/2 - 4.(n-2).(n-1)

Missing some Tweet in this thread? You can try to Update

More Threads by @cneuralnetwork

1 tweets • 3 months ago
Read Thread
0
1 tweets • 7 months ago
Read Thread
Studying math makes coding easier! For knights on a chessboard, they threaten in an L-shape (2x3 or 3x2). There are (n-2...
2 tweets • 7 months ago
Read Thread

Unroll Another Thread

Convert any Twitter threads to an easy-to-read article instantly

Have you tried our Twitter bot?

You can now unroll any thread without leaving Twitter/X. Here's how to use our Twitter bot to do it.

  • Give us a follow on Twitter. follow us
  • Drop a comment, mentioning us @unrollnow on the thread you want to Unroll.
  • Wait For Some Time, We will reply to your comment with Unroll Link.
UnrollNow Twitter Bot
Modal Image
0:00 / 0:00