-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove time restriction from application problems
- Loading branch information
Showing
2 changed files
with
3 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0adfd35
There was a problem hiding this comment.
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
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)
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"
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]
0adfd35
There was a problem hiding this comment.
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));
}
}
0adfd35
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@antoniaivalina - мерси за отговорите, но ги изпратете в формата за кандидатстване за курса. Тук не им е мястото.
0adfd35
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@antoniaivalina сама ли написа Haskell решението?
0adfd35
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0adfd35
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Използвай формата за кандидатстване.
0adfd35
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.