Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

yashsriv/haskell-connect-4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

haskell-connect-4

Implementation of Connect 4 in Haskell

Application Spec

A board can be represented as such:

-- TypeDef for a columnn for more verbose code
type Column = Int

-- Enumeration for the 3 Colors
data Color = Empty | Red | Yellow

-- Board is just a 2 Dimensional List
data Board = Board [[Color]]

Functions Needed:

-- Returns Columns whose topmost row is still not filled
possibleMoves :: Board -> [Column]

-- Update the Board
makeMove :: Board -> Color -> Column -> Board

-- Check if a player of particular color has won
checkWin :: Board -> Color -> Bool

-- Calculate value of a particular board w.r.t to Color
valuation :: Board -> Color -> Int

-- Generate all possible next move positions
-- Uses possibleMoves and makeMove
moves :: Board -> Color -> [Board]

About

Implementation of Connect 4 in Haskell

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published