Thursday, 26 March 2015

rain_unity_Way_Point_Route_Enemy_Detection




1.Import RAIN package software from store either 4.6 or 5.2.

2.First select the player

3.Then goto RAIN window at the top of file menu

4.Create New AI.

5.Next you have to select Waypoint Route from the RAIN Menu

6.Next add Waypoints how many you want. (Waypoint Rig Inspector ==> Click add(Ctrl+W))

7.Next select Navigation mesh from Rain a square-box will open adjust the box into the waypoints (RAIN==> Create Navigation Mesh)

8.Next click on generate Navigation mesh (at Inspector(NavMesh Rig Component))

9.Next open the Behavior Editor from RAIN. create New behavior tree. Give the name what you want.

10.Next from behavior tree right click create root ->Decisions ->Waypointpath or patrol.

11.Next give the name in way-point route and in move target Variable.

12.Next create->Action->move to the before node.

13.Next give the same name given in move target variable to the variable in the move and how much speed you want to move the player.

14.Finally player will move in his route.


FOR Player Detection when he goes in his range


15.select parallel node from behavior tree.

16.Next select create->Action->detect give sensor name given in which player he want to detect given in entity and Aspect name should be same in player entity in quotations("")

17.Next give the same variable given above in the move position

Thursday, 5 March 2015

chanakya’s thoughts (a sparrow and a foolish monkey)



  • A wise person will come to grief if he does the unwise acts of; giving advice to a foolish pupil, looking after a woman of loose character and keeping the company of a sad one who has lost his fortune.



According to Chanakya,
Offering advice to a stupid disciple brings more harm than doing any good. Remember the story about a sparrow and a monkey? A Sparrow once advised a foolish monkey who was shivering in the cold to make fire from warmth. The angry monkey killed the sparrow for daring to counsel it. Similarly sheltering a bad woman creates a problem and bring infamy to the provider of the shelter.
Anyone who is sad because of loss a money or health is always lamenting and cursing his ill luck. The complaining never ends. One who keeps company to such person also catches the sadness and becomes gloomy. His attitude becomes negative and he begins slipping down in his own work or profession. Besides, listening to the sad one’s constant complaints results in terrible loss of time who has sympathetic ears for others often get cheated, tricked into lending money or gets dragged into some misadventure which results in his becoming another sad one. 


Sunday, 25 May 2014

Programming Question - 3 coursera ADA

import sys
import random

def ParseGraph(filename):
  vertices = []
  edges = set([])

  for l in open(filename):
    fields = [int(f) for f in l.split()]
    vertex = fields.pop(0)
    incident = [tuple(sorted([vertex, f])) for f in fields]
    vertices.append(vertex)
    edges.update(incident)

  return vertices, list(edges)

def RandomContraction(vertices, edges):
  while len(vertices) > 2:
    edge = random.choice(edges)
    a, b = edge
    vertices.remove(b)
    new_edges = []
    for e in edges:
      if e == edge:
        continue
      if b in e:
        if e[0] == b:
          other = e[1]
        if e[1] == b:
          other = e[0]
        e = tuple(sorted([a, other]))
      new_edges.append(e)
    edges = new_edges
     
  return vertices, edges

vertices, edges = ParseGraph(sys.argv[1])

minimum = sys.maxint
for i in range(0, 1000):
  v, e = RandomContraction(vertices[:], edges[:])
  print v, len(e)
  if len(e) < minimum:
    minimum = len(e)

print "min cut: %d" % minimum


17

Programming Question - 2 Algorithms: Design and Analysis, Part 1 Stanford

from sys import argv

def quicksort(A,begin,end) :
count = 0
if end - begin <= 1:
return 0
else :
#swap done here
A[begin], A[end-1] = A[end-1] , A[begin]
split = partition(A,begin,end)
count = end - begin - 1
lc = quicksort(A,begin,split)
rc = quicksort(A,split+1,end)
return count + lc + rc


def partition(A,begin,end) :
pivot = A[begin]
i = begin + 1

for j in range(begin+1,end) :
if A[j] < pivot :
A[i], A[j] = A[j], A[i]
i = i + 1

A[i-1], A[begin] = A[begin], A[i-1]
return i-1


len(A)
quicksort(A,0,len(A))



Output1: 162085
Output2: 164123
Output3: 138382

Sunday, 18 May 2014

Count Inversions in an array - coursera Programming Question-1 python mearge sort

Data taken from text file code:-

#load the array with text file
fin = open(../../coresera/inversions/IntegerArray.txt)
A=[]
for line in fin:
    A.append(int(line.strip()))

mearge sort : python code

import random
from sys import maxsize as inf


def merge_sort(A):
def merge(L, R):
m = len(L)-1
B = []
i = j = 0
inv = 0
while L[i] != inf or R[j] != inf:
if L[i] <= R[j]:
B.append(L[i])
i += 1
else:
B.append(R[j])
inv += m - i
j += 1
return B, inv
n = len(A)
inv = 0
if n >= 2:
mid = n // 2
L, R = A[:mid], A[mid:]
L, inv_left = merge_sort(L)
R, inv_right = merge_sort(R)
A, inv_split = merge(L + [inf], R + [inf])
inv = inv_left + inv_right + inv_split
return A, inv


if __name__ == '__main__':
A = [1,6,3,2,4,5]
A, inv = merge_sort(A)
print (inv)
print (A)



# Count the number of lines in a file.
if __name__ == "__main__":
    in_file = open("../../coresera/inversions/IntegerArray.txt")
    line_count = 0
    while True:
        in_line = in_file.readline().strip()
        if in_line == "":
            break;
        line_count += 1
    in_file.close()
    print("Line count:", line_count)




2407905288

Tuesday, 12 March 2013

WHY DO WE PLAY GAMES ?


Games teach us many things:
  • To learn to win and lose
     
  • To think and plan
     
  • To improve our motor skills
     
  • To develop our sensory skills
     
  • To count, add and identify colour
     
  • To improve hand-eye co-ordination
     
  • To have fun

Friday, 16 November 2012

Aditya Hridayam

Aditya Hridayam

Ādityahṛdayam is a hymn associated with Aditya or the Sun God and was recited by the sage Agastya to Rama on the battlefield before fighting with Ravana. This historic hymn starts at the beginning of the duel between Rama and Ravana. Agastya teaches Rama, who is fatigued after the long battle with various warriors of Lanka, the procedure of worshiping the Sun god for strength to defeat the enemy. These verses belong to Yuddha Khanda , in the Ramayana as composed by Valmiki.





tato yuddha pariśrāntaṃ samare cintayā sthitam |
rāvaṇaṃ cāgrato dṛṣṭvā yuddhāya samupasthitam || 1 ||


daivataiśca samāgamya draṣṭumabhyāgato raṇam |
upagamyā bravīdrāmam agastyo bhagavān ṛṣiḥ || 2 ||


rāma rāma mahābāho śṛṇu guhyaṃ sanātanam |
yena sarvānarīn vatsa samare vijayiṣyasi || 3 ||


āditya hṛdayaṃ puṇyaṃ sarvaśatru vināśanam |
jayāvahaṃ japennityam akṣayyaṃ paramaṃ śivam || 4 ||


sarvamaṅgaḷa māṅgaḷyaṃ sarva pāpa praṇāśanam |
cintāśoka praśamanam āyurvardhana muttamam || 5 ||


raśmimantaṃ samudyantaṃ devāsura namaskṛtam |
pūjayasva vivasvantaṃ bhāskaraṃ bhuvaneśvaram || 6 ||


sarvadevātmako hyeṣa tejasvī raśmibhāvanaḥ |
eṣa devāsura gaṇān lokān pāti gabhastibhiḥ || 7 ||


eṣa brahmā ca viṣṇuśca śivaḥ skandaḥ prajāpatiḥ |
mahendro dhanadaḥ kālo yamaḥ somo hyapāṃ patiḥ || 8 ||


pitaro vasavaḥ sādhyā hyaśvinau maruto manuḥ |
vāyurvahniḥ prajāprāṇaḥ ṛtukartā prabhākaraḥ || 9 ||


ādityaḥ savitā sūryaḥ khagaḥ pūṣā gabhastimān |
suvarṇasadṛśo bhānuḥ hiraṇyaretā divākaraḥ || 10 ||


