|
-
May 15th, 2001, 10:50 PM
#1
Thread Starter
Member
Clean Programming Language
I have found a programming language called 'Clean' on the internet. It is a 3rd party programming language, VERY complicated to learn, but EXTREMELY useful to use. I can't remember the URL to download it right now, but has anyone else got it??
btw, here is a sample of the code from a game made in Clean 
Code:
import StdEnv, StdIO, StdGameDef, StdGame, StdGSt, GameFunctions, Random, notes
import WormsGfx /* generated by Tile Studio */
:: GameState
= { curlevel :: !Int
, maxlevel :: !Int
, quit :: !Bool
, wormlist :: ![RealXY]
, gameover :: !Bool
, timecounter :: !Int
, randseed :: !RandomSeed
}
initialGameState = { curlevel = 0
, maxlevel = 7
, quit = False
, wormlist = []
, gameover = False
, timecounter = 0
, randseed = nullRandomSeed
}
/* move with speed V */
V = 3.0 /* 24 rem V must be 0 */
/* ---------- main program: load game definition and start the game! ---------- */
Start :: *World -> *World
Start world
# (seed, world) = getNewRandomSeed world
= startGame WormsDemo {initialGameState & randseed = seed}
[ScreenSize {w = 640, h = 480}, ColorDepth 16] world
/* ---------- the complete game definition ---------- */
WormsDemo :: (Game GameState)
WormsDemo =
{ levels = [ blankScreen
, GameLevel1
, blankScreen
, GameLevel2
, blankScreen
, GameLevel3
, blankScreen
]
, quitlevel = accGSt WormsQuitFunction
, nextlevel = accGSt WormsNextLevelFunction
, textitems = accGSt WormsTextItems
}
/* if the quit function returns true, the game engine quit the level */
WormsQuitFunction :: GameState -> (Bool, GameState)
WormsQuitFunction gst
= (gst.quit, gst)
/* function that returns the next level to run, 0 = end game */
WormsNextLevelFunction :: GameState -> (Int, GameState)
WormsNextLevelFunction gst =: {curlevel, maxlevel, gameover}
= (nextLevel, {gst & curlevel = nextLevel
, quit = False
, timecounter = (time nextLevel)
})
where
nextLevel = if (gameover || (curlevel + 1 > maxlevel)) 0 (curlevel + 1)
time l = if (l == maxlevel) 500 (if (l rem 2 == 1) 100 (~1))
/* function that returns text to be displayed */
WormsTextItems :: GameState -> ([GameText], GameState)
WormsTextItems gst =: {curlevel, gameover, timecounter, maxlevel}
# gst = {gst & timecounter = timecounter - 1}
| gst.timecounter == 0
= ([], {gst & quit = True})
| gameover
| timecounter < 0
= ([GameOver], {gst & timecounter = 250})
= ([GameOver], gst)
= if (curlevel == maxlevel)
([Ending1 timecounter, Ending2 timecounter], gst)
(if (curlevel rem 2 == 1)
([LevelStat ((curlevel + 1) / 2)], gst)
([], gst)
)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|