https://wiki.haskell.org/api.php?action=feedcontributions&user=Lemming&feedformat=atomHaskellWiki - User contributions [en]2021-05-06T07:57:30ZUser contributionsMediaWiki 1.27.4https://wiki.haskell.org/index.php?title=LLVM&diff=63448LLVM2020-10-02T11:22:59Z<p>Lemming: fixed nested list</p>
<hr />
<div>[http://llvm.org/ LLVM] is an abbreviation of "Low Level Virtual Machine"; LLVM is:<br />
* A compilation strategy <br />
* A virtual instruction set<br />
* A compiler infrastructure<br />
<br />
It is developed by the University of Illinois.<br />
It is implemented on many platforms, amongst others the [http://www.ipodobserver.com/story/30184 iPhone].<br />
<br />
You can use this from a Haskell program using essentially two bindings:<br />
<br />
A strongly typed interface that is mainly intended to accelerate your Haskell programs with low-level code:<br />
* {{HackagePackage|id=llvm-tf}}, {{HackagePackage|id=llvm-ffi}}<br />
* a [http://hub.darcs.net/thielema/llvm-ffi/ darcs repository],<br />
* a [http://augustss.blogspot.com/2009/01/llvm-llvm-low-level-virtual-machine-is.html blog article] with examples,<br />
* the article "[http://augustss.blogspot.com/2009/01/performance-update-ive-continued.html A performance update]" that describes, how LLVM can improve performance<br />
* {{HackagePackage|id=llvm-extra}} provides high-level control structures (<hask>ifThenElse</hask>, <hask>whileLoop</hask>, <hask>Maybe</hask>), vector instructions, automatic adaption to target specific extensions<br />
* {{HackagePackage|id=knead}} provides array processing similar to {{HackagePackage|id=accelerate}}<br />
* Example applications:<br />
** {{HackagePackage|id=synthesizer-llvm}} provides efficient signal processing using vector instructions, including a live [[Synthesizer|software synthesizer]]<br />
** {{HackagePackage|id=patch-image}} constructs a big image from overlapping parts<br />
<br />
An untyped interface mainly intended to write compilers and analyse LLVM bitcode:<br />
* {{HackagePackage|id=llvm-hs}}<br />
<br />
[[Category:Packages]]<br />
[[Category:Performance]]<br />
[[Category:Compiler tools]]</div>Lemminghttps://wiki.haskell.org/index.php?title=LLVM&diff=63447LLVM2020-10-02T10:11:25Z<p>Lemming: updated to year 2020</p>
<hr />
<div>[http://llvm.org/ LLVM] is an abbreviation of "Low Level Virtual Machine"; LLVM is:<br />
* A compilation strategy <br />
* A virtual instruction set<br />
* A compiler infrastructure<br />
<br />
It is developed by the University of Illinois.<br />
It is implemented on many platforms, amongst others the [http://www.ipodobserver.com/story/30184 iPhone].<br />
<br />
You can use this from a Haskell program using essentially two bindings:<br />
<br />
A strongly typed interface that is mainly intended to accelerate your Haskell programs with low-level code:<br />
* {{HackagePackage|id=llvm-tf}}, {{HackagePackage|id=llvm-ffi}}<br />
* a [http://hub.darcs.net/thielema/llvm-ffi/ darcs repository],<br />
* a [http://augustss.blogspot.com/2009/01/llvm-llvm-low-level-virtual-machine-is.html blog article] with examples,<br />
* the article "[http://augustss.blogspot.com/2009/01/performance-update-ive-continued.html A performance update]" that describes, how LLVM can improve performance<br />
* {{HackagePackage|id=llvm-extra}} provides high-level control structures (<hask>ifThenElse</hask>, <hask>whileLoop</hask>, <hask>Maybe</hask>), vector instructions, automatic adaption to target specific extensions<br />
* {{HackagePackage|id=knead}} provides array processing similar to {{HackagePackage|id=accelerate}}<br />
* Example applications:<br />
- {{HackagePackage|id=synthesizer-llvm}} provides efficient signal processing using vector instructions, including a live [[Synthesizer|software synthesizer]]<br />
- {{HackagePackage|id=patch-image}} constructs a big image from overlapping parts<br />
<br />
An untyped interface mainly intended to write compilers and analyse LLVM bitcode:<br />
* {{HackagePackage|id=llvm-hs}}<br />
<br />
[[Category:Packages]]<br />
[[Category:Performance]]<br />
[[Category:Compiler tools]]</div>Lemminghttps://wiki.haskell.org/index.php?title=Live-Sequencer&diff=62622Live-Sequencer2018-09-26T09:50:15Z<p>Lemming: update URLs</p>
<hr />
<div>Live-Sequencer does the following:<br />
An editor shows a textual description of music (like [[Haskore]]),<br />
an interpreter computes and emits a stream of [[MIDI]] events via [[ALSA]].<br />
While doing so it highlights active terms and shows the result of the term reductions.<br />
The nice thing is, that the user can change the program while it is performed.<br />
Additionally modules can be altered via a web interface.<br />
This way several people can take part in the composition.<br />
However they need to have video and audio access to the running sequencer<br />
in order to see and hear how their parts fit into the overall composition.<br />
<br />
We address two applications:<br />
* interactive multi-user programmed music composition<br />
* education of how functional programs are interpreted<br />
<br />
== Resources ==<br />
<br />
* Installation from Hackage: {{HackagePackage|id=live-sequencer}}<br />
* Henning's Darcs repository with the cutting edge features:<br />
** darcs get https://hub.darcs.net/thielema/livesequencer<br />
* some example songs:<br />
** https://hub.darcs.net/thielema/livesequencer-example<br />
* Old Bug-Tracker: http://dfa.imn.htwk-leipzig.de/bugzilla/describecomponents.cgi?product=live-sequencer<br />
* Johannes' Git repository - the old git repository:<br />
** Direct access: <code>git clone git://dfa.imn.htwk-leipzig.de/srv/git/seq/</code><br />
** Web frontend: http://dfa.imn.htwk-leipzig.de/cgi-bin/gitweb.cgi?p=seq.git;a=tree<br />
<br />
== Papers ==<br />
<br />
* Henning Thielemann: [http://arxiv.org/abs/1202.4269 Live-Musikprogrammierung in Haskell], Arbeitstagung Programmiersprachen ATPS 2012 (German)<br />
* Henning Thielemann: [http://arxiv.org/abs/1303.5768 Live music programming in Haskell], Linux Audio Conference LAC 2013<br />
<br />
== Demonstrations ==<br />
<br />
* [http://www.youtube.com/watch?v=88jK162l6mE kling klong]<br />
* [http://www.youtube.com/watch?v=sXywCHR9WwE electronical menu]<br />
* [http://www.youtube.com/watch?v=-fmxHM69zgI Tausend Sterne sind ein Dom] (engl. "Thousand stars are a cathedral")<br />
* [http://www.youtube.com/watch?v=O5k0wUh0lj8 Glorious Kingdom] (Gospel)<br />
* [http://www.youtube.com/watch?v=0EQCgi5qa3E Alta trinita beata] (featuring speech synthesis)<br />
* [http://www.youtube.com/watch?v=Sk-NtRYqVy4 Drei Chinesen mit dem Kontrabass] (featuring speech synthesis)<br />
<br />
[[Category:Music]]</div>Lemminghttps://wiki.haskell.org/index.php?title=Battleship_game_combinatorics&diff=62290Battleship game combinatorics2018-01-19T20:47:22Z<p>Lemming: update URL of Haskell code to hub.darcs.net</p>
<hr />
<div>This page is a table, reporting the number of ways to place ships as in the game "battleship". The table assumes that ships cannot be placed adjacent to one another, though not all versions of the game use this rule.<br />
<br />
{| class="wikitable" style="text-align: right"<br />
|-<br />
! colspan="4" | Ship sizes<br />
! rowspan="2" | Number of configurations <br> on a 10×10 board<br />
|-<br />
! 2<br />
! 3<br />
! 4<br />
! 5<br />
|-<br />
| || || || || 1<br />
|-<br />
| 1 || || || || 180<br />
|-<br />
| 2 || || || || 13952<br />
|-<br />
| 3 || || || || 614372<br />
|-<br />
| 4 || || || || 17086631<br />
|-<br />
| || 1 || || || 160<br />
|-<br />
| 1 || 1 || || || 23864<br />
|-<br />
| 2 || 1 || || || 1512096<br />
|-<br />
| 3 || 1 || || || 53606768<br />
|-<br />
| 4 || 1 || || || 1179864432<br />
|-<br />
| || 2 || || || 10124<br />
|-<br />
| 1 || 2 || || || 1230092<br />
|-<br />
| 2 || 2 || || || 62495628<br />
|-<br />
| 3 || 2 || || || 1745117572<br />
|-<br />
| 4 || 2 || || || 29650630088<br />
|-<br />
| || 3 || || || 330840<br />
|-<br />
| 1 || 3 || || || 32094960<br />
|-<br />
| 2 || 3 || || || 1278079616<br />
|-<br />
| 3 || 3 || || || 27395120928<br />
|-<br />
| 4 || 3 || || || 348892008792<br />
|-<br />
| || || 1 || || 140<br />
|-<br />
| 1 || || 1 || || 20072<br />
|-<br />
| 2 || || 1 || || 1219008<br />
|-<br />
| 3 || || 1 || || 41283320<br />
|-<br />
| 4 || || 1 || || 864647388<br />
|-<br />
| || 1 || 1 || || 16896<br />
|-<br />
| 1 || 1 || 1 || || 1966664<br />
|-<br />
| 2 || 1 || 1 || || 95386968<br />
|-<br />
| 3 || 1 || 1 || || 2532545416<br />
|-<br />
| 4 || 1 || 1 || || 40721312760<br />
|-<br />
| || 2 || 1 || || 786968<br />
|-<br />
| 1 || 2 || 1 || || 72831964<br />
|-<br />
| 2 || 2 || 1 || || 2755256320<br />
|-<br />
| 3 || 2 || 1 || || 55828223540<br />
|-<br />
| 4 || 2 || 1 || || 668256987440<br />
|-<br />
| || 3 || 1 || || 18382184<br />
|-<br />
| 1 || 3 || 1 || || 1320017704<br />
|-<br />
| 2 || 3 || 1 || || 37880082192<br />
|-<br />
| 3 || 3 || 1 || || 567343768064<br />
|-<br />
| 4 || 3 || 1 || || 4871721743520<br />
|-<br />
| || || 2 || || 6996<br />
|-<br />
| 1 || || 2 || || 779752<br />
|-<br />
| 2 || || 2 || || 36085692<br />
|-<br />
| 3 || || 2 || || 910464972<br />
|-<br />
| 4 || || 2 || || 13847185918<br />
|-<br />
| || 1 || 2 || || 619136<br />
|-<br />
| 1 || 1 || 2 || || 54625952<br />
|-<br />
| 2 || 1 || 2 || || 1961767760<br />
|-<br />
| 3 || 1 || 2 || || 37549258992<br />
|-<br />
| 4 || 1 || 2 || || 422118615240<br />
|-<br />
| || 2 || 2 || || 20505284<br />
|-<br />
| 1 || 2 || 2 || || 1396400720<br />
|-<br />
| 2 || 2 || 2 || || 37804399592<br />
|-<br />
| 3 || 2 || 2 || || 530879625444<br />
|-<br />
| 4 || 2 || 2 || || 4242772005768<br />
|-<br />
| || 3 || 2 || || 328511112<br />
|-<br />
| 1 || 3 || 2 || || 16757986408<br />
|-<br />
| 2 || 3 || 2 || || 330360758520<br />
|-<br />
| 3 || 3 || 2 || || 3268821509016<br />
|-<br />
| 4 || 3 || 2 || || 17707810153184<br />
|-<br />
| || || || 1 || 120<br />
|-<br />
| 1 || || || 1 || 16528<br />
|-<br />
| 2 || || || 1 || 961464<br />
|-<br />
| 3 || || || 1 || 31086744<br />
|-<br />
| 4 || || || 1 || 619268128<br />
|-<br />
| || 1 || || 1 || 13808<br />
|-<br />
| 1 || 1 || || 1 || 1538520<br />
|-<br />
| 2 || 1 || || 1 || 71194112<br />
|-<br />
| 3 || 1 || || 1 || 1796509352<br />
|-<br />
| 4 || 1 || || 1 || 27329683408<br />
|-<br />
| || 2 || || 1 || 610688<br />
|-<br />
| 1 || 2 || || 1 || 53879808<br />
|-<br />
| 2 || 2 || || 1 || 1935562696<br />
|-<br />
| 3 || 2 || || 1 || 37068246456<br />
|-<br />
| 4 || 2 || || 1 || 417017581256<br />
|-<br />
| || 3 || || 1 || 13477504<br />
|-<br />
| 1 || 3 || || 1 || 918108728<br />
|-<br />
| 2 || 3 || || 1 || 24872048856<br />
|-<br />
| 3 || 3 || || 1 || 349608204104<br />
|-<br />
| 4 || 3 || || 1 || 2797606827136<br />
|-<br />
| || || 1 || 1 || 11360<br />
|-<br />
| 1 || || 1 || 1 || 1211008<br />
|-<br />
| 2 || || 1 || 1 || 53413832<br />
|-<br />
| 3 || || 1 || 1 || 1279310984<br />
|-<br />
| 4 || || 1 || 1 || 18385007248<br />
|-<br />
| || 1 || 1 || 1 || 954544<br />
|-<br />
| 1 || 1 || 1 || 1 || 80194520<br />
|-<br />
| 2 || 1 || 1 || 1 || 2731237000<br />
|-<br />
| 3 || 1 || 1 || 1 || 49341382288<br />
|-<br />
| 4 || 1 || 1 || 1 || 520599890368<br />
|-<br />
| || 2 || 1 || 1 || 29852632<br />
|-<br />
| 1 || 2 || 1 || 1 || 1925751392<br />
|-<br />
| 2 || 2 || 1 || 1 || 49143133528<br />
|-<br />
| 3 || 2 || 1 || 1 || 646677411848<br />
|-<br />
| 4 || 2 || 1 || 1 || 4808897160408<br />
|-<br />
| || 3 || 1 || 1 || 448574416<br />
|-<br />
| 1 || 3 || 1 || 1 || 21536631136<br />
|-<br />
| 2 || 3 || 1 || 1 || 397108468832<br />
|-<br />
| 3 || 3 || 1 || 1 || 3647432090016<br />
|-<br />
| 4 || 3 || 1 || 1 || 18170989432520<br />
|-<br />
| || || 2 || 1 || 371048<br />
|-<br />
| 1 || || 2 || 1 || 29660864<br />
|-<br />
| 2 || || 2 || 1 || 957045912<br />
|-<br />
| 3 || || 2 || 1 || 16298373712<br />
|-<br />
| 4 || || 2 || 1 || 161138941144<br />
|-<br />
| || 1 || 2 || 1 || 21906376<br />
|-<br />
| 1 || 1 || 2 || 1 || 1337029984<br />
|-<br />
| 2 || 1 || 2 || 1 || 32111473656<br />
|-<br />
| 3 || 1 || 2 || 1 || 395146057864<br />
|-<br />
| 4 || 1 || 2 || 1 || 2726362307664<br />
|-<br />
| || 2 || 2 || 1 || 462924032<br />
|-<br />
| 1 || 2 || 2 || 1 || 20886349672<br />
|-<br />
| 2 || 2 || 2 || 1 || 359461539224<br />
|-<br />
| 3 || 2 || 2 || 1 || 3056118386176<br />
|-<br />
| 4 || 2 || 2 || 1 || 13949906853080<br />
|-<br />
| || 3 || 2 || 1 || 4488051160<br />
|-<br />
| 1 || 3 || 2 || 1 || 143891605904<br />
|-<br />
| 2 || 3 || 2 || 1 || 1693472099056<br />
|-<br />
| 3 || 3 || 2 || 1 || 9404689335808<br />
|-<br />
| 4 || 3 || 2 || 1 || 26509655816984<br />
|}<br />
<br />
== References ==<br />
<br />
* [https://hub.darcs.net/thielema/battleship-combinatorics/browse/src/Combinatorics/Battleship/Count/ShortenShip.hs Haskell program] that computes the table<br />
<br />
[[Category:Combinatorics]]</div>Lemminghttps://wiki.haskell.org/index.php?title=Monomorphism&diff=61815Monomorphism2017-05-21T20:01:58Z<p>Lemming: revert spam by TaalbOclim and TabocRelde</p>
<hr />
<div>[[Category:Glossary]]<br />
<br />
Monomorphism is the opposite of [[polymorphism]]. That is, a function is polymorphic if it works for several different types - and thus, a function is ''monomorphic'' if it works only for ''one'' type.<br />
<br />
As an example, <hask>map</hask> is polymorphic. It's type is simply<br />
<br />
<haskell><br />
map :: (a -> b) -> [a] -> [b]<br />
</haskell><br />
<br />
However, the function<br />
<br />
<haskell><br />
foo :: (Int -> Int) -> [Int] -> [Int]<br />
foo = map<br />
</haskell><br />
<br />
performs an identical operation to <hask>map</hask> (as is evident from the second line), but has a monomorphic type; it will ''only'' accept lists of <hask>Int</hask> and functions over them.<br />
<br />
Perhaps you were looking for [[monomorphism restriction]]?</div>Lemminghttps://wiki.haskell.org/index.php?title=Nonogram&diff=60484Nonogram2016-01-04T11:55:14Z<p>Lemming: /* Set based solver */ solution based on exact set cover</p>
<hr />
<div>[[Category:Code]]<br />
Here are some solvers for Nonogram puzzles. A description of what a nonogram is can be found in [[99_questions/95_to_99#Problem_98|Ninety-Nine Haskell Problems]].<br />
<br />
== Backtracking solver ==<br />
<br />
The first solution is a simple backtracking algorithm, but is quite slow for larger problems.<br />
<haskell><br />
data Square = Blank | Cross deriving (Eq)<br />
instance Show Square where<br />
show Blank = " "<br />
show Cross = "X"<br />
<br />
-- create all possibilities of arranging the given blocks in a line of "n" elements<br />
rows n [] = [replicate n Blank]<br />
rows n (k:ks) | n < k = []<br />
rows n (k:ks) = <br />
[Blank : row | row <- rows (n-1) (k:ks)] ++<br />
if null ks then [replicate k Cross ++ replicate (n-k) Blank]<br />
else [replicate k Cross ++ Blank : row | row <- rows (n-k-1) ks]<br />
<br />
-- contract a given line into the block format<br />
-- i.e. contract [Cross,Blank,Cross] == [1,1]<br />
contract = map length . filter (\(x:_) -> x==Cross) . group<br />
<br />
-- create all solutions by combining all possible rows in all possible ways<br />
-- then pick a solution and check whether its block signature fits<br />
solver horz vert = filter fitsVert possSolution<br />
where possSolution = mapM (rows (length vert)) horz<br />
fitsVert rs = map contract (transpose rs) == vert<br />
<br />
-- output the (first) solution<br />
nonogram horz vert = printSolution $ head $ solver horz vert<br />
where printSolution = putStr . unlines . map (concatMap show) . transpose<br />
</haskell><br />
<br />
This is a solution done for simplicity rather than performance. It's SLOOOOW. If I were to check intermediate solutions against the blocks that should come out instead of sequencing everything, the List monad would fail much earlier...<br />
<br />
It builds all combinations of blocks in a row (stolen from solution 2 :) and then builds all combinations of rows. The resulting columns are then contracted into the short block block form and the signature compared to the target.<br />
<br />
== Deducing solver ==<br />
<br />
We can make the search much faster (but more obscure) by deducing the values of as many squares as possible before guessing, as in this solution:<br />
<haskell><br />
module Nonogram where<br />
<br />
import Control.Monad<br />
import Data.List<br />
import Data.Maybe<br />
<br />
type Row s = [s]<br />
type Grid s = [Row s]<br />
<br />
-- partial information about a square<br />
type Square = Maybe Bool<br />
<br />
-- Print the first solution (if any) to the nonogram<br />
nonogram :: [[Int]] -> [[Int]] -> String<br />
nonogram rs cs = case solve rs cs of<br />
[] -> "Inconsistent\n"<br />
(grid:_) -> showGrid rs cs grid<br />
<br />
-- All solutions to the nonogram<br />
solve :: [[Int]] -> [[Int]] -> [Grid Bool]<br />
solve rs cs = [grid' |<br />
-- deduce as many squares as we can<br />
grid <- maybeToList (deduction rs cs),<br />
-- guess the rest, governed by rs<br />
grid' <- zipWithM (rowsMatching nc) rs grid,<br />
-- check each guess against cs<br />
map contract (transpose grid') == cs]<br />
where nc = length cs<br />
contract = map length . filter head . group<br />
<br />
-- A nonogram with all the values we can deduce<br />
deduction :: [[Int]] -> [[Int]] -> Maybe (Grid Square)<br />
deduction rs cs = converge step init<br />
where nr = length rs<br />
nc = length cs<br />
init = replicate nr (replicate nc Nothing)<br />
step = (improve nc rs . transpose) <.> (improve nr cs . transpose)<br />
improve n = zipWithM (common n)<br />
(g <.> f) x = f x >>= g<br />
<br />
-- repeatedly apply f until a fixed point is reached<br />
converge :: (Monad m, Eq a) => (a -> m a) -> a -> m a<br />
converge f s = do<br />
s' <- f s<br />
if s' == s then return s else converge f s'<br />
<br />
-- common n ks partial = commonality between all possible ways of<br />
-- placing blocks of length ks in a row of length n that match partial.<br />
common :: Int -> [Int] -> Row Square -> Maybe (Row Square)<br />
common n ks partial = case rowsMatching n ks partial of<br />
[] -> Nothing<br />
rs -> Just (foldr1 (zipWith unify) (map (map Just) rs))<br />
where unify :: Square -> Square -> Square<br />
unify x y<br />
| x == y = x<br />
| otherwise = Nothing<br />
<br />
-- rowsMatching n ks partial = all possible ways of placing blocks of<br />
-- length ks in a row of length n that match partial.<br />
rowsMatching :: Int -> [Int] -> Row Square -> [Row Bool]<br />
rowsMatching n [] [] = [[]]<br />
rowsMatching n ks [] = []<br />
rowsMatching n ks (Nothing:partial) =<br />
rowsMatchingAux n ks True partial ++<br />
rowsMatchingAux n ks False partial<br />
rowsMatching n ks (Just s:partial) = <br />
rowsMatchingAux n ks s partial<br />
<br />
rowsMatchingAux :: Int -> [Int] -> Bool -> Row Square -> [Row Bool]<br />
rowsMatchingAux n ks False partial =<br />
[False : row | row <- rowsMatching (n-1) ks partial]<br />
rowsMatchingAux n [k] True partial =<br />
[replicate k True ++ replicate (n-k) False |<br />
n >= k && all (/= Just False) front && all (/= Just True) back]<br />
where (front, back) = splitAt (k-1) partial<br />
rowsMatchingAux n (k:ks) True partial =<br />
[replicate k True ++ False : row |<br />
n > k+1 && all (/= Just False) front && blank /= Just True,<br />
row <- rowsMatching (n-k-1) ks partial']<br />
where (front, blank:partial') = splitAt (k-1) partial<br />
<br />
showGrid :: [[Int]] -> [[Int]] -> Grid Bool -> String<br />
showGrid rs cs ss = unlines (zipWith showRow rs ss ++ showCols cs)<br />
where showRow rs ss = concat [['|', cellChar s] | s <- ss] ++ "| " ++<br />
unwords (map show rs)<br />
showCols cs<br />
| all null cs = []<br />
| otherwise = concatMap showCol cs : showCols (map advance cs)<br />
showCol (k:_)<br />
| k < 10 = ' ':show k<br />
| otherwise = show k<br />
showCol [] = " "<br />
cellChar True = 'X'<br />
cellChar False = '_'<br />
advance [] = []<br />
advance (x:xs) = xs<br />
</haskell><br />
We build up knowledge of which squares must be filled and which must be blank, until we can't make any more deductions.<br />
Some puzzles cannot be completely solved in this way, so then we guess values by the same method as the first solution for any remaining squares.<br />
<br />
== Set based solver ==<br />
By: Twan van Laarhoven<br />
<br />
The idea behind this solver is similair to that of most [[Sudoku]] solvers, in each cell a set of its possible values are stored, and these sets are iterativly reduced until a single value remains. Instead of only using the possible values black and white this solver uses positions. If for some row the lengths [4,3] are given, then there are 10 possible positions: <br />
* white, left of both sections of black<br />
* 4 positions inside the first black section.<br />
* between the two black sections<br />
* 3 positions inside the second black section.<br />
* after both sections.<br />
Each cell has a both a horizontal and a vertical set of possible positions/values.<br />
<br />
There are two kinds of passes that are made:<br />
* hStep: for each cell, it can only have values that can follow that of its left neighbour.<br />
* efStep: If a cell is guaranteed to be white/black according to its horizontal value its vertical value must also be white/black, and vice-versa.<br />
The hStep is applied in all four directions by reversing and transposing the board.<br />
<br />
If no more progress can be made using this algorithm, the solver makes a guess. In the first cell that still has multiple choices all these choices are inspected individually by 'splitting' the puzzle into a list of puzzles. These are then solved using the deterministic algorithm. Puzzles that lead to a contradiction (no possible values in a cell) are removed from the list.<br />
<br />
<haskell><br />
module Nonogram where<br />
<br />
import qualified Data.Set as Set<br />
import Data.Set (Set)<br />
import qualified Data.Map as Map<br />
import Data.Map (Map)<br />
import Data.List<br />
<br />
------------------------------------------------------------------------<br />
-- Cells<br />
<br />
-- | The value of a single cell<br />
newtype Value = Value Int<br />
deriving (Eq, Ord, Show)<br />
<br />
-- | Negative values encode empty cells, positive values filled cells<br />
empty (Value n) = n <= 0<br />
full = not . empty<br />
<br />
type Choice = Set Value<br />
<br />
------------------------------------------------------------------------<br />
-- Puzzle<br />
<br />
type Grid = [[Choice]]<br />
<br />
-- | Datatype for solved and unsolved puzzles<br />
data Puzzle = Puzzle<br />
-- | List of rows, containing horizontal choices for each cell<br />
{ gridH :: Grid<br />
-- | List of columns, containing vertical choices for each cell<br />
, gridV :: Grid<br />
-- | What is allowed before/after a specific value?<br />
-- (after (Value 0)) are the values allowed on the first position<br />
, afterH, beforeH :: [Value -> Choice]<br />
, afterV, beforeV :: [Value -> Choice]<br />
}<br />
<br />
instance Eq Puzzle where<br />
p == q = gridH p == gridH q<br />
<br />
instance Show Puzzle where<br />
show = dispGrid . gridH<br />
<br />
-- | Transpose a puzzle (swap horizontal and vertical components)<br />
transposeP :: Puzzle -> Puzzle<br />
transposeP p = Puzzle<br />
{ gridH = gridV p<br />
, gridV = gridH p<br />
, afterH = afterV p<br />
, beforeH = beforeV p<br />
, afterV = afterH p<br />
, beforeV = beforeH p<br />
}<br />
<br />
-- | Display a puzzle<br />
dispGrid = concatMap (\r -> "[" ++ map disp'' r ++ "]\n")<br />
where disp'' x<br />
| Set.null x = 'E'<br />
| setAll full x = '#'<br />
| setAll empty x = '.'<br />
| otherwise = '/'<br />
<br />
------------------------------------------------------------------------<br />
-- Making puzzles<br />
<br />
-- | Make a puzzle, when given the numbers at the edges<br />
puzzle :: [[Int]] -> [[Int]] -> Puzzle<br />
puzzle h v = Puzzle<br />
{ gridH = map (replicate cols . Set.fromList) ordersH<br />
, gridV = map (replicate rows . Set.fromList) ordersV<br />
, afterH = map mkAfter ordersH<br />
, beforeH = map mkAfter (map reverse ordersH)<br />
, afterV = map mkAfter ordersV<br />
, beforeV = map mkAfter (map reverse ordersV)<br />
}<br />
where rows = length h<br />
cols = length v<br />
ordersH = map order h<br />
ordersV = map order v<br />
<br />
-- | Order of allowed values in a single row/column<br />
-- Input = list of lengths of filled cells, which are separated by empty cells<br />
-- Repeats empty values, because those values may be repeated<br />
-- example:<br />
-- order [1,2,3] = map Value [-1,-1, 1, -2,-2, 2,3, -4,-4, 4,5,6, -7,-7]<br />
order :: [Int] -> [Value]<br />
order = order' 1<br />
where order' n [] = [Value (-n), Value (-n)] -- repeated empty cells allowed at the end<br />
order' n (x:xs) = [Value (-n), Value (-n)] ++ map Value [n..n+x-1] ++ order' (n+x) xs<br />
<br />
-- | What values are allowed after a given value in the given order?<br />
mkAfter :: [Value] -> Value -> Choice<br />
mkAfter order = (mkAfterM order Map.!)<br />
<br />
mkAfterM order = Map.fromListWith (Set.union) aftersL<br />
where aftersL = -- after the start (0) the first non empty value, at position 2 is allowed<br />
-- this is a bit of a hack<br />
(if length order > 2<br />
then [(Value 0, Set.singleton (order !! 2))]<br />
else []) ++<br />
-- after each value comes the next one in the list<br />
zip (Value 0:order) (map Set.singleton order)<br />
<br />
------------------------------------------------------------------------<br />
-- Classifying puzzles<br />
<br />
-- | Is a puzzle completely solved?<br />
done :: Puzzle -> Bool<br />
done = all (all ((==1) . Set.size)) . gridH<br />
<br />
-- | Is a puzzle invalid?<br />
invalid :: Puzzle -> Bool<br />
invalid = any (any Set.null) . gridH<br />
<br />
------------------------------------------------------------------------<br />
-- Solving<br />
<br />
-- | Solve a puzzle deterministicly, i.e. don't make any guesses<br />
-- make sure<br />
solveD :: Puzzle -> Puzzle<br />
solveD = takeSame . iterate step<br />
<br />
-- | All solving steps combined, the orientation after a step is the same as before<br />
step = efStep . transposeP . hStep . transposeP . hStep<br />
<br />
-- | A step in the solving process.<br />
-- Propagate allowed values after from left to right<br />
hStep p = p { gridH = gridH'' }<br />
where gridH' = zipWith hStepLTR (afterH p) (gridH p) -- left to right<br />
gridH'' = zipWith hStepRTL (beforeH p) (gridH') -- right to left<br />
<br />
-- | hStep on a single row, from left to right, after is a function that gives the allowed after values<br />
hStepLTR after row = hStepLTR' (after (Value 0)) row<br />
where hStepLTR' _ [] = []<br />
hStepLTR' afterPrev (x:xs) = x' : hStepLTR' afterX' xs<br />
where x' = Set.intersection x afterPrev<br />
afterX' = Set.unions $ map after $ Set.toList x'<br />
-- | Same as hStepRTL, but from right to left, should be given allowed before values<br />
hStepRTL before = reverse . hStepLTR before . reverse<br />
<br />
-- | A step in the solving process<br />
-- Combine horizontal and verticall grids, empty/full in one <-> empty/full in the oter<br />
-- Note: we transpose gridV, to make it compatible with gridH (row-of-cells)<br />
efStep puzzle = puzzle { gridH = gridH', gridV = transpose gridV't }<br />
where (gridH', gridV't) = zzMap ef (gridH puzzle) (transpose (gridV puzzle))<br />
-- Step on a single cell<br />
ef h v = filterCell empty . filterCell full $ (h,v)<br />
-- Step on a single cell, for a single predicate, if either h or v satisfies the predicate<br />
-- then the other is filtered so it will satisfy as well<br />
filterCell pred (h,v) <br />
| setAll pred h = (h, Set.filter pred v)<br />
| setAll pred v = (Set.filter pred h, v)<br />
| otherwise = (h, v)<br />
<br />
------------------------------------------------------------------------<br />
-- Guessing<br />
<br />
-- | Solve a puzzle, gives all solutions<br />
solve :: Puzzle -> [Puzzle]<br />
solve puzzle<br />
| done puzzle' = [puzzle'] -- single solution<br />
| invalid puzzle' = [] -- no solutions<br />
| otherwise = concatMap solve (guess puzzle') -- we have to guess<br />
where puzzle' = solveD puzzle<br />
<br />
-- | Split a puzzle into multiple puzzles, by making a guess at the first position with multiple choices<br />
-- we return all possible puzzles for making a guess at that position<br />
guess :: Puzzle -> [Puzzle]<br />
guess puzzle = map (\gh -> puzzle {gridH = gh} ) gridHs<br />
where gridHs = trySplit (trySplit splitCell) (gridH puzzle)<br />
<br />
-- | Try to split a cell into multiple alternatives<br />
splitCell :: Choice -> [Choice]<br />
splitCell = map Set.singleton . Set.toList<br />
<br />
-- | Try to split a single item in a list using the function f<br />
-- Stops at the first position where f has more than 1 result.<br />
-- TODO: A more soffisticated guessing strategy might be faster.<br />
trySplit :: (a -> [a]) -> [a] -> [[a]]<br />
trySplit f [] = []<br />
trySplit f (x:xs)<br />
| length fx > 1 = map (:xs) fx -- This element is split, don't look further<br />
| length fxs > 1 = map (x:) fxs -- The list is split furter on<br />
| otherwise = []<br />
where fx = f x<br />
fxs = trySplit f xs<br />
<br />
------------------------------------------------------------------------<br />
-- Utilities<br />
<br />
-- | Set.all, similair to Data.List.all<br />
setAll f = all f . Set.toList<br />
<br />
-- | Map a function simultaniously over two lists, like zip<br />
zMap :: (a -> b -> (c, d)) -> [a] -> [b] -> ([c], [d])<br />
zMap f a b = unzip $ zipWith f a b<br />
<br />
-- | Map a function simultaniously over two lists of lists, like zip<br />
zzMap :: (a -> b -> (c, d)) -> [[a]] -> [[b]] -> ([[c]], [[d]])<br />
zzMap f a b = unzip $ zipWith (zMap f) a b<br />
<br />
-- | Find the first item in a list that is repeated<br />
takeSame :: Eq a => [a] -> a<br />
takeSame (a:b:xs)<br />
| a == b = a<br />
| otherwise = takeSame (b:xs)<br />
<br />
------------------------------------------------------------------------<br />
-- Test<br />
</haskell><br />
<br />
Here is a test puzzle that can be used in the solver:<br />
<haskell><br />
-- | A test puzzle<br />
test = puzzle [[6],[3,1,3],[1,3,1,3],[3,14],[1,1,1],<br />
[1,1,2,2],[5,2,2],[5,1,1],[5,3,3,3],[8,3,3,3]]<br />
[[4],[4],[1,5],[3,4],[1,5],[1],[4,1],[2,2,2],<br />
[3,3],[1,1,2],[2,1,1],[1,1,2],[4,1],[1,1,2],<br />
[1,1,1],[2,1,2],[1,1,1],[3,4],[2,2,1],[4,1]]<br />
</haskell><br />
<br />
<br />
== Solver based on exact set cover ==<br />
By Henning Thielemann<br />
<br />
The package {{HackagePackage|id=set-cover}} provides a solver based on a generic set-cover solver.</div>Lemminghttps://wiki.haskell.org/index.php?title=Applications_and_libraries/Games&diff=60483Applications and libraries/Games2016-01-04T11:51:08Z<p>Lemming: /* Games */ board-games</p>
<hr />
<div>{{LibrariesPage}}<br />
<br />
See also: [[Game Development]]<br />
<br />
<br />
== Games ==<br />
<br />
See also the [http://hackage.haskell.org/packages/archive/pkg-list.html#cat:game Game] category on Hackage.<br />
<br />
;{{HackagePackage|id=babylon}}<br />
: An implementation of a simple 2-player board game. Uses wxHaskell.<br />
<br />
;[https://www.haskell.org/communities/11-2015/html/report.html#sect7.13.5 Barbarossa]<br />
:A UCI chess engine written completely in Haskell<br />
<br />
;{{HackagePackage|id=board-games}}<br />
: Computer player algorithms for three games: Connect Four, Rows&Columns, Mastermind. Intended for running as a web server.<br />
<br />
;{{HackagePackage|id=boomslang}}<br />
: A clone of the popular Flash game Boomshine.<br />
<br />
;[https://github.com/yairchu/defend Defend The King from Forces of Different]<br />
: A simple multiplayer real time strategy game.<br />
<br />
; [http://www.increpare.com/2008/11/endless-cavern/ Endless Cavern]<br />
: A 2D procedurally-generated cave exploration game.<br />
<br />
;[http://sourceforge.net/projects/fooengine/?abmode=1 Foo]<br />
:Foo (abbreviation from football) is a playing machine of [http://en.wikipedia.org/wiki/Paper_Soccer Paper Soccer], a pencil and paper game for two players. It contains a simple interface using HOpenGL library and provides many playing algorithms.<br />
<br />
;[[Frag]]<br />
:Frag is a 3D first person shooting game written in Haskell, by Mun Hon Cheong. It uses Yampa, Quake 3 BSP level format and OpenGL. It is licensed under the GPL.<br />
<br />
;[http://mfuglos.github.io/jeopardy Fuglos Jeopardy]<br />
:Fuglos Jeopardy is a free implementation of a game resembling the popular quiz show 'Jeopardy'. It is written using Gtk2Hs as GUI toolkit. It is quite feature complete and easy to use. It contains support for LaTeX, so you can for example use LaTeX math syntax in your data sheets and thus organize a math jeopoardy event. Licensed under GPL3.<br />
<br />
;[[GeBoP]]<br />
:The General Boardgames Player, offers a set of board games: Ataxx, Bamp, Halma, Hex, Kram, Nim, Reversi, TicTacToe, and Zenix. It uses wxHaskell.<br />
<br />
; [http://folk.uio.no/carljsv/gorillabas/GorillaBAS-0.1.tar.gz GorillaBAS]<br />
: A concrete game from an attempt on defining computer games.<br />
<br />
; [https://github.com/ocharles/hadoom hadoom]<br />
:A clone of Doom, using reactive-banana, GTK, and the "diagrams" library.<br />
<br />
; [https://github.com/ivanperez-keera/haskanoid haskanoid]<br />
:An breakout game with SDL graphics and Kinect and Wiimote support. Written in FRP, there's a fork in Haskell for Android.<br />
<br />
;[http://www.informatik.uni-bremen.de/~cxl/lehre/pi3.ws01/asteroids/ Haskell in Space]<br />
:An asteroid like game<br />
<br />
;[http://www.hedgewars.org/ Hedgewars]<br />
:A turn-based artillery game. The game server is written in Haskell.<br />
<br />
;[http://www.cs.ox.ac.uk/people/ian.lynagh/Hetris/ Hetris]<br />
:ASCII Tetris in Haskell<br />
<br />
;{{HackagePackage|id=hfiar}}<br />
:Four in a Row in Haskell. Uses wxHaskell.<br />
<br />
;{{HackagePackage|id=hinvaders}}<br />
:A simple ANSI-graphics space invaders written entirely in Haskell 98.<br />
<br />
;[http://mu.org/~mux/LambdaChess/ LambdaChess]<br />
:GTK chess client<br />
<br />
;[http://quasimal.com/projects/level_0.html Level 0]<br />
:A fun and featureful Snake II clone using SDL.<br />
<br />
;[http://www.ncc.up.pt/~pbv/stuff/lostcities/ Lost Cities]<br />
:A two-player card game where each player tries to mount profitable expeditions. It uses wxHaskell.<br />
<br />
;{{HackagePackage|id=mage}}<br />
:Nethack clone written in Haskell (The web site have [http://www.scannedinavian.com/~shae/mage-1.0pre35.tar.gz this mage-1.0.pre35.tar.gz file] containing an older version that was using Data.FiniteMap.) There seems to be a problem with newer curses library even with the more recent 1.1.0 version.<br />
<br />
;{{HackagePackage|id=MazesOfMonad}}<br />
:Role-Playing Game (influenced by Nethack), complete and fully playable. Console mode only.<br />
<br />
;[http://www.geocities.jp/takascience/haskell/monadius_en.html Monadius]<br />
:Monadius is a shoot 'em up with the selection bar power-up system for Windows, written in Haskell (now on Hackage as {{HackagePackage|id=Monadius}}; see also the [http://www.youtube.com/watch?v=zqFgQiPKtOI video])<br />
<br />
;[http://mokehehe.blogspot.com/2009/04/super-nario-move-to-github.html Monao]<br />
:A Super Mario clone, using an SDL binding different from the one in Hackage: [https://github.com/mokehehe/monao Monao on github], [https://github.com/keera-studios/monao New maintained version on github]<br />
<br />
;[http://joyridelabs.de/game/ Nikki and the Robots]<br />
:A puzzle, platformer game.<br />
<br />
;[http://berlinbrowndev.blogspot.com/2007/09/octane-mech-opengl-haskell-based-mech.html Octane Mech]<br />
:Octane Mech, OpenGL Haskell based mech game<br />
<br />
;[http://sourceforge.net/projects/puzhs/ puzhs]<br />
:Haskell bindings to [https://code.google.com/p/puz/ libpuz]<br />
<br />
;[http://haskell-tetris.pbworks.com/w/page/16967421/Main OpenGL Tetris]<br />
:Tetris in Haskell with OpenGL<br />
<br />
;[http://srineet.brinkster.net/para/para.html Paratrooper]<br />
:Paratrooper is a simple action game that runs on Windows and is written in literate Haskell.<br />
<br />
;[http://raincat.bysusanlin.com/ Raincat]<br />
:2D puzzle game featuring a fuzzy little cat (uses GLUT)<br />
<br />
;[http://roguestar.downstairspeople.org Roguestar]<br />
:Roguestar is a science fiction adventure role playing game using Haskell and OpenGL.<br />
<br />
;{{HackagePackage|id=Shu-thing}}<br />
:A 2-D vector graphics upwards-scrolling keyboard-controlled shooter. You shoot the enemies while dodging their bullets until you reach and defeat the enemy.<br />
<br />
;{{HackagePackage|id=SpaceInvaders}}<br />
:A video game, based on [[Yampa]]<br />
<br />
;{{HackagePackage|id=stunts}}<br />
:A revival of the classic racing game Stunts to serve as a non-toy-sized example for LambdaCube.<br />
<br />
;[https://github.com/nbartlomiej/tfoo Tfoo]<br />
:A simple Five in a Row game. Online, with server-sent events, deployed to [http://tfoo.herokuapp.com/ Heroku], open source.<br />
<br />
;[http://web.jfet.org/~kwantam/TriHs.tar.gz TriHs] (tar.gz)<br />
:A 1- or 2-player Tetris game using Gtk2Hs and Cairo.<br />
<br />
;[[wxAsteroids]]<br />
:Your space ship enters an asteroid belt, try to avoid collisions! wxAsteroids is based on wxHaskell.<br />
<br />
;[http://xiangqiboard.blogspot.com/2007/12/gnuxiangqi-angekndigt.html Xiangqiboard]<br />
:An implementation of xiangqi for Unix, using gtk2hs + cairo<br />
<br />
;{{HackagePackage | id =Yogurt}}<br />
:A functional MUD client featuring prioritized, regex-based hooks, variables, timers, logging, dynamic loading of Yogurt scripts and more. For example programs, please see [http://code.google.com/p/yogurt-mud/ Yogurt's home page]. <br />
<br />
=== Commercial games ===<br />
;[https://play.google.com/store/apps/details?id=uk.co.keera.games.magiccookies Magic Cookies!]<br />
:A lights-out clone for Android written in Haskell using SDL2 graphics and the FRP implementation Yampa. Created by [http://facebook.com/keerastudios Keera Studios].<br />
<br />
<br />
=== Unfinished/in-progress games ===<br />
<br />
;[http://allureofthestars.com Allure of the Stars]<br />
:A near-future Sci-Fi roguelike and tactical squad game. Long-term goals are high replayability and auto-balancing through procedural content generation and persistent content modification based on player behaviour. The game is written using the {{HackagePackage|id=LambdaHack}} roguelike game engine.<br />
<br />
;[http://ipwnstudios.com/node/4 Bloodknight]<br />
:An action RPG for mobile devices<br />
<br />
; [https://github.com/ghulette/haskell-game-of-life haskell-game-of-life]<br />
: Conway's Game of Life<br />
<br />
; [https://github.com/EricThoma/hchess hchess]<br />
: Incomplete toy chess engine<br />
<br />
;[http://dotat.at/prog/life/hslife.hs HsLife]<br />
:A Haskell implementation of hashlife. It uses GLUT.<br />
<br />
== Game Engines and Libraries ==<br />
<br />
;[https://github.com/egonSchiele/actionkid actionkid]<br />
:A video game framework, with a [http://vimeo.com/109663514 video tutorial] and [https://github.com/egonSchiele/chips chips], a game based on it.<br />
<br />
;[[Bogre-Banana]]<br />
:A 3D game-engine for Haskell. It uses Haskell bindings to the OGRE 3D engine and OIS input system and a library called reactive-banana, to create a "Functional Reactive Programming" game-engine.<br />
<br />
;[http://hackage.haskell.org/package/bullet Bullet]<br />
:A wrapper for the Bullet physics engine.<br />
<br />
;[http://hackage.haskell.org/package/free-game free-game]<br />
:A GUI/game library based on free monads.<br />
<br />
;[http://hackage.haskell.org/package/FunGEn FunGEn]<br />
:FunGEn (Functional Game Engine) is a platform-independent BSD-licensed 2D game engine based on OpenGL and GLUT. Its light dependencies make it easy to install, however GLUT is reputed to be unsuitable for simultaneous keypresses. As of 2011 it's the only general-purpose game engine, and the quickest way to throw together [https://github.com/haskell-game/fungen/blob/master/examples/hello.hs simple] [https://github.com/haskell-game/fungen/blob/master/examples/pong/pong.hs 2D] [https://github.com/haskell-game/fungen/blob/master/examples/worms/worms.hs games], in Haskell. Example code: [http://joyful.com/fungen/site/example.html A Brief Example]. Forks and patches welcome!<br />
<br />
;[http://projects.haskell.org/game-tree/ game-tree]<br />
:game-tree is a purely functional library for searching game trees - useful for zero-sum two player games.<br />
<br />
;[http://hackage.haskell.org/package/GLFW-b GLFW-b]<br />
:Bindings to GLFW, a free, open source, multi-platform library for creating OpenGL contexts and managing input, including keyboard, mouse, joystick and time.<br />
<br />
;[http://gloss.ouroborus.net/ Gloss]<br />
:An OpenGL abstraction layer supporting game-style main loops.<br />
<br />
;[https://github.com/haskell-game haskell-game]<br />
:A project to make game development with Haskell easier to get started with by providing a suite of libraries for covering all sorts of aspects of game development.<br />
<br />
;[http://helm-engine.org/ Helm]<br />
:A functionally reactive game engine inspired by [http://elm-lang.org/ Elm].<br />
<br />
;[http://hackage.haskell.org/package/HGamer3D HGamer3D]<br />
:A game engine for Windows which includes Haskell bindings to a couple of C++ libraries and a Haskell API on top of that. Features include Audio, Joystick, Mouse and Keyboard handling, GUI, Network, Physics, 3D graphics. <br />
:[https://www.youtube.com/watch?v=v_GSbObYRkY Y-Wing flight] is a video of a demonstration of the possibilities of HGamer3D.<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Hipmunk Hipmunk]<br />
:Hipmunk: A Haskell binding for [http://chipmunk-physics.net/ Chipmunk]. Chipmunk is a fast, simple, portable, 2D physics engine. It is completely self-contained. See also [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HipmunkPlayground HipmunkPlayground]: a simple OpenGL program that allows you to see some of Hipmunk's functions in action.<br />
<br />
;[https://github.com/asivitz/Hickory Hickory]<br />
:Hickory is not really a game engine. It's more of a collection of tools and abstractions that can be used to make games. It doesn't have opinions and doesn't force you into a particular paradigm.<br />
<br />
;[[Hpysics]]<br />
:Hpysics is a physics engine written using Data Parallel Haskell during Google Summer of Code 2008.<br />
<br />
;[http://hackage.haskell.org/package/hogre hogre]<br />
:Haskell bindings to the excellent OGRE 3D rendering engine. Ogre has been used in commercial games such as Torchlight and several books exist documenting the Ogre API. Ogre uses an MIT license making it compatible with many Haskell libraries.<br />
<br />
;[http://hackage.haskell.org/package/IrrHaskell IrrHaskell]<br />
:Haskell binding to the [http://irrlicht.sourceforge.net/ Irrlicht game engine]. The Irrlicht Engine is an open source high performance realtime 3D engine<br />
<br />
;[http://lambdacube3d.wordpress.com/ LambdaCube 3D]<br />
:LambdaCube 3D is a domain specific language and library that makes it possible to program GPUs in a purely functional style.<br />
<br />
;[http://hackage.haskell.org/package/set-cover set-cover]<br />
:Solver for exact set cover problems. Included examples: [[Sudoku]], [[Mastermind]], [[Nonogram]], Domino tessellation, 8 Queens, Soma Cube, [[Tetris Cube]], Cube of L's, Logika's Baumeister puzzle. Generic algorithm allows to choose between slow but flexible Set from containers package and fast but cumbersome bitvectors.<br />
<br />
<br />
=== Unfinished/in-progress game engines/libraries ===<br />
<br />
;[https://github.com/adorablepuppy/CurryDog CurryDog]<br />
:Aims to be a 2d and 3d modular game engine.<br />
<br />
;[https://github.com/keera-studios/gtk-helpers gtk-helpers]<br />
:A collection of auxiliary operations related to Gtk2hs. See also [http://keera.co.uk/blog/2013/03/19/creating-board-games-in-haskell/ Creating board games in Haskell in 100 lines of code]<br />
<br />
;[[HaskGame]]<br />
:An incomplete graphics system abstraction layer.<br />
<br />
; [https://bananu7.github.io/Hate Hate]<br />
:Hate is a small framework for graphical haskell games and applications. It's heavily inspired by Love and aims at similar ease of use, but within the power of Haskell's type and concurrency safety.<br />
<br />
; [https://github.com/shicks/hsgame hsgame]<br />
:A framework for network games<br />
<br />
;[https://github.com/LambdaHack/LambdaHack LambdaHack]<br />
:A game engine library for roguelike games of arbitrary theme, size and complexity, packaged together with a small example dungeon crawler. When completed, it will let you specify content to be procedurally generated, define the AI behaviour on top of the generic content-independent rules and compile a ready-to-play game binary, using either the supplied or a custom-made main loop. Several frontends are available (GTK is the default) and many other generic engine components are easily overridden, but the fundamental source of flexibility lies in the strict and type-safe separation of code and content.<br />
<br />
<br />
[[Category:Games|*]]<br />
[[Category:Applications]]<br />
[[Category:Libraries]]</div>Lemminghttps://wiki.haskell.org/index.php?title=Applications_and_libraries/Games&diff=60482Applications and libraries/Games2016-01-04T11:49:32Z<p>Lemming: use HackagePackage template</p>
<hr />
<div>{{LibrariesPage}}<br />
<br />
See also: [[Game Development]]<br />
<br />
<br />
== Games ==<br />
<br />
See also the [http://hackage.haskell.org/packages/archive/pkg-list.html#cat:game Game] category on Hackage.<br />
<br />
;{{HackagePackage|id=babylon}}<br />
: An implementation of a simple 2-player board game. Uses wxHaskell.<br />
<br />
;[https://www.haskell.org/communities/11-2015/html/report.html#sect7.13.5 Barbarossa]<br />
:A UCI chess engine written completely in Haskell<br />
<br />
;{{HackagePackage|id=boomslang}}<br />
: A clone of the popular Flash game Boomshine.<br />
<br />
;[https://github.com/yairchu/defend Defend The King from Forces of Different]<br />
: A simple multiplayer real time strategy game.<br />
<br />
; [http://www.increpare.com/2008/11/endless-cavern/ Endless Cavern]<br />
: A 2D procedurally-generated cave exploration game.<br />
<br />
;[http://sourceforge.net/projects/fooengine/?abmode=1 Foo]<br />
:Foo (abbreviation from football) is a playing machine of [http://en.wikipedia.org/wiki/Paper_Soccer Paper Soccer], a pencil and paper game for two players. It contains a simple interface using HOpenGL library and provides many playing algorithms.<br />
<br />
;[[Frag]]<br />
:Frag is a 3D first person shooting game written in Haskell, by Mun Hon Cheong. It uses Yampa, Quake 3 BSP level format and OpenGL. It is licensed under the GPL.<br />
<br />
;[http://mfuglos.github.io/jeopardy Fuglos Jeopardy]<br />
:Fuglos Jeopardy is a free implementation of a game resembling the popular quiz show 'Jeopardy'. It is written using Gtk2Hs as GUI toolkit. It is quite feature complete and easy to use. It contains support for LaTeX, so you can for example use LaTeX math syntax in your data sheets and thus organize a math jeopoardy event. Licensed under GPL3.<br />
<br />
;[[GeBoP]]<br />
:The General Boardgames Player, offers a set of board games: Ataxx, Bamp, Halma, Hex, Kram, Nim, Reversi, TicTacToe, and Zenix. It uses wxHaskell.<br />
<br />
; [http://folk.uio.no/carljsv/gorillabas/GorillaBAS-0.1.tar.gz GorillaBAS]<br />
: A concrete game from an attempt on defining computer games.<br />
<br />
; [https://github.com/ocharles/hadoom hadoom]<br />
:A clone of Doom, using reactive-banana, GTK, and the "diagrams" library.<br />
<br />
; [https://github.com/ivanperez-keera/haskanoid haskanoid]<br />
:An breakout game with SDL graphics and Kinect and Wiimote support. Written in FRP, there's a fork in Haskell for Android.<br />
<br />
;[http://www.informatik.uni-bremen.de/~cxl/lehre/pi3.ws01/asteroids/ Haskell in Space]<br />
:An asteroid like game<br />
<br />
;[http://www.hedgewars.org/ Hedgewars]<br />
:A turn-based artillery game. The game server is written in Haskell.<br />
<br />
;[http://www.cs.ox.ac.uk/people/ian.lynagh/Hetris/ Hetris]<br />
:ASCII Tetris in Haskell<br />
<br />
;{{HackagePackage|id=hfiar}}<br />
:Four in a Row in Haskell. Uses wxHaskell.<br />
<br />
;{{HackagePackage|id=hinvaders}}<br />
:A simple ANSI-graphics space invaders written entirely in Haskell 98.<br />
<br />
;[http://mu.org/~mux/LambdaChess/ LambdaChess]<br />
:GTK chess client<br />
<br />
;[http://quasimal.com/projects/level_0.html Level 0]<br />
:A fun and featureful Snake II clone using SDL.<br />
<br />
;[http://www.ncc.up.pt/~pbv/stuff/lostcities/ Lost Cities]<br />
:A two-player card game where each player tries to mount profitable expeditions. It uses wxHaskell.<br />
<br />
;{{HackagePackage|id=mage}}<br />
:Nethack clone written in Haskell (The web site have [http://www.scannedinavian.com/~shae/mage-1.0pre35.tar.gz this mage-1.0.pre35.tar.gz file] containing an older version that was using Data.FiniteMap.) There seems to be a problem with newer curses library even with the more recent 1.1.0 version.<br />
<br />
;{{HackagePackage|id=MazesOfMonad}}<br />
:Role-Playing Game (influenced by Nethack), complete and fully playable. Console mode only.<br />
<br />
;[http://www.geocities.jp/takascience/haskell/monadius_en.html Monadius]<br />
:Monadius is a shoot 'em up with the selection bar power-up system for Windows, written in Haskell (now on Hackage as {{HackagePackage|id=Monadius}}; see also the [http://www.youtube.com/watch?v=zqFgQiPKtOI video])<br />
<br />
;[http://mokehehe.blogspot.com/2009/04/super-nario-move-to-github.html Monao]<br />
:A Super Mario clone, using an SDL binding different from the one in Hackage: [https://github.com/mokehehe/monao Monao on github], [https://github.com/keera-studios/monao New maintained version on github]<br />
<br />
;[http://joyridelabs.de/game/ Nikki and the Robots]<br />
:A puzzle, platformer game.<br />
<br />
;[http://berlinbrowndev.blogspot.com/2007/09/octane-mech-opengl-haskell-based-mech.html Octane Mech]<br />
:Octane Mech, OpenGL Haskell based mech game<br />
<br />
;[http://sourceforge.net/projects/puzhs/ puzhs]<br />
:Haskell bindings to [https://code.google.com/p/puz/ libpuz]<br />
<br />
;[http://haskell-tetris.pbworks.com/w/page/16967421/Main OpenGL Tetris]<br />
:Tetris in Haskell with OpenGL<br />
<br />
;[http://srineet.brinkster.net/para/para.html Paratrooper]<br />
:Paratrooper is a simple action game that runs on Windows and is written in literate Haskell.<br />
<br />
;[http://raincat.bysusanlin.com/ Raincat]<br />
:2D puzzle game featuring a fuzzy little cat (uses GLUT)<br />
<br />
;[http://roguestar.downstairspeople.org Roguestar]<br />
:Roguestar is a science fiction adventure role playing game using Haskell and OpenGL.<br />
<br />
;{{HackagePackage|id=Shu-thing}}<br />
:A 2-D vector graphics upwards-scrolling keyboard-controlled shooter. You shoot the enemies while dodging their bullets until you reach and defeat the enemy.<br />
<br />
;{{HackagePackage|id=SpaceInvaders}}<br />
:A video game, based on [[Yampa]]<br />
<br />
;{{HackagePackage|id=stunts}}<br />
:A revival of the classic racing game Stunts to serve as a non-toy-sized example for LambdaCube.<br />
<br />
;[https://github.com/nbartlomiej/tfoo Tfoo]<br />
:A simple Five in a Row game. Online, with server-sent events, deployed to [http://tfoo.herokuapp.com/ Heroku], open source.<br />
<br />
;[http://web.jfet.org/~kwantam/TriHs.tar.gz TriHs] (tar.gz)<br />
:A 1- or 2-player Tetris game using Gtk2Hs and Cairo.<br />
<br />
;[[wxAsteroids]]<br />
:Your space ship enters an asteroid belt, try to avoid collisions! wxAsteroids is based on wxHaskell.<br />
<br />
;[http://xiangqiboard.blogspot.com/2007/12/gnuxiangqi-angekndigt.html Xiangqiboard]<br />
:An implementation of xiangqi for Unix, using gtk2hs + cairo<br />
<br />
;{{HackagePackage | id =Yogurt}}<br />
:A functional MUD client featuring prioritized, regex-based hooks, variables, timers, logging, dynamic loading of Yogurt scripts and more. For example programs, please see [http://code.google.com/p/yogurt-mud/ Yogurt's home page]. <br />
<br />
=== Commercial games ===<br />
;[https://play.google.com/store/apps/details?id=uk.co.keera.games.magiccookies Magic Cookies!]<br />
:A lights-out clone for Android written in Haskell using SDL2 graphics and the FRP implementation Yampa. Created by [http://facebook.com/keerastudios Keera Studios].<br />
<br />
<br />
=== Unfinished/in-progress games ===<br />
<br />
;[http://allureofthestars.com Allure of the Stars]<br />
:A near-future Sci-Fi roguelike and tactical squad game. Long-term goals are high replayability and auto-balancing through procedural content generation and persistent content modification based on player behaviour. The game is written using the {{HackagePackage|id=LambdaHack}} roguelike game engine.<br />
<br />
;[http://ipwnstudios.com/node/4 Bloodknight]<br />
:An action RPG for mobile devices<br />
<br />
; [https://github.com/ghulette/haskell-game-of-life haskell-game-of-life]<br />
: Conway's Game of Life<br />
<br />
; [https://github.com/EricThoma/hchess hchess]<br />
: Incomplete toy chess engine<br />
<br />
;[http://dotat.at/prog/life/hslife.hs HsLife]<br />
:A Haskell implementation of hashlife. It uses GLUT.<br />
<br />
== Game Engines and Libraries ==<br />
<br />
;[https://github.com/egonSchiele/actionkid actionkid]<br />
:A video game framework, with a [http://vimeo.com/109663514 video tutorial] and [https://github.com/egonSchiele/chips chips], a game based on it.<br />
<br />
;[[Bogre-Banana]]<br />
:A 3D game-engine for Haskell. It uses Haskell bindings to the OGRE 3D engine and OIS input system and a library called reactive-banana, to create a "Functional Reactive Programming" game-engine.<br />
<br />
;[http://hackage.haskell.org/package/bullet Bullet]<br />
:A wrapper for the Bullet physics engine.<br />
<br />
;[http://hackage.haskell.org/package/free-game free-game]<br />
:A GUI/game library based on free monads.<br />
<br />
;[http://hackage.haskell.org/package/FunGEn FunGEn]<br />
:FunGEn (Functional Game Engine) is a platform-independent BSD-licensed 2D game engine based on OpenGL and GLUT. Its light dependencies make it easy to install, however GLUT is reputed to be unsuitable for simultaneous keypresses. As of 2011 it's the only general-purpose game engine, and the quickest way to throw together [https://github.com/haskell-game/fungen/blob/master/examples/hello.hs simple] [https://github.com/haskell-game/fungen/blob/master/examples/pong/pong.hs 2D] [https://github.com/haskell-game/fungen/blob/master/examples/worms/worms.hs games], in Haskell. Example code: [http://joyful.com/fungen/site/example.html A Brief Example]. Forks and patches welcome!<br />
<br />
;[http://projects.haskell.org/game-tree/ game-tree]<br />
:game-tree is a purely functional library for searching game trees - useful for zero-sum two player games.<br />
<br />
;[http://hackage.haskell.org/package/GLFW-b GLFW-b]<br />
:Bindings to GLFW, a free, open source, multi-platform library for creating OpenGL contexts and managing input, including keyboard, mouse, joystick and time.<br />
<br />
;[http://gloss.ouroborus.net/ Gloss]<br />
:An OpenGL abstraction layer supporting game-style main loops.<br />
<br />
;[https://github.com/haskell-game haskell-game]<br />
:A project to make game development with Haskell easier to get started with by providing a suite of libraries for covering all sorts of aspects of game development.<br />
<br />
;[http://helm-engine.org/ Helm]<br />
:A functionally reactive game engine inspired by [http://elm-lang.org/ Elm].<br />
<br />
;[http://hackage.haskell.org/package/HGamer3D HGamer3D]<br />
:A game engine for Windows which includes Haskell bindings to a couple of C++ libraries and a Haskell API on top of that. Features include Audio, Joystick, Mouse and Keyboard handling, GUI, Network, Physics, 3D graphics. <br />
:[https://www.youtube.com/watch?v=v_GSbObYRkY Y-Wing flight] is a video of a demonstration of the possibilities of HGamer3D.<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Hipmunk Hipmunk]<br />
:Hipmunk: A Haskell binding for [http://chipmunk-physics.net/ Chipmunk]. Chipmunk is a fast, simple, portable, 2D physics engine. It is completely self-contained. See also [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HipmunkPlayground HipmunkPlayground]: a simple OpenGL program that allows you to see some of Hipmunk's functions in action.<br />
<br />
;[https://github.com/asivitz/Hickory Hickory]<br />
:Hickory is not really a game engine. It's more of a collection of tools and abstractions that can be used to make games. It doesn't have opinions and doesn't force you into a particular paradigm.<br />
<br />
;[[Hpysics]]<br />
:Hpysics is a physics engine written using Data Parallel Haskell during Google Summer of Code 2008.<br />
<br />
;[http://hackage.haskell.org/package/hogre hogre]<br />
:Haskell bindings to the excellent OGRE 3D rendering engine. Ogre has been used in commercial games such as Torchlight and several books exist documenting the Ogre API. Ogre uses an MIT license making it compatible with many Haskell libraries.<br />
<br />
;[http://hackage.haskell.org/package/IrrHaskell IrrHaskell]<br />
:Haskell binding to the [http://irrlicht.sourceforge.net/ Irrlicht game engine]. The Irrlicht Engine is an open source high performance realtime 3D engine<br />
<br />
;[http://lambdacube3d.wordpress.com/ LambdaCube 3D]<br />
:LambdaCube 3D is a domain specific language and library that makes it possible to program GPUs in a purely functional style.<br />
<br />
;[http://hackage.haskell.org/package/set-cover set-cover]<br />
:Solver for exact set cover problems. Included examples: [[Sudoku]], [[Mastermind]], [[Nonogram]], Domino tessellation, 8 Queens, Soma Cube, [[Tetris Cube]], Cube of L's, Logika's Baumeister puzzle. Generic algorithm allows to choose between slow but flexible Set from containers package and fast but cumbersome bitvectors.<br />
<br />
<br />
=== Unfinished/in-progress game engines/libraries ===<br />
<br />
;[https://github.com/adorablepuppy/CurryDog CurryDog]<br />
:Aims to be a 2d and 3d modular game engine.<br />
<br />
;[https://github.com/keera-studios/gtk-helpers gtk-helpers]<br />
:A collection of auxiliary operations related to Gtk2hs. See also [http://keera.co.uk/blog/2013/03/19/creating-board-games-in-haskell/ Creating board games in Haskell in 100 lines of code]<br />
<br />
;[[HaskGame]]<br />
:An incomplete graphics system abstraction layer.<br />
<br />
; [https://bananu7.github.io/Hate Hate]<br />
:Hate is a small framework for graphical haskell games and applications. It's heavily inspired by Love and aims at similar ease of use, but within the power of Haskell's type and concurrency safety.<br />
<br />
; [https://github.com/shicks/hsgame hsgame]<br />
:A framework for network games<br />
<br />
;[https://github.com/LambdaHack/LambdaHack LambdaHack]<br />
:A game engine library for roguelike games of arbitrary theme, size and complexity, packaged together with a small example dungeon crawler. When completed, it will let you specify content to be procedurally generated, define the AI behaviour on top of the generic content-independent rules and compile a ready-to-play game binary, using either the supplied or a custom-made main loop. Several frontends are available (GTK is the default) and many other generic engine components are easily overridden, but the fundamental source of flexibility lies in the strict and type-safe separation of code and content.<br />
<br />
<br />
[[Category:Games|*]]<br />
[[Category:Applications]]<br />
[[Category:Libraries]]</div>Lemminghttps://wiki.haskell.org/index.php?title=Applications_and_libraries/Games&diff=60481Applications and libraries/Games2016-01-04T11:45:19Z<p>Lemming: set-cover: more examples, e.g. Mastermind and Nonogram</p>
<hr />
<div>{{LibrariesPage}}<br />
<br />
See also: [[Game Development]]<br />
<br />
<br />
== Games ==<br />
<br />
See also the [http://hackage.haskell.org/packages/archive/pkg-list.html#cat:game Game] category on Hackage.<br />
<br />
;[http://hackage.haskell.org/package/babylon babylon]<br />
: An implementation of a simple 2-player board game. Uses wxHaskell.<br />
<br />
;[https://www.haskell.org/communities/11-2015/html/report.html#sect7.13.5 Barbarossa]<br />
:A UCI chess engine written completely in Haskell<br />
<br />
;[http://hackage.haskell.org/package/boomslang boomslang]<br />
: A clone of the popular Flash game Boomshine.<br />
<br />
;[https://github.com/yairchu/defend Defend The King from Forces of Different]<br />
: A simple multiplayer real time strategy game.<br />
<br />
; [http://www.increpare.com/2008/11/endless-cavern/ Endless Cavern]<br />
: A 2D procedurally-generated cave exploration game.<br />
<br />
;[http://sourceforge.net/projects/fooengine/?abmode=1 Foo]<br />
:Foo (abbreviation from football) is a playing machine of [http://en.wikipedia.org/wiki/Paper_Soccer Paper Soccer], a pencil and paper game for two players. It contains a simple interface using HOpenGL library and provides many playing algorithms.<br />
<br />
;[[Frag]]<br />
:Frag is a 3D first person shooting game written in Haskell, by Mun Hon Cheong. It uses Yampa, Quake 3 BSP level format and OpenGL. It is licensed under the GPL.<br />
<br />
;[http://mfuglos.github.io/jeopardy Fuglos Jeopardy]<br />
:Fuglos Jeopardy is a free implementation of a game resembling the popular quiz show 'Jeopardy'. It is written using Gtk2Hs as GUI toolkit. It is quite feature complete and easy to use. It contains support for LaTeX, so you can for example use LaTeX math syntax in your data sheets and thus organize a math jeopoardy event. Licensed under GPL3.<br />
<br />
;[[GeBoP]]<br />
:The General Boardgames Player, offers a set of board games: Ataxx, Bamp, Halma, Hex, Kram, Nim, Reversi, TicTacToe, and Zenix. It uses wxHaskell.<br />
<br />
; [http://folk.uio.no/carljsv/gorillabas/GorillaBAS-0.1.tar.gz GorillaBAS]<br />
: A concrete game from an attempt on defining computer games.<br />
<br />
; [https://github.com/ocharles/hadoom hadoom]<br />
:A clone of Doom, using reactive-banana, GTK, and the "diagrams" library.<br />
<br />
; [https://github.com/ivanperez-keera/haskanoid haskanoid]<br />
:An breakout game with SDL graphics and Kinect and Wiimote support. Written in FRP, there's a fork in Haskell for Android.<br />
<br />
;[http://www.informatik.uni-bremen.de/~cxl/lehre/pi3.ws01/asteroids/ Haskell in Space]<br />
:An asteroid like game<br />
<br />
;[http://www.hedgewars.org/ Hedgewars]<br />
:A turn-based artillery game. The game server is written in Haskell.<br />
<br />
;[http://www.cs.ox.ac.uk/people/ian.lynagh/Hetris/ Hetris]<br />
:ASCII Tetris in Haskell<br />
<br />
;[http://hackage.haskell.org/package/hfiar hfiar]<br />
:Four in a Row in Haskell. Uses wxHaskell.<br />
<br />
;[http://hackage.haskell.org/package/hinvaders hinvaders]<br />
:A simple ANSI-graphics space invaders written entirely in Haskell 98.<br />
<br />
;[http://mu.org/~mux/LambdaChess/ LambdaChess]<br />
:GTK chess client<br />
<br />
;[http://quasimal.com/projects/level_0.html Level 0]<br />
:A fun and featureful Snake II clone using SDL.<br />
<br />
;[http://www.ncc.up.pt/~pbv/stuff/lostcities/ Lost Cities]<br />
:A two-player card game where each player tries to mount profitable expeditions. It uses wxHaskell.<br />
<br />
;[http://hackage.haskell.org/package/mage Mage]<br />
:Nethack clone written in Haskell (The web site have [http://www.scannedinavian.com/~shae/mage-1.0pre35.tar.gz this mage-1.0.pre35.tar.gz file] containing an older version that was using Data.FiniteMap.) There seems to be a problem with newer curses library even with the more recent 1.1.0 version.<br />
<br />
;[http://hackage.haskell.org/package/MazesOfMonad MazesOfMonad]<br />
:Role-Playing Game (influenced by Nethack), complete and fully playable. Console mode only.<br />
<br />
;[http://www.geocities.jp/takascience/haskell/monadius_en.html Monadius]<br />
:Monadius is a shoot 'em up with the selection bar power-up system for Windows, written in Haskell (now on [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Monadius Hackage]; see also the [http://www.youtube.com/watch?v=zqFgQiPKtOI video])<br />
<br />
;[http://mokehehe.blogspot.com/2009/04/super-nario-move-to-github.html Monao]<br />
:A Super Mario clone, using an SDL binding different from the one in Hackage: [https://github.com/mokehehe/monao Monao on github], [https://github.com/keera-studios/monao New maintained version on github]<br />
<br />
;[http://joyridelabs.de/game/ Nikki and the Robots]<br />
:A puzzle, platformer game.<br />
<br />
;[http://berlinbrowndev.blogspot.com/2007/09/octane-mech-opengl-haskell-based-mech.html Octane Mech]<br />
:Octane Mech, OpenGL Haskell based mech game<br />
<br />
;[http://sourceforge.net/projects/puzhs/ puzhs]<br />
:Haskell bindings to [https://code.google.com/p/puz/ libpuz]<br />
<br />
;[http://haskell-tetris.pbworks.com/w/page/16967421/Main OpenGL Tetris]<br />
:Tetris in Haskell with OpenGL<br />
<br />
;[http://srineet.brinkster.net/para/para.html Paratrooper]<br />
:Paratrooper is a simple action game that runs on Windows and is written in literate Haskell.<br />
<br />
;[http://raincat.bysusanlin.com/ Raincat]<br />
:2D puzzle game featuring a fuzzy little cat (uses GLUT)<br />
<br />
;[http://roguestar.downstairspeople.org Roguestar]<br />
:Roguestar is a science fiction adventure role playing game using Haskell and OpenGL.<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Shu-thing Shu-thing]<br />
:A 2-D vector graphics upwards-scrolling keyboard-controlled shooter. You shoot the enemies while dodging their bullets until you reach and defeat the enemy.<br />
<br />
;[http://hackage.haskell.org/package/SpaceInvaders Space Invaders]<br />
:A video game, based on [[Yampa]]<br />
<br />
;[http://hackage.haskell.org/package/stunts stunts]<br />
:A revival of the classic racing game Stunts to serve as a non-toy-sized example for LambdaCube.<br />
<br />
;[https://github.com/nbartlomiej/tfoo Tfoo]<br />
:A simple Five in a Row game. Online, with server-sent events, deployed to [http://tfoo.herokuapp.com/ Heroku], open source.<br />
<br />
;[http://web.jfet.org/~kwantam/TriHs.tar.gz TriHs] (tar.gz)<br />
:A 1- or 2-player Tetris game using Gtk2Hs and Cairo.<br />
<br />
;[[wxAsteroids]]<br />
:Your space ship enters an asteroid belt, try to avoid collisions! wxAsteroids is based on wxHaskell.<br />
<br />
;[http://xiangqiboard.blogspot.com/2007/12/gnuxiangqi-angekndigt.html Xiangqiboard]<br />
:An implementation of xiangqi for Unix, using gtk2hs + cairo<br />
<br />
;{{HackagePackage | id =Yogurt}}<br />
:A functional MUD client featuring prioritized, regex-based hooks, variables, timers, logging, dynamic loading of Yogurt scripts and more. For example programs, please see [http://code.google.com/p/yogurt-mud/ Yogurt's home page]. <br />
<br />
=== Commercial games ===<br />
;[https://play.google.com/store/apps/details?id=uk.co.keera.games.magiccookies Magic Cookies!]<br />
:A lights-out clone for Android written in Haskell using SDL2 graphics and the FRP implementation Yampa. Created by [http://facebook.com/keerastudios Keera Studios].<br />
<br />
<br />
=== Unfinished/in-progress games ===<br />
<br />
;[http://allureofthestars.com Allure of the Stars]<br />
:A near-future Sci-Fi roguelike and tactical squad game. Long-term goals are high replayability and auto-balancing through procedural content generation and persistent content modification based on player behaviour. The game is written using the [http://hackage.haskell.org/package/LambdaHack LambdaHack] roguelike game engine.<br />
<br />
;[http://ipwnstudios.com/node/4 Bloodknight]<br />
:An action RPG for mobile devices<br />
<br />
; [https://github.com/ghulette/haskell-game-of-life haskell-game-of-life]<br />
: Conway's Game of Life<br />
<br />
; [https://github.com/EricThoma/hchess hchess]<br />
: Incomplete toy chess engine<br />
<br />
;[http://dotat.at/prog/life/hslife.hs HsLife]<br />
:A Haskell implementation of hashlife. It uses GLUT.<br />
<br />
== Game Engines and Libraries ==<br />
<br />
;[https://github.com/egonSchiele/actionkid actionkid]<br />
:A video game framework, with a [http://vimeo.com/109663514 video tutorial] and [https://github.com/egonSchiele/chips chips], a game based on it.<br />
<br />
;[[Bogre-Banana]]<br />
:A 3D game-engine for Haskell. It uses Haskell bindings to the OGRE 3D engine and OIS input system and a library called reactive-banana, to create a "Functional Reactive Programming" game-engine.<br />
<br />
;[http://hackage.haskell.org/package/bullet Bullet]<br />
:A wrapper for the Bullet physics engine.<br />
<br />
;[http://hackage.haskell.org/package/free-game free-game]<br />
:A GUI/game library based on free monads.<br />
<br />
;[http://hackage.haskell.org/package/FunGEn FunGEn]<br />
:FunGEn (Functional Game Engine) is a platform-independent BSD-licensed 2D game engine based on OpenGL and GLUT. Its light dependencies make it easy to install, however GLUT is reputed to be unsuitable for simultaneous keypresses. As of 2011 it's the only general-purpose game engine, and the quickest way to throw together [https://github.com/haskell-game/fungen/blob/master/examples/hello.hs simple] [https://github.com/haskell-game/fungen/blob/master/examples/pong/pong.hs 2D] [https://github.com/haskell-game/fungen/blob/master/examples/worms/worms.hs games], in Haskell. Example code: [http://joyful.com/fungen/site/example.html A Brief Example]. Forks and patches welcome!<br />
<br />
;[http://projects.haskell.org/game-tree/ game-tree]<br />
:game-tree is a purely functional library for searching game trees - useful for zero-sum two player games.<br />
<br />
;[http://hackage.haskell.org/package/GLFW-b GLFW-b]<br />
:Bindings to GLFW, a free, open source, multi-platform library for creating OpenGL contexts and managing input, including keyboard, mouse, joystick and time.<br />
<br />
;[http://gloss.ouroborus.net/ Gloss]<br />
:An OpenGL abstraction layer supporting game-style main loops.<br />
<br />
;[https://github.com/haskell-game haskell-game]<br />
:A project to make game development with Haskell easier to get started with by providing a suite of libraries for covering all sorts of aspects of game development.<br />
<br />
;[http://helm-engine.org/ Helm]<br />
:A functionally reactive game engine inspired by [http://elm-lang.org/ Elm].<br />
<br />
;[http://hackage.haskell.org/package/HGamer3D HGamer3D]<br />
:A game engine for Windows which includes Haskell bindings to a couple of C++ libraries and a Haskell API on top of that. Features include Audio, Joystick, Mouse and Keyboard handling, GUI, Network, Physics, 3D graphics. <br />
:[https://www.youtube.com/watch?v=v_GSbObYRkY Y-Wing flight] is a video of a demonstration of the possibilities of HGamer3D.<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Hipmunk Hipmunk]<br />
:Hipmunk: A Haskell binding for [http://chipmunk-physics.net/ Chipmunk]. Chipmunk is a fast, simple, portable, 2D physics engine. It is completely self-contained. See also [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HipmunkPlayground HipmunkPlayground]: a simple OpenGL program that allows you to see some of Hipmunk's functions in action.<br />
<br />
;[https://github.com/asivitz/Hickory Hickory]<br />
:Hickory is not really a game engine. It's more of a collection of tools and abstractions that can be used to make games. It doesn't have opinions and doesn't force you into a particular paradigm.<br />
<br />
;[[Hpysics]]<br />
:Hpysics is a physics engine written using Data Parallel Haskell during Google Summer of Code 2008.<br />
<br />
;[http://hackage.haskell.org/package/hogre hogre]<br />
:Haskell bindings to the excellent OGRE 3D rendering engine. Ogre has been used in commercial games such as Torchlight and several books exist documenting the Ogre API. Ogre uses an MIT license making it compatible with many Haskell libraries.<br />
<br />
;[http://hackage.haskell.org/package/IrrHaskell IrrHaskell]<br />
:Haskell binding to the [http://irrlicht.sourceforge.net/ Irrlicht game engine]. The Irrlicht Engine is an open source high performance realtime 3D engine<br />
<br />
;[http://lambdacube3d.wordpress.com/ LambdaCube 3D]<br />
:LambdaCube 3D is a domain specific language and library that makes it possible to program GPUs in a purely functional style.<br />
<br />
;[http://hackage.haskell.org/package/set-cover set-cover]<br />
:Solver for exact set cover problems. Included examples: [[Sudoku]], [[Mastermind]], [[Nonogram]], Domino tessellation, 8 Queens, Soma Cube, [[Tetris Cube]], Cube of L's, Logika's Baumeister puzzle. Generic algorithm allows to choose between slow but flexible Set from containers package and fast but cumbersome bitvectors.<br />
<br />
<br />
=== Unfinished/in-progress game engines/libraries ===<br />
<br />
;[https://github.com/adorablepuppy/CurryDog CurryDog]<br />
:Aims to be a 2d and 3d modular game engine.<br />
<br />
;[https://github.com/keera-studios/gtk-helpers gtk-helpers]<br />
:A collection of auxiliary operations related to Gtk2hs. See also [http://keera.co.uk/blog/2013/03/19/creating-board-games-in-haskell/ Creating board games in Haskell in 100 lines of code]<br />
<br />
;[[HaskGame]]<br />
:An incomplete graphics system abstraction layer.<br />
<br />
; [https://bananu7.github.io/Hate Hate]<br />
:Hate is a small framework for graphical haskell games and applications. It's heavily inspired by Love and aims at similar ease of use, but within the power of Haskell's type and concurrency safety.<br />
<br />
; [https://github.com/shicks/hsgame hsgame]<br />
:A framework for network games<br />
<br />
;[https://github.com/LambdaHack/LambdaHack LambdaHack]<br />
:A game engine library for roguelike games of arbitrary theme, size and complexity, packaged together with a small example dungeon crawler. When completed, it will let you specify content to be procedurally generated, define the AI behaviour on top of the generic content-independent rules and compile a ready-to-play game binary, using either the supplied or a custom-made main loop. Several frontends are available (GTK is the default) and many other generic engine components are easily overridden, but the fundamental source of flexibility lies in the strict and type-safe separation of code and content.<br />
<br />
<br />
[[Category:Games|*]]<br />
[[Category:Applications]]<br />
[[Category:Libraries]]</div>Lemminghttps://wiki.haskell.org/index.php?title=Applications_and_libraries/Games&diff=60480Applications and libraries/Games2016-01-04T11:42:11Z<p>Lemming: set-cover package moved to mature packages</p>
<hr />
<div>{{LibrariesPage}}<br />
<br />
See also: [[Game Development]]<br />
<br />
<br />
== Games ==<br />
<br />
See also the [http://hackage.haskell.org/packages/archive/pkg-list.html#cat:game Game] category on Hackage.<br />
<br />
;[http://hackage.haskell.org/package/babylon babylon]<br />
: An implementation of a simple 2-player board game. Uses wxHaskell.<br />
<br />
;[https://www.haskell.org/communities/11-2015/html/report.html#sect7.13.5 Barbarossa]<br />
:A UCI chess engine written completely in Haskell<br />
<br />
;[http://hackage.haskell.org/package/boomslang boomslang]<br />
: A clone of the popular Flash game Boomshine.<br />
<br />
;[https://github.com/yairchu/defend Defend The King from Forces of Different]<br />
: A simple multiplayer real time strategy game.<br />
<br />
; [http://www.increpare.com/2008/11/endless-cavern/ Endless Cavern]<br />
: A 2D procedurally-generated cave exploration game.<br />
<br />
;[http://sourceforge.net/projects/fooengine/?abmode=1 Foo]<br />
:Foo (abbreviation from football) is a playing machine of [http://en.wikipedia.org/wiki/Paper_Soccer Paper Soccer], a pencil and paper game for two players. It contains a simple interface using HOpenGL library and provides many playing algorithms.<br />
<br />
;[[Frag]]<br />
:Frag is a 3D first person shooting game written in Haskell, by Mun Hon Cheong. It uses Yampa, Quake 3 BSP level format and OpenGL. It is licensed under the GPL.<br />
<br />
;[http://mfuglos.github.io/jeopardy Fuglos Jeopardy]<br />
:Fuglos Jeopardy is a free implementation of a game resembling the popular quiz show 'Jeopardy'. It is written using Gtk2Hs as GUI toolkit. It is quite feature complete and easy to use. It contains support for LaTeX, so you can for example use LaTeX math syntax in your data sheets and thus organize a math jeopoardy event. Licensed under GPL3.<br />
<br />
;[[GeBoP]]<br />
:The General Boardgames Player, offers a set of board games: Ataxx, Bamp, Halma, Hex, Kram, Nim, Reversi, TicTacToe, and Zenix. It uses wxHaskell.<br />
<br />
; [http://folk.uio.no/carljsv/gorillabas/GorillaBAS-0.1.tar.gz GorillaBAS]<br />
: A concrete game from an attempt on defining computer games.<br />
<br />
; [https://github.com/ocharles/hadoom hadoom]<br />
:A clone of Doom, using reactive-banana, GTK, and the "diagrams" library.<br />
<br />
; [https://github.com/ivanperez-keera/haskanoid haskanoid]<br />
:An breakout game with SDL graphics and Kinect and Wiimote support. Written in FRP, there's a fork in Haskell for Android.<br />
<br />
;[http://www.informatik.uni-bremen.de/~cxl/lehre/pi3.ws01/asteroids/ Haskell in Space]<br />
:An asteroid like game<br />
<br />
;[http://www.hedgewars.org/ Hedgewars]<br />
:A turn-based artillery game. The game server is written in Haskell.<br />
<br />
;[http://www.cs.ox.ac.uk/people/ian.lynagh/Hetris/ Hetris]<br />
:ASCII Tetris in Haskell<br />
<br />
;[http://hackage.haskell.org/package/hfiar hfiar]<br />
:Four in a Row in Haskell. Uses wxHaskell.<br />
<br />
;[http://hackage.haskell.org/package/hinvaders hinvaders]<br />
:A simple ANSI-graphics space invaders written entirely in Haskell 98.<br />
<br />
;[http://mu.org/~mux/LambdaChess/ LambdaChess]<br />
:GTK chess client<br />
<br />
;[http://quasimal.com/projects/level_0.html Level 0]<br />
:A fun and featureful Snake II clone using SDL.<br />
<br />
;[http://www.ncc.up.pt/~pbv/stuff/lostcities/ Lost Cities]<br />
:A two-player card game where each player tries to mount profitable expeditions. It uses wxHaskell.<br />
<br />
;[http://hackage.haskell.org/package/mage Mage]<br />
:Nethack clone written in Haskell (The web site have [http://www.scannedinavian.com/~shae/mage-1.0pre35.tar.gz this mage-1.0.pre35.tar.gz file] containing an older version that was using Data.FiniteMap.) There seems to be a problem with newer curses library even with the more recent 1.1.0 version.<br />
<br />
;[http://hackage.haskell.org/package/MazesOfMonad MazesOfMonad]<br />
:Role-Playing Game (influenced by Nethack), complete and fully playable. Console mode only.<br />
<br />
;[http://www.geocities.jp/takascience/haskell/monadius_en.html Monadius]<br />
:Monadius is a shoot 'em up with the selection bar power-up system for Windows, written in Haskell (now on [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Monadius Hackage]; see also the [http://www.youtube.com/watch?v=zqFgQiPKtOI video])<br />
<br />
;[http://mokehehe.blogspot.com/2009/04/super-nario-move-to-github.html Monao]<br />
:A Super Mario clone, using an SDL binding different from the one in Hackage: [https://github.com/mokehehe/monao Monao on github], [https://github.com/keera-studios/monao New maintained version on github]<br />
<br />
;[http://joyridelabs.de/game/ Nikki and the Robots]<br />
:A puzzle, platformer game.<br />
<br />
;[http://berlinbrowndev.blogspot.com/2007/09/octane-mech-opengl-haskell-based-mech.html Octane Mech]<br />
:Octane Mech, OpenGL Haskell based mech game<br />
<br />
;[http://sourceforge.net/projects/puzhs/ puzhs]<br />
:Haskell bindings to [https://code.google.com/p/puz/ libpuz]<br />
<br />
;[http://haskell-tetris.pbworks.com/w/page/16967421/Main OpenGL Tetris]<br />
:Tetris in Haskell with OpenGL<br />
<br />
;[http://srineet.brinkster.net/para/para.html Paratrooper]<br />
:Paratrooper is a simple action game that runs on Windows and is written in literate Haskell.<br />
<br />
;[http://raincat.bysusanlin.com/ Raincat]<br />
:2D puzzle game featuring a fuzzy little cat (uses GLUT)<br />
<br />
;[http://roguestar.downstairspeople.org Roguestar]<br />
:Roguestar is a science fiction adventure role playing game using Haskell and OpenGL.<br />
<br />
;[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Shu-thing Shu-thing]<br />
:A 2-D vector graphics upwards-scrolling keyboard-controlled shooter. You shoot the enemies while dodging their bullets until you reach and defeat the enemy.<br />
<br />
;[http://hackage.haskell.org/package/SpaceInvaders Space Invaders]<br />
:A video game, based on [[Yampa]]<br />
<br />
;[http://hackage.haskell.org/package/stunts stunts]<br />
:A revival of the classic racing game Stunts to serve as a non-toy-sized example for LambdaCube.<br />
<br />
;[https://github.com/nbartlomiej/tfoo Tfoo]<br />
:A simple Five in a Row game. Online, with server-sent events, deployed to [http://tfoo.herokuapp.com/ Heroku], open source.<br />
<br />
;[http://web.jfet.org/~kwantam/TriHs.tar.gz TriHs] (tar.gz)<br />
:A 1- or 2-player Tetris game using Gtk2Hs and Cairo.<br />
<br />
;[[wxAsteroids]]<br />
:Your s