GithubHelp home page GithubHelp logo

haskellasignements's Introduction

CSC4020F Assignment 1

University of Cape Town

Willie Macharia (MCHWIL006)

Building, running a sample, cleaning

The assignemnt is made of 3 parts that is part 1, part 2 and part 3.

The files are named as "Part"+questionnumber.hs for example PartA_question1.hs means the question is in part A and is question 1

To run the files; invoke the command make run[PART][QUESTION NUMBER] example command make runA1 means run question 1 in part A. see the makefile for details.

Question C code is in QuestionC_question1.hs. The alogorithm used to design the turing machine is mentioned and illustrated at the top of the file. Turing machine picture is also in palindrome.jpg file.

STEPS TO RUN QUESTION C:

  1. To run it kindly run make runC1
  2. Call function palindromeTM "ANYSTRING" EXAMPLE BELOW

To verify the turing machine is working; try palindromeTM "ANYSTRING" For example palindromeTM "ababa' returns 'a' meaning it is palindrome.

For simulation of string "aba" see the table below and also open palindrome.jpg to see the steps shown.

| Step | <Current State,Input,output,Next state>| | input|output| To run it; run make runC1 first and then ;

palndromeTM "aba"

| step 1 | <q0,a,u,q1> | | "aba"| "ba"| | step 2 | <q1,b,b,q1> | | "ba"| "ba"| | step 3 | <q1,a,a,q1> | | "ba"| "ba"| | step 4 | <q1,u,u,q2> | | "ba"| "ba"| | step 5 | <q2,a,u,q3> | | "ba"| "b"| | step 6 | <q3,b,b,q3> | | "b"| "b"| | step 7 | <q3,u,u,qo> | | "b"| "b"| | step 8 | <q0,b,u,q4> | | ""| ""| | step 9 | <q4,u,u,q5> | | ""| ""| | step 10| <q5,u,u,q0> | | ""| "__"| | step 11| <q0,u,u,ACCEPT> | ACCEPTED STRING

haskellasignements's People

Contributors

willie84 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.