Thursday, 1 May 2014

PREWGREWMS WUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUB

Programs 'n' stuff

a program is a set of instructions for the computer to carry out

algorithm is a series of steps to solve a problem

THERE ISW NI NEED TO BE AFRAID

Thursday, 13 March 2014

Databases and stuff

A database is a persistent organised store of related data on a computer system.

Key terms:
Serial File - a file of items one after the other
Sequential File - a serial file in order
Entity - something that we store data about in a database
Record - all the data about one item in a database
Attribute - a characteristic of an entity. it becomes a field in a data table
Field - a characteristic of something stored in a database


it is organised so computer programs can easily select or edit data.

database software has to be able to create, retrieve , update and delete the data in the database in a database. this can be referred to as a CRUD.
most computer systems store, process and retrieve data.

this is a simple python program that writes numbers into a file

#program to write ten values to a disk file

f  = open ('workfile.txt',  'w')

for x in range  (1,11)
f.write(str(x))
f.write('\n')

f.close()

Wednesday, 11 December 2013

Four people are trying to get across a bridge the zombies are coming so they only have 15 minutes. person 1 takes 1 minute to get across person 2 takes 2 minutes person 3 takes 5 and person 4 takes 8 minutes
two may cross at once and they will go at the same pace as the slowest on the bridge and they need a torch to cross

firstly a and b will cross elapsing a total time of 2 minutes  a because he is the fastest will bring the torch back which takes it up to three minutes he passes the torch to c and d who cross in 8 minutes bringing the time up to 11 minutes then b will come back with the torch taking 2 minutes taking it up to 13 minutes and bring over a taking a total of 15 minutes.

yay

or alternatively a and b could leave behind c and d the slow people they are.
they may not be fast but they make good zombie bait!




and Christmas Pikachu

Monday, 9 December 2013

basic program

Program
INP
STA VALUE
LDA ZERO
STA TRINUM
STA N
LOOP LDA TRINUM
SUB VALUE
BRP ENDLOOP
LDA N
ADD ONE
STA N
ADD TRINUM
STA TRINUM
BRA LOOP
ENDLOOP LDA VALUE
SUB TRINUM
BRZ EQUAL
LDA ZERO
OUT
BRA DONE
EQUAL LDA N
OUT
DONE HLT
VALUE DAT 000
TRINUM DAT 000
N DAT 000
ZERO DAT 000
ONE DAT 001

What you should do

  1. Click on the "LMC Simulator Applet" link to start the LMC simulator.
  2. Clear the Message Box and all of the LMC mailboxes -- click the "Clear Messages" button and the "Clear" button if necessary.
  3. Copy the twenty eight line program above and paste it into the Message Box
  4. Click on the "Compile Program" button.
  5. Click on the "Run" button.
  6. When prompted, enter three-digit numbers in the "In-Box", and press the "Enter" button.

What you should see

  • After the program is compiled, you should see from mailbox 0 to 23 the instructions 901, 323, 526, 324, 325, 524, 223, 814, 525, 127, 325, 124, 324, 605, 523, 224, 720, 526, 902, 622, 525, 902.  The Program Counter should start at 0 (click on "Reset" if necessary).
  • DAT reserves mailbox 23 for N (the user input), mailbox 24 for TRINUM (the value of the current triangular number), mailbox 25 for COUNT (the number of triangular numbers that have been calculated), mailbox 26 for ZERO, and mailbox 27 for ONE. 
  • When you click on "Run" or "Step", the Message Box will describe the actions of each instruction.
  • The first two instructions accept the input VALUE from the user.
  • The next three instructions initialize the values of TRINUM and N to ZERO.
  • The algorithm is as follows: calculate triangular numbers until the calculated triangular number is greater than or equal to the input value.  If the triangular number is equal to the input, then output N.  Otherwise, output ZERO.
  • The LOOP starts by checking this exit condition.  The input VALUE is subtracted from TRINUM.  As long as the result is negative, the LMC stays in the loop (i.e. the BRP does nothing) to calculate more triangular numbers.
    • To calculate the next triangular number, N is incremented by ONE, and this new value of N is added to TRINUM.  Remember, the nth triangular number is calculated by adding n to the previous triangular number.
    • The BRA LOOP indicates the end of the loop body.  This BRANCH command causes the execution of the LMC to "jump" back to the start of the loop.
  • After exiting the LOOP, the value of TRINUM is greater than or equal to the input VALUE -- the LMC has calculated enough triangular numbers to determine if the user input is one.
  • The SUB instruction is to check if TRINUM and VALUE are equal.
    • If they are equal, subtracting TRINUM from VALUE will equal 000.  BRZ will allow the LMC to skip past the code section that handles when these two values are not equal.  The LMC will then execute the code segment that outputs N to the Out-Box -- the input VALUE is the Nth triangular number.
    • If they are not equal, the result on the Accumulator will not be 000, and BRZ will do nothing.  The code after of the BRZ instruction is executed.  This code outputs ZERO to the Out-Box, and then skips past the code for the two values being EQUAL to the end of the program.
The following program will demonstrate how to use the branching instructions of the LMC to implement decision making.  Note: The Branch Always instruction should only be used to connect paths indicated by your flowchart. 

Thursday, 5 December 2013

little man computing

Little man computing is a simplified version of a basic computer system

The little man computing is an instructional model  of a computer. The LMC is generally used to teach students, because it models a simple von Neumann architecture computer - which has all of the basic features of a modern computer. It can be programmed in machine (albeit usually in decimal) or assembly code



















Thursday, 28 November 2013

Bytes And Bits

Bytes And Bits
 
a byte is 8 binary digits long or 8 bit

a nibble is 4 binary digits or 4 bits

a bit is the smallest form of binary number

a kilobyte is 1024 bytes

a megabyte is 1024 kilobytes

a gigabyte is 1024 megabytes

a terabyte is 1024 gigabytes

a petabyte is 1024 terabytes
 
an Exabyte is 1024 petabytes

the human brain is estimated to be around 2.5 petabytes big.