Skip to content

Commit

Permalink
Remove time restriction from application problems
Browse files Browse the repository at this point in the history
  • Loading branch information
pgergov committed Mar 11, 2016
1 parent dd1f2af commit 0adfd35
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Application/1-Login-Form/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ You have the following login form:
`Helo and welcome to Hack Bulgaria! Click _here_ to confirm your emeil address.`
- Log in is possible with username and password or through the social networks.

You have 10 minutes to write down a list of all login form test cases you can think of.
## Write down a list of all login form test cases you can think of.

Hint - think about all form components and how could they be tested.
**Hint - think about all form components and how could they be tested.**
2 changes: 1 addition & 1 deletion Application/2-Sudoku-Solver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ func Sudoku(Array[2]) {
- Input parameter is a two-dimensional array with the known numbers (from 1 to 9) in the Sudoku grid.
- The output is a two-dimensional array with the numbers from the solved puzzle.

You have 10 minutes to write down a list of all sudoku function test cases you can think of.
## Write down a list of all sudoku function test cases you can think of.

7 comments on commit 0adfd35

@antoniaivalina
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specification- Login Screen Of yAHOO
User Id-Prajakta Password-GOD12
Test Cases:
1)Go to User Id field and without entring data in that field
press "Enter" key.
Expected-it should prompt message " Please enter 'User ID' "

2)Go to login screen enter "User Id" and winthout entering
password try to click on "OK" button.
Expected-it should prompt message "Please enter 'Password' "

3)Go to login screen enter "User Id" and enter wrong
password try to click on "OK" button.
Expected-it should prompt message " Please enter Proper
'User ID' and 'Password' "

4)Go to Login screen enter all required data and press "OK"
button then software window will open. In that window click
on "Back" button.
Expected-It should go back to 'Login' screen and that

screen should not show "User Id" and "Password"

5)Go to login screen enter "User Id" and enter password as
"god12" try to click on "OK" button.
Expected-It should prompt message for wrong Password.

sudoku function

  1. import MonadNondet (option)
    import Sudoku
    import System
    import Control.Monad

solve = forM [(i,j) | i <- [1..9], j <- [1..9]] $ (i,j) -> do
v <- valAt (i,j) -- ^ for each board position
when (v == 0) $ do -- if it's empty (we represent that with a 0)
a <- option [1..9] -- pick a number
place (i,j) a -- and try to put it there

main = do
[f] <- getArgs
xs <- readFile f
putStrLn . evalSudoku $ do { readSudoku xs; solve; showSudoku }
2.import System
import Control.Monad
import Data.List
import Data.Array.IO

type SodokuBoard = IOArray Int Int

main = do
[f] <- getArgs
a <- newArray (1, 81) 0
readFile f >>= readSodokuBoard a
putStrLn "Original:"
printSodokuBoard a
putStrLn "Solutions:"
solve a (1,1)

readSodokuBoard a xs = sequence_ $ do (i,ys) <- zip [1..9](lines xs)
(j,n) <- zip [1..9](words ys)
return $ writeBoard a (j,i) (read n)

  1. type Coord = Int
    type Address = (Int,Int,Int,Int)
    type Element = Int

type T = Array Address (Maybe Element)
type Complete = Array Address Element

fieldBounds :: (Address, Address)
fieldBounds = ((0,0,0,0), (2,2,2,2))

squareRange :: [(Coord, Coord)]
squareRange = range ((0,0), (2,2))

alphabet :: [Element]
alphabet = [1..9]
4.import Array
import List
import System

-- ([Possible Entries], #Possible Entries)
type Field = Array (Int,Int) ([Int], Int)

-- Fields are Strings of Numbers with 0 in empty cells
readField ::String -> Field
readField f = listArray ((1,1),(9,9)) (map (\j -> let n=read [j]::Int in if n==0 then ([0..9],9) else ([n],0)) f)

-- x y wrong way -> reading wrong? no effect on solution though
showField :: Field -> String
showField f = unlines [concat [show $ entry (f!(y,x))|x<-[1..9]]|y<-[1..9]]

printField :: Maybe Field -> String
printField (Just f) = concat [concat [show $ entry f!(y,x))|x<-[1..9]]|y<-[1..9]]
printField Nothing = "No solution"

  1. true if cell is empty
    isEmpty :: ([Int],Int) -> Bool
    isEmpty (xs,_) = xs == [0]

entry :: ([Int],Int) -> Int
entry = head.fst

-- 0 possibilties left, no emtpy fields
done :: Field -> Bool
done a = let l=elems a in 0==foldr ((_,x) y -> x+y) 0 l && all (not.isEmpty) l

--return column/row/square containing coords (x,y), excluding (x,y)
column::Field ->(Int,Int) -> [Int]
column a ~(x,y)= [entry $ a!(i,y)|i<-[1..9],i/=x]

row :: Field -> (Int,Int) -> [Int]
row a ~(x,y)= [entry $ a!(x,j)|j<-[1..9],j/=y]

@antoniaivalina
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class SudokuPuzzleTests
{
public static void TestPeers()
{
var p = new SudokuPuzzle(9);
var peers = p.Peers(40);
var expectedResult = new int[] { 4, 13, 22, 30, 31, 32, 36, 37, 38, 39, 41, 42, 43, 44, 48, 49, 50, 58, 67, 76 };
Debug.Assert(peers.SequenceEqual(expectedResult));
}
}

class SudokuPuzzleTests
{
public static void TestPeers()
{
var p = new SudokuPuzzle(9);
var peers = p.Peers(40);
var expectedResult = new int[] { 4, 13, 22, 30, 31, 32, 36, 37, 38, 39, 41, 42, 43, 44, 48, 49, 50, 58, 67, 76 };
Debug.Assert(peers.SequenceEqual(expectedResult));
}
}

@atodorov
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antoniaivalina - мерси за отговорите, но ги изпратете в формата за кандидатстване за курса. Тук не им е мястото.

@RadoRado
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antoniaivalina сама ли написа Haskell решението?

@antoniaivalina
Copy link

@antoniaivalina antoniaivalina commented on 0adfd35 Apr 6, 2016 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atodorov
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Използвай формата за кандидатстване.

@antoniaivalina
Copy link

@antoniaivalina antoniaivalina commented on 0adfd35 Apr 6, 2016 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.