Commit 550a44c9 authored by Christopher League's avatar Christopher League
Browse files

Start on A3

parent b4087848
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE OverloadedStrings #-}
module App.Assn3
( handleU2LogicAssnR
, assn3
, a3SubmittedBadge
) where
import App.Activity
import App.YamlStore
import App.User
import App.Prelude
import qualified Data.Set as Set
import qualified Data.Map as Map
import Data.Maybe (fromJust)
import App.Foundation
import qualified Hedgehog.Internal.Gen as Gen
import qualified Hedgehog.Internal.Tree as Gen ()
import qualified Hedgehog.Internal.Seed as Gen (from)
import qualified Hedgehog.Gen as Gen
import Hedgehog (Gen)
import Text.Show (showString, showParen, shows)
import Data.Bits
assn3 :: Activity
assn3 =
makeActivity "a3" 60 "2020-03-01 23:59 EST"
a3SubmittedBadge :: Widget
a3SubmittedBadge =
submittedPointsBadge assn3 \uid ->
return False
data A2GivenKey = A2GivenKey
deriving (Eq, Ord, Show)
instance Key A2GivenKey where
keyDir = "course"
keyToFileName A2GivenKey = "assn3.yaml"
keyFromFileName fn
| fn == keyToFileName A2GivenKey = Just A2GivenKey
| otherwise = Nothing
instance YamlEntity A2GivenKey (Map UserId Text)
handleU2LogicAssnR :: Handler Html
handleU2LogicAssnR = do
uid <- requireAuthId
exprOpt <- runRo $ (^. at uid) <$> loadY A2GivenKey
defaultLayout $ do
setTitle "Assignment 2: Boolean logic"
.bigger-text {
font-size: 120%;
<div .col-12>
^{dueBadge assn3}
$maybe expr <- exprOpt
<p .bigger-text .border .border-success .p-2>
Your Boolean expression is:  
<span .text-monospace>
<div .alert .alert-danger>
You have not been assigned an expression yet!
Please ask the instructor to assign one ASAP.
This assignment has two parts. <b>First,</b> write a complete truth
table for all possible values of the Boolean expression assigned
to you. Remember the correct order of operations:
parentheses ( )
OR +
Your expression uses exactly three variables, so your table should
have <b>eight</b> rows. You may create your truth table on paper
and then take a very clear picture of it, or do it directly in a
document or spreadsheet file.
<b>Second,</b> using Logisim, implement a circuit for your assigned
Boolean expression. It should have exactly three two-state input
pins, labeled as A, B, and C. It should have one output pin or
LED. Test the circuit against your truth table to verify the
results. If you find a way to implement exactly the same
calculation with fewer gates, that's fine (but not necessary).
Save your circuit file (it should have the extension
<tt>.circ</tt>) and also upload that below.
......@@ -112,6 +112,8 @@ mkYesodData
/assn/2/heximage U1HexAssnR GET POST
/assn/2/heximage/delete/#Text U1HexDeleteR GET
/assn/3/logic U2LogicAssnR
/page/#PageId PageDocR GET
!/page/#AssetId PageAssetR GET
/post/#PostId PostR GET
......@@ -18,6 +18,7 @@ import App.Activity
import App.Asset
import App.Assn1
import App.Assn2
import App.Assn3
import App.ByteStoreDynamic
import App.ByteStoreGitDir (bareRepo)
import App.ByteStoreWorkDir
......@@ -17,6 +17,7 @@ where
import App.Activity
import App.Assn1
import App.Assn2
import App.Assn3
import App.ByteStoreWorkDir
import App.Foundation
import App.Page
......@@ -113,6 +114,12 @@ unit2 = do
<li .list-group-item>
<a href="">Logisim software
<li .list-group-item>
<a href=@{U2LogicAssnR}>
Boolean Logic
^{dueBadge assn3}
unit1 :: Widget
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment