7 kyu

Collision Detection

229 of 1,632Arongil

Description:

Create a function to determine whether or not two circles are colliding. You will be given the position of both circles in addition to their radii:

function collision(x1, y1, radius1, x2, y2, radius2) {
  // collision?
}
bool IsCollision(float x1, float y1, float r1, float x2, float y2, float r2)
  // collision?
}
def collision(x1, y1, radius1, x2, y2, radius2):  
  # collision?

If a collision is detected, return true. If not, return false.

Here's a geometric diagram of what the circles passed in represent:

alt text

Fundamentals

More By Author:

Check out these other kata created by Arongil

Stats:

CreatedAug 23, 2017
PublishedAug 23, 2017
Warriors Trained3041
Total Skips99
Total Code Submissions4471
Total Times Completed1632
JavaScript Completions699
C# Completions195
TypeScript Completions107
C Completions229
NASM Completions25
Python Completions486
COBOL Completions6
Total Stars41
% of votes with a positive feedback rating92% of 331
Total "Very Satisfied" Votes286
Total "Somewhat Satisfied" Votes36
Total "Not Satisfied" Votes9
Total Rank Assessments15
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Arongil Avatar
  • kazk Avatar
  • Voile Avatar
  • Souzooka Avatar
  • Egorka11 Avatar
  • tebek Avatar
  • monadius Avatar
  • hobovsky Avatar
  • albertogcmr Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
Ad