Wednesday, 23 December 2015

Magic Cards PHP



Problem
                The magician arranges 16 cards from one to sixteen in a square grid (4x4). Next, the magician asks a volunteer to choose a card, and tell him which in the four rows the card in located.

                The magician then shuffles the cards and arranges them in a similar square grid. Now the card position have been changed. Again, he asks the volunteer which row his card is located. After the row is located, the magician now announces the card that the volunteer chose.
Write a program that will do the above-mentioned magic. The input file will be given the 2 4x4 arrangement of cards, and the volunteer's chosen row: the row number of the selected card in the first arrangement, and the row number of the selected card in the second arrangement. The rows are numbered 1 to 4 from top to bottom.

Solving this problem
Input (input.in)
The trick has three parts. Line 1, which contains a single integer. This represents the number on how many times it was done (T). The subsequent parts will be a pattern of 1 integer (R) and 4 lines of integers from 1-16. R will represent the row that the person chose, while the next four lines will be the arrangement of the cards.


Output (web browser or text file)
                For every time the magic was done (T). The output will be “Case #T:X” Theoretically, the program should get the integer/card that the volunteer chose. The value of X will depend on how many result does the program have:
1.        If X==1, meaning there is a single card that he chose, X must be equal to the value of the number chosen;
2.       If X>1, meaning there are multiple identical cards in the chosen rows, X must be “Magic Failed!”;
3.       If X <= 0, meaning there are no cards similar in the two card arraignment, X must be “Cheater!”

Sample Input
3
2
2 1 4 3
6 8 7 5
9 12 11 10
14 13 16 15
3
4 5 2 1
11 3 15 6
12 7 10 9
14 13 16 8
2
4 3 2 1
8 7 6 5
12 11 10 9
14 13 16 15
2
1 4 2 3
6 8 7 5
12 11 9 10
13 14 15 16
2
4 2 1 3
7 5 6 8
9 11 12 10
16 15 13 14
3
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16

Sample Output
Case #1: 7
Case #2: Magic Failed!
Case #3: Cheater!

Wednesday, 9 December 2015

Intro to world wide web project

This is the first website I have created. I made it out of the concept of "Choose Philippines" since there are a lot of  "It's more fun in the Philippines" meme. I didn't have that much of the hard time finding pictures that i want for my web pages. I want to make my webpages to be neat and clean so I avoided using colors that doesn't compliment to each other. I also make use of border radius to make smooth corners which are good to look at. I believe if this wasn't the best project from our section, then this was one of the best. I am not bragging, I did all my best in my projects so I am totally proud of them.


 According to my instructor my website is very informative. I think that is equivalent to a thumbs up.

Download link here.

Thursday, 24 September 2015

Paragraph


HTML Paragraphs

 

<p> element defines  a paragraph.

Example:
<p> Hello world!</p>
<p> This is a paragraph</p>


The text in HTML files are displayed in browsers with only one space even if you place multiple spaces and new lines. Which will be a problem since we'll never know how they will be displayed in other computer in the screen is small or large screen and resized browser.

Try this:

<p> this a paragraph the that has a         multiple     spaces       between   words     and
with


mulitple



new lines </p>




Fixing the problem

 

 Line  Break

The <br>  element defined as line break.
You can use <br> if you want a line break or new line without creating an new paragraph.

Try this:

<p> This is a paragraph with a line break <br>
This element is use to create new line without making a new paragraph.</p>


Preformatted Text 

The <pre>  element defines preformatted texts.
The text inside the <pre> element is displayed in fixed width font and preserve line breaks and spaces.

Try this:

<pre> The     quick brown fox jumps over the lazy dog,
The quick      brown fox jumps over the lazy dog,
The quick brown      fox jumps over the lazy dog,
The quick brown fox     jumps over the lazy dog,
The quick brown fox jumps      over the lazy dog. </pre>


You will notice that text will be displayed with multiple spaces and also with line breaks with using any elements.



*paste them in the body of .html file

Headings


HTML Heading


Headings are defined with <h1> to <h6>.
The <h1> the is the most important and <h6> is the list important.

Example:

The HTML Heading is important because heading are used by search engine to determine the content of a webpage and index it's structure.

Try this:

<html>
         <head>
                     <title> Heading</title>
         </head> 
         <body>
                     <h1>heading1</h1>
                     <h2>heading2</h2>
                     <h3>heading3</h3>
                     <h4>heading4</h4>
                     <h5>heading5</h5>
                     <h6>heading6</h6>  
         </body> 
</html>

*copy and paste them and save as a .html file.



The <head> Element

The <head> element contains meta data which are not displayed in the browser.

Example:


<head>
<meta charset="UTF-8">
<meta name="description" content="Computer Science Student notes">
<meta name="keywords" content="HTML,CSS,XML,JavaScript">
<meta name="author" content="Lorenz G.">
</head> 


The <meta> tag give meta data of HTML. Meta data data is not visible, but is machine readable.
Meta elements are used to specify page description, keyword, author of document, last modified and other metadata.