Skip to content

Commit cab0cfc

Browse files
Chris ElionRuo-Ping Dong
andauthored
Rider suggestions (#4778)
* more tests * more suggestions * more cleanup * more imporvements * fix compile error Co-authored-by: Ruo-Ping Dong <[email protected]>
1 parent ac28c2d commit cab0cfc

File tree

72 files changed

+108
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+108
-194
lines changed

Project/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAgent.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using UnityEngine;
32
using Unity.MLAgents;
43
using Unity.MLAgents.Actuators;

Project/Assets/ML-Agents/Examples/Basic/Scripts/BasicController.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using UnityEngine;
22
using UnityEngine.SceneManagement;
33
using Unity.MLAgents;
4-
using Unity.MLAgents.Actuators;
54
using UnityEngine.Serialization;
65

76
/// <summary>

Project/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using UnityEngine;
32
using Unity.MLAgents;
43
using Unity.Barracuda;
@@ -334,14 +333,14 @@ Vector3 GetAvgVelocity()
334333
Vector3 avgVel = Vector3.zero;
335334

336335
//ALL RBS
337-
int numOfRB = 0;
336+
int numOfRb = 0;
338337
foreach (var item in m_JdController.bodyPartsList)
339338
{
340-
numOfRB++;
339+
numOfRb++;
341340
velSum += item.rb.velocity;
342341
}
343342

344-
avgVel = velSum / numOfRB;
343+
avgVel = velSum / numOfRb;
345344
return avgVel;
346345
}
347346

Project/Assets/ML-Agents/Examples/FoodCollector/Scripts/FoodCollectorAgent.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using UnityEngine;
32
using Unity.MLAgents;
43
using Unity.MLAgents.Actuators;
@@ -106,7 +105,7 @@ public void MoveAgent(ActionBuffers actionBuffers)
106105
dirToGo += transform.right * right;
107106
rotateDir = -transform.up * rotate;
108107

109-
var shootCommand = (int)discreteActions[0] > 0;
108+
var shootCommand = discreteActions[0] > 0;
110109
if (shootCommand)
111110
{
112111
m_Shoot = true;

Project/Assets/ML-Agents/Examples/Match3/Scripts/Match3Agent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ void AnimatedUpdate()
166166

167167
m_TimeUntilMove = MoveTime;
168168

169-
var nextState = State.Invalid;
169+
State nextState;
170170
switch (m_CurrentState)
171171
{
172172
case State.FindMatches:
@@ -214,7 +214,7 @@ void AnimatedUpdate()
214214

215215
bool HasValidMoves()
216216
{
217-
foreach (var move in Board.ValidMoves())
217+
foreach (var unused in Board.ValidMoves())
218218
{
219219
return true;
220220
}

Project/Assets/ML-Agents/Examples/Match3/Scripts/Match3Drawer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Collections.Generic;
22
using UnityEngine;
3-
using Unity.MLAgents.Extensions.Match3;
43

54
namespace Unity.MLAgentsExamples
65
{

Project/Assets/ML-Agents/Examples/Match3/Scripts/Match3TileSelector.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System.Collections;
21
using System.Collections.Generic;
32
using UnityEngine;
43

@@ -35,7 +34,6 @@ public void SetActiveTile(int typeIndex, int matIndex)
3534
{
3635
AllTilesOff();
3736
emptyTile.SetActive(true);
38-
return;
3937
}
4038
else
4139
{

Project/Assets/ML-Agents/Examples/Soccer/Scripts/AgentSoccer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using UnityEngine;
32
using Unity.MLAgents;
43
using Unity.MLAgents.Actuators;

Project/Assets/ML-Agents/Examples/Template/Scripts/TemplateAgent.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using UnityEngine;
21
using Unity.MLAgents;
32
using Unity.MLAgents.Actuators;
43
using Unity.MLAgents.Sensors;

Project/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAgent.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public float MTargetWalkingSpeed // property
2424
const float m_maxWalkingSpeed = 10; //The max walking speed
2525

2626
//Should the agent sample a new goal velocity each episode?
27-
//If true, walkSpeed will be randomly set between zero and m_maxWalkingSpeed in OnEpisodeBegin()
27+
//If true, walkSpeed will be randomly set between zero and m_maxWalkingSpeed in OnEpisodeBegin()
2828
//If false, the goal velocity will be walkingSpeed
2929
public bool randomizeWalkSpeedEachEpisode;
3030

@@ -146,7 +146,7 @@ public override void CollectObservations(VectorSensor sensor)
146146
//ragdoll's avg vel
147147
var avgVel = GetAvgVelocity();
148148

149-
//current ragdoll velocity. normalized
149+
//current ragdoll velocity. normalized
150150
sensor.AddObservation(Vector3.Distance(velGoal, avgVel));
151151
//avg body vel relative to cube
152152
sensor.AddObservation(m_OrientationCube.transform.InverseTransformDirection(avgVel));
@@ -264,14 +264,14 @@ Vector3 GetAvgVelocity()
264264
Vector3 avgVel = Vector3.zero;
265265

266266
//ALL RBS
267-
int numOfRB = 0;
267+
int numOfRb = 0;
268268
foreach (var item in m_JdController.bodyPartsList)
269269
{
270-
numOfRB++;
270+
numOfRb++;
271271
velSum += item.rb.velocity;
272272
}
273273

274-
avgVel = velSum / numOfRB;
274+
avgVel = velSum / numOfRb;
275275
return avgVel;
276276
}
277277

0 commit comments

Comments
 (0)