Find Jobs
Hire Freelancers

I need help on haskell connect four

$30-250 USD

Chiuso
Pubblicato più di 5 anni fa

$30-250 USD

Pagato al completamento
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!
Rif. progetto: 18260656

Info sul progetto

5 proposte
Progetto a distanza
Attivo 5 anni fa

Hai voglia di guadagnare un po'?

I vantaggi delle offerte su Freelancer

Imposta il tuo budget e le scadenze
Fatti pagare per il lavoro svolto
Delinea la tua proposta
La registrazione e le offerte sui lavori sono gratuite
5 freelance hanno fatto un'offerta media di $138 USD
Avatar dell'utente
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 giorni
4,9 (75 valutazioni)
6,3
6,3
Avatar dell'utente
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 giorni
5,0 (8 valutazioni)
3,2
3,2
Avatar dell'utente
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 giorni
0,0 (0 valutazioni)
0,0
0,0

Info sul cliente

Bandiera: UNITED STATES
El Paso, United States
0,0
0
Membro dal nov 29, 2018

Verifica del cliente

Grazie! Ti abbiamo inviato tramite email il link per richiedere il tuo bonus gratuito.
Non è stato possibile inviarti l'email. Riprova per piacere.
di utenti registrati di lavori pubblicati
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Caricamento anteprima
Autorizzazione per la geolocalizzazione concessa.
La tua sessione è scaduta ed è stato effettuato il log out. Accedi nuovamente per piacere.