Skip to content

Instantly share code, notes, and snippets.

Ramachandra Junior ramachandrajr

Block or report user

Report or block ramachandrajr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ramachandrajr
ramachandrajr / vowel_prob.py
Created Mar 21, 2018
Calculates vowel probabilities in a text
View vowel_prob.py
import re
import sys
yevgeny = ""
vowels_after_vowels = 0.0
vowels_after_consonants = 0.0
number_of_vowels = 0.0
vowels = [ "a", "e", "i", "o", "u", "A", "E", "I", "O", "U" ]
@ramachandrajr
ramachandrajr / GamePlayStatistics.cpp:
Last active Dec 3, 2017
SuggestProjectileVelocity function from unreal engine
View GamePlayStatistics.cpp:
/** SuggestProjectileVelocity **/
// note: this will automatically fall back to line test if radius is small enough// Based on analytic solution to ballistic angle of launch http://en.wikipedia.org/wiki/Trajectory_of_a_projectile#Angle_required_to_hit_coordinate_.28x.2Cy.29bool UGameplayStatics::SuggestProjectileVelocity(const UObject* WorldContextObject, FVector& OutTossVelocity, FVector Start, FVector End, float TossSpeed, bool bFavorHighArc, float CollisionRadius, float OverrideGravityZ, ESuggestProjVelocityTraceOption::Type TraceOption, const FCollisionResponseParams& ResponseParam, const TArray<AActor*>& ActorsToIgnore, bool bDrawDebug){
const FVector FlightDelta = End - Start;
const FVector DirXY = FlightDelta.GetSafeNormal2D();
const float DeltaXY = FlightDelta.Size2D();
const float DeltaZ = FlightDelta.Z;
const float TossSpeedSq = FMath::Square(TossSpeed);
@ramachandrajr
ramachandrajr / draw_olympic_logo.py
Last active Sep 2, 2017
Script draws Olympoic logo. Uses a built in python module called turtle to draw shapes.
View draw_olympic_logo.py
from turtle import Turtle
def create_circle( turtle_object, coordinates, color, radius ):
"""Creates a circle with **coordinates** as start point."""
# Pull up the pen first.
turtle_object.penup()
# Go to initial coordinates.
turtle_object.goto(coordinates[0], coordinates[1]);
# Pendown to start drawing.
turtle_object.pendown();
@ramachandrajr
ramachandrajr / maze_player.cpp
Created Jul 3, 2017
A bruteforce program to solve mazes
View maze_player.cpp
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
// Used for proper response structuring.
// reduces code on check_for_dots and check_for_xs.
struct Response
{
@ramachandrajr
ramachandrajr / string_to_text.cpp
Created Jun 2, 2017
This piece of code converts string text to integer.
View string_to_text.cpp
#include <iostream>
#include <stdexcept>
#include <cmath>
using namespace std;
/**
* Reports any non numeric charaters in a string. Removes if just whitespace.
* @param {string} str - String to convert.
* @return {string} String with just numbers.
*/
@ramachandrajr
ramachandrajr / pointer_fix.cpp
Created May 19, 2017
Fixing error with pointer
View pointer_fix.cpp
#include <iostream>
using namespace std;
class Person
{
public:
string name;
int age;
double height;
@ramachandrajr
ramachandrajr / moron.cpp
Created May 19, 2017
This program helps understand string initializations.
View moron.cpp
/*
Execute the program as:
g++ -std=c++11 file_name.cpp -o file_name
*/
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
View chegg_1491721626696.cpp
/**
* "Sun Apr 09 2017 12:36:54 GMT+0530 (IST)"
* Design a file filter package.
*
* 1) A file filter reads an input file, transforms it in some way, and writes the result to an output file.
* You are tasked to write an abstract Filter class that defines a pure virtual function char transform
* (char ch) for transforming a single character .
*
* 2) The Filter class should have member variables to hold the input and output streams; it also should
* have a default constructor that initializes the input/output streams to cin/cout respectively as well
View homework1_mscppcouse_module3.cpp
// You cannot do << to the cin, you can do 'cin >> auto a' though but I
// think it'd be great to initialize int's first and then getting values.
cin<< auto a;
cin<<auto b;
// This way powerMultiply will already have a power of a.
int powerMultiply=a;
// so you need not do it i<b times, you just have to do
// it i < (b-1) times.
for(int i =0;i<b;i++)
View problem11.cpp
#include <iostream>
#include <iomanip>
int grid[20][20] = {
{ 8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8 },
{ 49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0 },
{ 81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65 },
{ 52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91 },
{ 22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80 },
{ 24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50 },
You can’t perform that action at this time.