Commit e5d50b99 authored by Ilya Prokhorov's avatar Ilya Prokhorov

Lincoln index implementation

parent b79eccc5
rm -rf build
mkdir build
cd src
cat Application.swift Bug.swift Tester.swift main.swift > ../build/bugsCountEstimation.swift
cd ..
swift build/bugsCountEstimation.swift
\ No newline at end of file
......@@ -38,4 +38,4 @@ class Application {
return bug
}
}
\ No newline at end of file
}
......@@ -36,4 +36,4 @@ class Bug: Hashable {
hasher.combine(description)
}
}
\ No newline at end of file
}
......@@ -24,7 +24,7 @@ class Tester {
var foundBugs = Set<Bug>()
for round in Range(0...application.bugsCount) {
for _ in 0...application.bugsCount {
let searchResult = Int.random(in: 0...100)
......@@ -32,7 +32,7 @@ class Tester {
if bugFound {
var bug = application.randomBug()
let bug = application.randomBug()
//debugPrint("Tester \(name) found a bug \(bug.name)")
......@@ -45,4 +45,4 @@ class Tester {
return Array(foundBugs)
}
}
\ No newline at end of file
}
......@@ -4,7 +4,7 @@ let application = Application(name: "Best Corporate Shiny App")
let actualBugsCount = 100
for bugIndex in Range(0..<actualBugsCount) {
for bugIndex in 0..<actualBugsCount {
let bug = Bug(name: "Bug \(bugIndex)",
description: "Bug \(bugIndex) description")
......@@ -39,4 +39,4 @@ let lincolnIndex = (bugsFoundedByAlice.count * bugsFoundedByBob.count) / commonB
let bugsCount = application.bugsCount
debugPrint("Estimation bugs count (Lincoln Index): \(lincolnIndex)")
debugPrint("Actual bugs count: \(bugsCount)")
\ No newline at end of file
debugPrint("Actual bugs count: \(bugsCount)")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment