This file contains 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
puts "hello" |
This file contains 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
bubbleSort :: (Ord a) => [a] -> [a] | |
bubbleSort [] = [] | |
bubbleSort [x] = [x] | |
bubbleSort (x:y:xs) = if sorted thisSort then thisSort else bubbleSort thisSort | |
where thisSort = (min x y) : bubbleSort ((max x y):xs) | |
sorted :: (Ord a) => [a] -> Bool | |
sorted [] = True | |
sorted [x] = True | |
sorted (x:y:xs) = if x <= y then sorted (y:xs) else False |
This file contains 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
puts "Hello world" |
This file contains 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
bubbleSort :: (Ord a) => [a] -> [a] | |
bubbleSort [] = [] | |
bubbleSort [x] = [x] | |
bubbleSort (x:y:xs) = if sorted thisSort then thisSort else bubbleSort thisSort | |
where thisSort = (min x y) : bubbleSort ((max x y):xs) | |
sorted :: (Ord a) => [a] -> Bool | |
sorted [] = True | |
sorted [x] = True | |
sorted (x:y:xs) = if x <= y then sorted (y:xs) else False |
This file contains 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
import Data.List | |
insertionSort :: (Ord a) => [a] -> [a] | |
insertionSort = foldr insert [] |
This file contains 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
quickSort :: (Ord a) => [a] -> [a] | |
quickSort [] = [] | |
quickSort (x:xs) = quickSort smaller ++ [x] ++ quickSort larger | |
where smaller = filter (<=x) xs | |
larger = filter (>x) xs |
This file contains 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
data Count = Multiple Int Char | |
| Single Char | |
deriving (Eq, Show) | |
encodeDirect :: [Char] -> [Count] | |
encodeDirect = map toCount . foldr encode [] | |
where | |
toCount (x, y) = case x of | |
1 -> Single y | |
_ -> Multiple x y |
This file contains 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
var target : Transform; | |
var distance = 10.0; | |
var xSpeed = 250.0; | |
var ySpeed = 120.0; | |
var zoomSpeed = 10; | |
var yMinLimit = -20; | |
var yMaxLimit = 80; | |
var zoomMinLimit = 10; |
This file contains 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
if(Input.GetKey("w")){ | |
xDisplacement = Mathf.Sin(Mathf.Deg2Rad * transform.eulerAngles.y); | |
zDisplacement = Mathf.Cos(Mathf.Deg2Rad * transform.eulerAngles.y); | |
displacement = Vector3(xDisplacement, 0, zDisplacement) * forwardSpeed * Time.deltaTime; | |
transform.position += displacement; | |
} |
This file contains 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
#pragma strict | |
var forwardSpeed = 10; | |
var backwardSpeed = 8; | |
var sideSpeed = 10; | |
var xDisplacement:float; | |
var zDisplacement:float; | |
var displacement:Vector3; |
OlderNewer