Open
Conversation
DedSec256
suggested changes
May 28, 2022
LocalNetwork/LocalNetwork/Network.fs
Outdated
Comment on lines
16
to
17
| while (random.NextSingle() > computers[current].OS.ProbabilityInfection) do | ||
| yield ("Компьютеру " + prev.ToString() + " не удалось заразить компьютер " + current.ToString()) |
There was a problem hiding this comment.
а если вероятность заразить компьютер = 0, мы просто зациклимся? (:
Owner
Author
There was a problem hiding this comment.
так там выше проверка что вероятность не равна 0
LocalNetwork/LocalNetwork/Network.fs
Outdated
|
|
||
| new (matrix: bool[,], computers:Computer[]) = Network(matrix, computers, System.Random()) | ||
|
|
||
| member public this.Computers with get() = computers |
There was a problem hiding this comment.
Suggested change
| member public this.Computers with get() = computers | |
| member public this.Computers = computers |
| } | ||
|
|
||
| member public this.RunInfectionOneStep () = | ||
| if counted = false then |
Owner
Author
There was a problem hiding this comment.
если уже заражалась сеть, чтобы повторно не запускать заражение, так ничего не изменится, да и результат изменит (каждый раз одно и тоже будет возвращать)
LocalNetwork/LocalNetwork/Network.fs
Outdated
| yield ("Компьютер " + prev.ToString() + " заразил компьютер " + current.ToString()) | ||
|
|
||
| for i in 0 .. visited.Length - 1 do | ||
| if i <> current && visited[i] = false && matrix[current, i] = true then |
There was a problem hiding this comment.
Suggested change
| if i <> current && visited[i] = false && matrix[current, i] = true then | |
| if i <> current && not visited[i] && matrix[current, i] then |
Comment on lines
38
to
39
| for i in 0 .. result.Length - 1 do | ||
| answers[i] |> should equal result[i] |
Comment on lines
43
to
46
| let randomizer = Mock<System.Random>() | ||
| .Setup(fun x -> <@ x.NextSingle() @>) | ||
| .Returns(0.7f) | ||
| .Create() |
There was a problem hiding this comment.
проще передавать функцию рандома, тогда можно будет не мокать, а передать другую функцию
DedSec256
approved these changes
May 31, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.