haridaśvaḥ sahasrārciḥ saptasapti-rmarīcimān |
timironmathanaḥ śambhuḥ tvaṣṭā mārtāṇḍako‌உṃśumān || 11 ||


hiraṇyagarbhaḥ śiśiraḥ tapano bhāskaro raviḥ |
agnigarbho‌உditeḥ putraḥ śaṅkhaḥ śiśiranāśanaḥ || 12 ||


vyomanātha stamobhedī ṛgyajuḥsāma-pāragaḥ |
ghanāvṛṣṭi rapāṃ mitro vindhyavīthī plavaṅgamaḥ || 13 ||


ātapī maṇḍalī mṛtyuḥ piṅgaḷaḥ sarvatāpanaḥ |
kavirviśvo mahātejā raktaḥ sarvabhavodbhavaḥ || 14 ||


nakṣatra graha tārāṇām adhipo viśvabhāvanaḥ |
tejasāmapi tejasvī dvādaśātman-namo‌உstu te || 15 ||


namaḥ pūrvāya giraye paścimāyādraye namaḥ |
jyotirgaṇānāṃ pataye dinādhipataye namaḥ || 16 ||


jayāya jayabhadrāya haryaśvāya namo namaḥ |
namo namaḥ sahasrāṃśo ādityāya namo namaḥ || 17 ||


nama ugrāya vīrāya sāraṅgāya namo namaḥ |
namaḥ padmaprabodhāya mārtāṇḍāya namo namaḥ || 18 ||


brahmeśānācyuteśāya sūryāyāditya-varcase |
bhāsvate sarvabhakṣāya raudrāya vapuṣe namaḥ || 19 ||


tamoghnāya himaghnāya śatrughnāyā mitātmane |
kṛtaghnaghnāya devāya jyotiṣāṃ pataye namaḥ || 20 ||


tapta cāmīkarābhāya vahnaye viśvakarmaṇe |
namastamo‌உbhi nighnāya rucaye lokasākṣiṇe || 21 ||


nāśayatyeṣa vai bhūtaṃ tadeva sṛjati prabhuḥ |
pāyatyeṣa tapatyeṣa varṣatyeṣa gabhastibhiḥ || 22 ||


eṣa supteṣu jāgarti bhūteṣu pariniṣṭhitaḥ |
eṣa evāgnihotraṃ ca phalaṃ caivāgni hotriṇām || 23 ||


vedāśca kratavaścaiva kratūnāṃ phalameva ca |
yāni kṛtyāni lokeṣu sarva eṣa raviḥ prabhuḥ || 24 ||


phalaśrutiḥ

ena māpatsu kṛcchreṣu kāntāreṣu bhayeṣu ca |
kīrtayan puruṣaḥ kaścin-nāvaśīdati rāghava || 25 ||


pūjayasvaina mekāgro devadevaṃ jagatpatim |
etat triguṇitaṃ japtvā yuddheṣu vijayiṣyasi || 26 ||


asmin kṣaṇe mahābāho rāvaṇaṃ tvaṃ vadhiṣyasi |
evamuktvā tadāgastyo jagāma ca yathāgatam || 27 ||


etacchrutvā mahātejāḥ naṣṭaśoko‌உbhavat-tadā |
dhārayāmāsa suprīto rāghavaḥ prayatātmavān || 28 ||


ādityaṃ prekṣya japtvā tu paraṃ harṣamavāptavān |
trirācamya śucirbhūtvā dhanurādāya vīryavān || 29 ||


rāvaṇaṃ prekṣya hṛṣṭātmā yuddhāya samupāgamat |
sarvayatnena mahatā vadhe tasya dhṛto‌உbhavat || 30 ||


adha raviravadan-nirīkṣya rāmaṃ muditamanāḥ paramaṃ prahṛṣyamāṇaḥ |
niśicarapati saṅkṣayaṃ viditvā suragaṇa madhyagato vacastvareti || 31 ||

ityārṣe śrīmadrāmāyaṇe vālmikīye ādikāvye yuddakāṇḍe pañcādhika śatatama sargaḥ ||