From CSULA CS Wiki
Jump to: navigation, search
m
 
Line 77: Line 77:
 
board4 x y | y > 1 && odd y = above (board4 x (y-1)) (board4 x 1)
 
board4 x y | y > 1 && odd y = above (board4 x (y-1)) (board4 x 1)
 
</pre>
 
</pre>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<div  style="display:none">
 
[We are delicate. We do not delete your content.]
 
[l_sp4]
 
 
 
[http://www.buddyprofile.com/viewprofile.php?username=waterfordcrystal waterford crystal]
 
[http://www.buddyprofile.com/viewprofile.php?username=swarovskicrystal swarovski crystal bead]
 
[http://www.buddyprofile.com/viewprofile.php?username=mesotheliomalawsuits mesothelioma lawsuits]
 
[http://www.buddyprofile.com/viewprofile.php?username=mesotheliomasymptoms mesothelioma symptoms]
 
[http://www.buddyprofile.com/viewprofile.php?username=mesotheliomadiag mesothelioma diagnosis]
 
[http://www.buddyprofile.com/viewprofile.php?username=wacoalbras wacoal bras]
 
[http://www.buddyprofile.com/viewprofile.php?username=teenbra teen bra]
 
[http://www.buddyprofile.com/viewprofile.php?username=unsecuredloan unsecured signature loan]
 
[http://www.buddyprofile.com/viewprofile.php?username=homeloans Countrywide Home Loans]
 
[http://blog.moddingplanet.it/?w=formalpromdresses Formal Prom Dresses]
 
[http://blog.moddingplanet.it/?w=sexypromdress Sexy Prom Dress]
 
[http://blog.moddingplanet.it/?w=cocktaildresses cocktail dresses]
 
[http://www.buddyprofile.com/viewprofile.php?username=telmobile TMobile]
 
[http://www.buddyprofile.com/viewprofile.php?username=watersoftener water softener]
 
[http://www.buddyprofile.com/viewprofile.php?username=tanklesswaterheater tankless water heater]
 
[http://www.buddyprofile.com/viewprofile.php?username=rockportshoes rockport shoes]
 
[http://www.buddyprofile.com/viewprofile.php?username=osmosiswaterfilter reverse osmosis water filter]
 
[http://www.buddyprofile.com/viewprofile.php?username=merrellshoes merrell shoes]
 
[http://www.buddyprofile.com/viewprofile.php?username=oscardresses oscar dresses]
 
[http://www.buddyprofile.com/viewprofile.php?username=easterdresses easter dresses]
 
[http://flyfone.blox.pl/resource/flyfonevoip.htm flyfone voip]
 
[http://www.buddyprofile.com/viewprofile.php?username=plussizepromdresses plus size prom dresses]
 
[http://www.buddyprofile.com/viewprofile.php?username=discountpromdresses discount prom dresses]
 
[http://blog.moddingplanet.it/?w=hooterscasinolas Hooters Casino Las Vegas]
 
[http://blog.moddingplanet.it/?w=grandcasinomille grand casino mille lacs]
 
[http://blog.moddingplanet.it/?w=lasvegascasino las vegas casino coupons]
 
[http://blog.moddingplanet.it/?w=onlinepokeraide online poker aide]
 
[http://www.donx.de/blog/pechangacasino pechanga casino]
 
[http://www.donx.de/blog/grandvictoriacasino/ grand victoria casino]
 
[http://www.donx.de/blog/ballgowns/ ball gowns]
 
[http://www.privetparis.com/blog/rtgcasinobonus/ rtg casino bonus]
 
 
[http://blog.moddingplanet.it/?w=rtgcasinobonus rtg casino bonus]
 
[http://blog.moddingplanet.it/?w=grandcasinocoushat grand casino coushatta]
 
[http://blog.moddingplanet.it/?w=grandcasinohinckle grand casino hinckley]
 
[http://blog.moddingplanet.it/?w=isleofcapricasino isle of capri casino]
 
[http://blog.moddingplanet.it/?w=mohegansuncasino mohegan sun casino]
 
[http://blog.moddingplanet.it/?w=palacasino pala casino]
 
[http://blog.moddingplanet.it/?w=roulettewheels roulette wheels]
 
[http://blog.moddingplanet.it/?w=winstarcasino winstar casino]
 
[http://blog.moddingplanet.it/?w=cheappromdresses Cheap Prom Dresses]
 
[http://blog.moddingplanet.it/?w=informalweddingdre informal wedding dresses]
 
[http://blog.moddingplanet.it/?w=oscardresses oscar dresses]
 
[http://blog.moddingplanet.it/?w=eveninggowns evening gowns]
 
</div>
 

Latest revision as of 15:16, 22 May 2006

module UsePictures where

import Pictures

pp :: Picture -> IO ()
pp x = printPicture x

-- 2.1  Basic definitions

blackHorse :: Picture
blackHorse = invertColour horse

-- 'rotate' already in the Pictures module

rotateHorse :: Picture
rotateHorse = rotate horse

-- 2.2  Black rectangle using 'superimpose'

black :: Picture
black = superimpose horse (invertColour horse)

-- 2.3  Checkerboard, 2x2 size only

halfBoard :: Picture
halfBoard = sideBySide white (invertColour white)

checkerBoard1 :: Picture
checkerBoard1 = above halfBoard (invertColour halfBoard)

-- Checkerboard, generalized recursive method

row :: Int -> Picture
row 1 = white
row n | n > 1 && even n = sideBySide (row (n-1)) black
row n | n > 1 && odd n = sideBySide (row (n-1)) white

board :: Int -> Int -> Picture
board x 1 = row x
board x y | y > 1 && even y = above (board x (y-1)) (invertColour (board x 1))
board x y | y > 1 && odd y = above (board x (y-1)) (board x 1)

-- 2.4

rowHorse :: Int -> Picture
rowHorse 1 = horse
rowHorse n | n > 1 && even n = sideBySide (rowHorse (n-1)) blackHorse
rowHorse n | n > 1 && odd n = sideBySide (rowHorse (n-1)) horse

-- Variant 1

board1 :: Int -> Int -> Picture
board1 x 1 = rowHorse x
board1 x y | y > 1 && even y = above (board1 x (y-1)) (invertColour (board1 x 1))
board1 x y | y > 1 && odd y = above (board1 x (y-1)) (board1 x 1)

-- Variant 2

board2 :: Int -> Int -> Picture
board2 x 1 = rowHorse x
board2 x y | y > 1 && even y = above (board2 x (y-1)) (flipV (board2 x 1))
board2 x y | y > 1 && odd y = above (board2 x (y-1)) (board2 x 1)

-- Variant 3

board3 :: Int -> Int -> Picture
board3 x 1 = rowHorse x
board3 x y | y > 1 && even y = above (board3 x (y-1)) (rotate (board3 x 1))
board3 x y | y > 1 && odd y = above (board3 x (y-1)) (board3 x 1)

-- 2.5

board4 :: Int -> Int -> Picture
board4 x 1 = rowHorse x
board4 x y | y > 1 && even y = above (board4 x (y-1)) (invertColour (flipH (board4 x 1)))
board4 x y | y > 1 && odd y = above (board4 x (y-1)) (board4 x 1)