repo_name
stringlengths
1
52
repo_creator
stringclasses
6 values
programming_language
stringclasses
4 values
code
stringlengths
0
9.68M
num_lines
int64
1
234k
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As ...
151
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As ...
113
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As ...
32
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As ...
28
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As ...
49
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As ...
264
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As ...
72
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As ...
239
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
92
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As ...
34
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As ...
46
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As ...
39
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As ...
144
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As ...
126
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As ...
94
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As ...
298
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As ...
46
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
87
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * As...
117
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
114
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
55
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
149
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
43
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
126
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
64
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
70
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
159
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
74
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
56
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
192
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
81
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
87
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
49
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
159
facebook-sdk-for-unity
facebook
C#
/** * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, * copy, modify, and distribute this software in source code or binary form for use * in connection with the web services and APIs provided by Facebook. * * ...
50
SPIRV-Headers
facebook
C#
// Copyright (c) 2014-2018 The Khronos Group Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and/or associated documentation files (the "Materials"), // to deal in the Materials without restriction, including without limitation // the rights to use, copy, mod...
994
SPIRV-Headers
facebook
C#
// Copyright (c) 2014-2018 The Khronos Group Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and/or associated documentation files (the "Materials"), // to deal in the Materials without restriction, including without limitation // the rights to use, copy, mod...
1,016
SPIRV-Headers
facebook
C#
// Copyright (c) 2014-2018 The Khronos Group Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and/or associated documentation files (the "Materials"), // to deal in the Materials without restriction, including without limitation // the rights to use, copy, mod...
1,022
SPIRV-Headers
facebook
C#
// Copyright (c) 2014-2020 The Khronos Group Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and/or associated documentation files (the "Materials"), // to deal in the Materials without restriction, including without limitation // the rights to use, copy, mod...
2,000
ThreatExchange
facebook
C#
// Copyright (c) Meta Platforms, Inc. and affiliates. // See https://aka.ms/new-console-template for more information //create object of chrome options using OpenQA.Selenium; using OpenQA.Selenium.Chrome; using OpenQA.Selenium.Firefox; using WebAssemblySeleniumWebDriver.Services; using WebDriverManager; using WebDr...
73
ThreatExchange
facebook
C#
// Copyright (c) Meta Platforms, Inc. and affiliates. using OpenQA.Selenium; namespace WebAssemblySeleniumWebDriver.Services { public class PDQMD5Hashing { /// <summary> /// This method is used for passing the filenames whose PDQ/MD5 hash needs to be generated by reading the information from th...
109
ThreatExchange
facebook
C#
// Copyright (c) Meta Platforms, Inc. and affiliates. namespace WebAssemblySeleniumWebDriver.Utils { public class FileUtils { // This method accepts two strings the represent two files to // compare. A return value of 0 indicates that the contents of the files // are the same. A return v...
57
ml-agents
openai
C#
using UnityEngine; using UnityEditor; namespace MLAgents { /* This code is meant to modify the behavior of the inspector on Brain Components. Depending on the type of brain that is used, the available fields will be modified in the inspector accordingly. */ [CustomEditor(typeof(Agent), true)] [CanEditMultipl...
115
ml-agents
openai
C#
using UnityEngine; using UnityEditor; namespace MLAgents { /// <summary> /// CustomEditor for the Brain base class. Defines the default Inspector view for a Brain. /// Shows the BrainParameters of the Brain and expose a tool to deep copy BrainParameters /// between brains. /// </summary> [Cust...
37
ml-agents
openai
C#
using UnityEngine; using UnityEditor; namespace MLAgents { /// <summary> /// PropertyDrawer for BrainParameters. Defines how BrainParameters are displayed in the /// Inspector. /// </summary> [CustomPropertyDrawer(typeof(BrainParameters))] public class BrainParametersDrawer : PropertyDrawer ...
370
ml-agents
openai
C#
using UnityEngine; using UnityEditor; using System; using UnityEditor.SceneManagement; using UnityEngine.SceneManagement; namespace MLAgents { /// <summary> /// PropertyDrawer for BroadcastHub. Used to display the BroadcastHub in the Inspector. /// </summary> [CustomPropertyDrawer(typeof(BroadcastHub))...
208
ml-agents
openai
C#
#if UNITY_CLOUD_BUILD namespace MLAgents { public static class Builder { public static void PreExport() { BuilderUtils.SwitchAllLearningBrainToControlMode(); } } } #endif
15
ml-agents
openai
C#
#if UNITY_CLOUD_BUILD using System.Linq; using UnityEditor; using UnityEditor.SceneManagement; using UnityEngine; using System.IO; namespace MLAgents { public static class BuilderUtils { public static void SwitchAllLearningBrainToControlMode() { Debug.Log("The Switching to control ...
45
ml-agents
openai
C#
using System.Text; using MLAgents; using UnityEditor; /// <summary> /// Renders a custom UI for Demonstration Scriptable Object. /// </summary> [CustomEditor(typeof(Demonstration))] [CanEditMultipleObjects] public class DemonstrationEditor : Editor { SerializedProperty m_BrainParameters; SerializedProperty m_D...
126
ml-agents
openai
C#
using System; using System.IO; using MLAgents.CommunicatorObjects; using UnityEditor; using UnityEngine; using UnityEditor.Experimental.AssetImporters; namespace MLAgents { /// <summary> /// Asset Importer used to parse demonstration files. /// </summary> [ScriptedImporter(1, new[] {"demo"})] publi...
61
ml-agents
openai
C#
using UnityEngine; using UnityEditor; namespace MLAgents { /// <summary> /// CustomEditor for the Heuristic Brain class. Defines the default Inspector view for a /// HeuristicBrain. /// Shows the BrainParameters of the Brain and expose a tool to deep copy BrainParameters /// between brains. Provide...
57
ml-agents
openai
C#
using UnityEngine; using UnityEditor; namespace MLAgents { /// <summary> /// CustomEditor for the LearningBrain class. Defines the default Inspector view for a /// LearningBrain. /// Shows the BrainParameters of the Brain and expose a tool to deep copy BrainParameters /// between brains. Also expos...
85
ml-agents
openai
C#
using UnityEngine; using UnityEditor; namespace MLAgents { /// <summary> /// CustomEditor for the PlayerBrain class. Defines the default Inspector view for a /// PlayerBrain. /// Shows the BrainParameters of the Brain and expose a tool to deep copy BrainParameters /// between brains. Also exposes ...
104
ml-agents
openai
C#
using UnityEngine; using UnityEditor; using System; using System.Linq; using UnityEditor.SceneManagement; using UnityEngine.SceneManagement; namespace MLAgents { /// <summary> /// PropertyDrawer for ResetParameters. Defines how ResetParameters are displayed in the /// Inspector. /// </summary> [Cus...
180
ml-agents
openai
C#
using System.Collections.Generic; using NUnit.Framework; using UnityEngine; using System.IO.Abstractions.TestingHelpers; namespace MLAgents.Tests { public class DemonstrationTests : MonoBehaviour { private const string k_DemoDirecory = "Assets/Demonstrations/"; private const string k_ExtensionT...
67
ml-agents
openai
C#
using System; using Barracuda; using NUnit.Framework; using UnityEngine; using MLAgents.InferenceBrain; using MLAgents.InferenceBrain.Utils; namespace MLAgents.Tests { public class DiscreteActionOutputApplierTest { [Test] public void TestEvalP() { var m = new Multinomial(201...
194
ml-agents
openai
C#
using NUnit.Framework; namespace MLAgents.Tests { public class EditModeTestActionMasker { [Test] public void Contruction() { var bp = new BrainParameters(); var masker = new ActionMasker(bp); Assert.IsNotNull(masker); } [Test] ...
142
ml-agents
openai
C#
using System.Collections.Generic; using System.Linq; using NUnit.Framework; using UnityEngine; using System.Reflection; using Barracuda; using MLAgents.InferenceBrain; namespace MLAgents.Tests { public class EditModeTestInternalBrainTensorApplier { private class TestAgent : Agent { ...
161
ml-agents
openai
C#
using System.Collections.Generic; using System.Linq; using Barracuda; using NUnit.Framework; using UnityEngine; using MLAgents.InferenceBrain; namespace MLAgents.Tests { public class EditModeTestInternalBrainTensorGenerator { private class TestAgent : Agent { } private Dictiona...
160
ml-agents
openai
C#
using UnityEngine; using NUnit.Framework; using System.Reflection; namespace MLAgents.Tests { public class TestAcademy : Academy { public int initializeAcademyCalls; public int AcademyStepCalls; public override void InitializeAcademy() { initializeAcademyCalls += 1;...
592
ml-agents
openai
C#
using NUnit.Framework; using MLAgents.InferenceBrain.Utils; namespace MLAgents.Tests { public class MultinomialTest { [Test] public void TestDim1() { var m = new Multinomial(2018); var cdf = new[] {1f}; Assert.AreEqual(0, m.Sample(cdf)); ...
55
ml-agents
openai
C#
using System; using NUnit.Framework; using MLAgents.InferenceBrain.Utils; namespace MLAgents.Tests { public class RandomNormalTest { private const float k_FirstValue = -1.19580f; private const float k_SecondValue = -0.97345f; private const double k_Epsilon = 0.0001; [Test] ...
92
ml-agents
openai
C#
using UnityEngine; using NUnit.Framework; namespace MLAgents.Tests { public class RayPerceptionTests : MonoBehaviour { [Test] public void TestPerception3D() { var angles = new[] {0f, 90f, 180f}; var tags = new[] {"test", "test_1"}; var go = new Game...
37
ml-agents
openai
C#
using System; using Barracuda; using MLAgents.InferenceBrain; using MLAgents.InferenceBrain.Utils; using NUnit.Framework; namespace MLAgents.Tests { public class TensorUtilsTest { [Test] public void RandomNormalTestTensorInt() { var rn = new RandomNormal(1982); v...
84
ml-agents
openai
C#
using NUnit.Framework; namespace MLAgents.Tests { public class UtilitiesTests { [Test] public void TestCumSum() { var output = Utilities.CumSum(new[] {1, 2, 3, 10}); CollectionAssert.AreEqual(output, new[] {0, 1, 3, 6, 16}); output = Utilities.CumSum...
24
ml-agents
openai
C#
using UnityEngine; using MLAgents; public class Ball3DAcademy : Academy { public override void AcademyReset() { Physics.gravity = new Vector3(0, -resetParameters["gravity"], 0); } public override void AcademyStep() { } }
15
ml-agents
openai
C#
using UnityEngine; using MLAgents; public class Ball3DAgent : Agent { [Header("Specific to Ball3D")] public GameObject ball; private Rigidbody m_BallRb; private ResetParameters m_ResetParams; public override void InitializeAgent() { m_BallRb = ball.GetComponent<Rigidbody>(); va...
84
ml-agents
openai
C#
using System.Collections.Generic; using UnityEngine; using MLAgents; public class Ball3DDecision : Decision { public float rotationSpeed = 2f; public override float[] Decide( List<float> vectorObs, List<Texture2D> visualObs, float reward, bool done, List<float> memory) ...
47
ml-agents
openai
C#
using UnityEngine; using MLAgents; public class Ball3DHardAgent : Agent { [Header("Specific to Ball3DHard")] public GameObject ball; private Rigidbody m_BallRb; private ResetParameters m_ResetParams; public override void InitializeAgent() { m_BallRb = ball.GetComponent<Rigidbody>(); ...
81
ml-agents
openai
C#
using UnityEngine; using MLAgents; public class BasicAcademy : Academy { public override void AcademyReset() { } public override void AcademyStep() { } }
14
ml-agents
openai
C#
using UnityEngine; using MLAgents; public class BasicAgent : Agent { [Header("Specific to Basic")] private BasicAcademy m_Academy; public float timeBetweenDecisionsAtInference; private float m_TimeSinceDecision; int m_Position; int m_SmallGoalPosition; int m_LargeGoalPosition; public Ga...
105
ml-agents
openai
C#
using System.Collections.Generic; using UnityEngine; using MLAgents; public class BasicDecision : Decision { public override float[] Decide( List<float> vectorObs, List<Texture2D> visualObs, float reward, bool done, List<float> memory) { return new[] { 1f }; ...
27
ml-agents
openai
C#
using UnityEngine; using MLAgents; public class BouncerAcademy : Academy { public float gravityMultiplier = 1f; public override void InitializeAcademy() { Physics.gravity = new Vector3(0, -9.8f * gravityMultiplier, 0); } public override void AcademyReset() { } public override...
21
ml-agents
openai
C#
using UnityEngine; using MLAgents; public class BouncerAgent : Agent { [Header("Bouncer Specific")] public GameObject target; public GameObject bodyObject; Rigidbody m_Rb; Vector3 m_LookDir; public float strength = 10f; float m_JumpCooldown; int m_NumberJumps = 20; int m_JumpLeft = ...
128
ml-agents
openai
C#
using UnityEngine; using MLAgents; public class BouncerTarget : MonoBehaviour { // Update is called once per frame void FixedUpdate() { gameObject.transform.Rotate(new Vector3(1, 0, 0), 0.5f); } private void OnTriggerEnter(Collider collision) { var agent = collision.gameObject....
31
ml-agents
openai
C#
using UnityEngine; using MLAgents; public class CrawlerAcademy : Academy { public override void InitializeAcademy() { Monitor.verticalOffset = 1f; Physics.defaultSolverIterations = 12; Physics.defaultSolverVelocityIterations = 12; Time.fixedDeltaTime = 0.01333f; // (75fps). defa...
23
ml-agents
openai
C#
using UnityEngine; using MLAgents; [RequireComponent(typeof(JointDriveController))] // Required to set joint forces public class CrawlerAgent : Agent { [Header("Target To Walk Towards")][Space(10)] public Transform target; public Transform ground; public bool detectTargets; public bool targetIsSta...
293
ml-agents
openai
C#
using UnityEngine; using UnityEngine.UI; using MLAgents; public class FoodCollectorAcademy : Academy { [HideInInspector] public GameObject[] agents; [HideInInspector] public FoodCollectorArea[] listArea; public int totalScore; public Text scoreText; public override void AcademyReset() ...
42
ml-agents
openai
C#
using UnityEngine; using MLAgents; public class FoodCollectorAgent : Agent { private FoodCollectorAcademy m_MyAcademy; public GameObject area; FoodCollectorArea m_MyArea; bool m_Frozen; bool m_Poisoned; bool m_Satiated; bool m_Shoot; float m_FrozenTime; float m_EffectTime; Rigid...
288
ml-agents
openai
C#
using UnityEngine; using MLAgents; public class FoodCollectorArea : Area { public GameObject food; public GameObject badFood; public int numFood; public int numBadFood; public bool respawnFood; public float range; void CreateFood(int num, GameObject type) { for (int i = 0; i < ...
46
ml-agents
openai
C#
using UnityEngine; public class FoodLogic : MonoBehaviour { public bool respawn; public FoodCollectorArea myArea; public void OnEaten() { if (respawn) { transform.position = new Vector3(Random.Range(-myArea.range, myArea.range), 3f, Random.Ra...
22
ml-agents
openai
C#
using System.Collections.Generic; using UnityEngine; using System.Linq; using MLAgents; public class GridAcademy : Academy { [HideInInspector] public List<GameObject> actorObjs; [HideInInspector] public int[] players; public GameObject trueAgent; public int gridSize; public GameObject c...
121
ml-agents
openai
C#
using System; using UnityEngine; using System.Linq; using MLAgents; public class GridAgent : Agent { [Header("Specific to GridWorld")] private GridAcademy m_Academy; public float timeBetweenDecisionsAtInference; private float m_TimeSinceDecision; [Tooltip("Because we want an observation right befo...
159
ml-agents
openai
C#
using UnityEngine; using MLAgents; public class HallwayAcademy : Academy { public float agentRunSpeed; public float agentRotationSpeed; public Material goalScoredMaterial; // when a goal is scored the ground will use this material for a few seconds. public Material failMaterial; // when fail, the groun...
21
ml-agents
openai
C#
using System.Collections; using UnityEngine; using MLAgents; public class HallwayAgent : Agent { public GameObject ground; public GameObject area; public GameObject symbolOGoal; public GameObject symbolXGoal; public GameObject symbolO; public GameObject symbolX; public bool useVectorObs; ...
151
ml-agents
openai
C#
//Detect when the orange block has touched the goal. //Detect when the orange block has touched an obstacle. //Put this script onto the orange block. There's nothing you need to set in the editor. //Make sure the goal is tagged with "goal" in the editor. using UnityEngine; public class GoalDetect : MonoBehaviour { ...
27
ml-agents
openai
C#
//Put this script on your blue cube. using System.Collections; using UnityEngine; using MLAgents; public class PushAgentBasic : Agent { /// <summary> /// The ground. The bounds are used to spawn the elements. /// </summary> public GameObject ground; public GameObject area; /// <summary> ...
249
ml-agents
openai
C#
//Every scene needs an academy script. //Create an empty gameObject and attach this script. //The brain needs to be a child of the Academy gameObject. using UnityEngine; using MLAgents; public class PushBlockAcademy : Academy { /// <summary> /// The "walking speed" of the agents in the scene. /// </summar...
51
ml-agents
openai
C#
using UnityEngine; using MLAgents; public class PyramidAcademy : Academy { public override void AcademyReset() { } public override void AcademyStep() { } }
14
ml-agents
openai
C#
using System; using System.Linq; using UnityEngine; using Random = UnityEngine.Random; using MLAgents; public class PyramidAgent : Agent { public GameObject area; private PyramidArea m_MyArea; private Rigidbody m_AgentRb; private RayPerception m_RayPer; private PyramidSwitch m_SwitchLogic; publ...
116
ml-agents
openai
C#
using UnityEngine; using MLAgents; public class PyramidArea : Area { public GameObject pyramid; public GameObject stonePyramid; public GameObject[] spawnAreas; public int numPyra; public float range; public void CreatePyramid(int numObjects, int spawnAreaIndex) { CreateObject(numOb...
55
ml-agents
openai
C#
using UnityEngine; public class PyramidSwitch : MonoBehaviour { public Material onMaterial; public Material offMaterial; public GameObject myButton; private bool m_State; private GameObject m_Area; private PyramidArea m_AreaComponent; private int m_PyramidIndex; public bool GetState() ...
45
ml-agents
openai
C#
using UnityEngine; using MLAgents; public class ReacherAcademy : Academy { public override void AcademyReset() { Physics.gravity = new Vector3(0, -resetParameters["gravity"], 0); } public override void AcademyStep() { } }
15
ml-agents
openai
C#
using UnityEngine; using MLAgents; public class ReacherAgent : Agent { public GameObject pendulumA; public GameObject pendulumB; public GameObject hand; public GameObject goal; private ReacherAcademy m_MyAcademy; float m_GoalDegree; private Rigidbody m_RbA; private Rigidbody m_RbB; ...
119
ml-agents
openai
C#
using System.Collections.Generic; using UnityEngine; using MLAgents; public class ReacherDecision : Decision { public override float[] Decide(List<float> state, List<Texture2D> observation, float reward, bool done, List<float> memory) { var action = new float[4]; for (var i = 0; i < 4; i++) ...
22
ml-agents
openai
C#
using UnityEngine; public class ReacherGoal : MonoBehaviour { public GameObject agent; public GameObject hand; public GameObject goalOn; private void OnTriggerEnter(Collider other) { if (other.gameObject == hand) { goalOn.transform.localScale = new Vector3(1f, 1f, 1f); ...
33
ml-agents
openai
C#
//This script lets you change time scale during training. It is not a required script for this demo to function using UnityEngine; namespace MLAgents { public class AdjustTrainingTimescale : MonoBehaviour { // Update is called once per frame void Update() { if (Input.GetKe...
55
ml-agents
openai
C#
using UnityEngine; namespace MLAgents { public class Area : MonoBehaviour { public virtual void ResetArea() { } } }
12
ml-agents
openai
C#
using UnityEngine; namespace MLAgents { public class CameraFollow : MonoBehaviour { public Transform target; Vector3 m_Offset; // Use this for initialization void Start() { m_Offset = gameObject.transform.position - target.position; } // Upd...
26
ml-agents
openai
C#
using UnityEngine; namespace MLAgents { public class FlyCamera : MonoBehaviour { /* wasd : basic movement shift : Makes camera accelerate space : Moves camera on X and Z axis only. So camera doesn't gain any height*/ public float mainSpeed = 100.0f; // regular speed ...
117