Find Jobs
Hire Freelancers

I need help on haskell connect four

$30-250 USD

Closed
Posted over 5 years ago

$30-250 USD

Paid on delivery
I am a student and we were assigned a project in haskell. I have been trying for days but cannot seem to grasp the concept. Help would be much appreciated!
Project ID: 18260656

About the project

5 proposals
Remote project
Active 5 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
5 freelancers are bidding on average $138 USD for this job
User Avatar
Hello Sir, I am a computer science tutor, I teach (among others) Haskell, LISP, Prolog, and Advanced Algorithms. I have done many projects like this, and I'm one of the top Haskell developers, and you can check by clicking on my profile picture. Please contact me for more details when possible. I look forward to work for you, Sir. Best Regards.
$150 USD in 2 days
4.9 (75 reviews)
6.3
6.3
User Avatar
I have been using Haskell for over ten years now, and I'm starting to get the hang of it. I was a math and English major and graduated from Caltech in 1975. I've been programming since then in Fortran, Forth, Perl, and most recently, Haskell. I went ahead and started your project, just to see how complicated it was. Here is the code so far: module Board where data Board = B { nCols :: Int , nRows :: Int , b :: [[Int]] } deriving Show mkBoard :: Int -> Int -> Board mkBoard m n = B m n (replicate m (replicate n 0)) type Player = Int mkPlayer, mkOpponennt :: Player mkPlayer = 1 mkOpponennt = 2 col :: Int -> Board -> [Int] col i bd = (b bd) !! (i-1) replaceAt :: Int -> a -> [a] -> [a] replaceAt i new lofl = let (before,(_:after)) = splitAt (i-1) lofl in before ++ (new:after) dropInSlot :: Board -> Int -> Player -> Board dropInSlot bd i p = let c = col i bd (before,after) = span (== 0) c newCol = init before ++ (p:after) newB = replaceAt i newCol (b bd) in bd {b = newB} playerToChar :: Player -> Char playerToChar 0 = '.' playerToChar 1 = 'X' playerToChar 2 = 'O' transpose :: [[a]] -> [[a]] transpose [] = [] transpose ([] : xss) = transpose xss transpose ((x:xs) : xss) = (x : [h | (h:_) <- xss]) : transpose (xs : [ t | (_:t) <- xss]) boardToStr playerToChar bd = let t = transpose (b bd) withSpaces p = [' ', playerToChar p] in unlines . map (concatMap withSpaces) $ t play with it if you like
$100 USD in 3 days
5.0 (8 reviews)
3.2
3.2
User Avatar
Write me, what kind of help do you need. Are you asking for writing the entire project or explaining some aspects? :)
$222 USD in 4 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
El Paso, United States
0.0
0
Member since Nov 29, 2018

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.