Showing posts with label Computer Technology. Show all posts
Showing posts with label Computer Technology. Show all posts

Tuesday, November 10, 2020

How to make a Snake game using Python..

 





import turtle
import time
import random
delay=0.1
# set up the screem
win= turtle.Screen()
win.title("Snake Game By Sumit Sarkar  ")
win.bgcolor("green")
win.setup(width=600,height=600)
win.tracer(0)
#snake head
head=turtle.Turtle()
head.speed(0)
head.shape("square")
head.color("black")
head.penup()
head.goto(0,0)
head.direction="stop"
#Snake food
food=turtle.Turtle()
food.speed(0)
food.shape("circle")
food.color("red")
food.penup()
food.goto(0,100)

segments= []
#functions

def go_up():
    if head.direction!="down":
        head.direction ="up"
def go_down():
    if head.direction!="up":
        head.direction="down"
def go_right():
    if head.direction!="left":
        head.direction="right"
def go_left():
    if head.direction!="right":
        head.direction="left"
def move():
    if head.direction == "up":
        y = head.ycor()
        head.sety(y+20)
    if head.direction == "down":
        y = head.ycor()
        head.sety(y-20)
    if head.direction == "left":
        x = head.xcor()
        head.setx(x-20)
    if head.direction == "right":
        x = head.xcor()
        head.setx(x+20)
    

#keyboard binding
win.listen()
  
win.onkeypress(go_up,"w")   
win.onkeyrelease(go_down,"s")
win.onkeypress(go_left,"a")
win.onkeypress(go_right,"d")
#maingameloop
while True:
    win.update()
    #chack for collision with the border
    if head.xcor()>290 or head.xcor()<-290 or head.ycor()>290 or head.ycor()<-290:
        time.sleep(1)
        head.goto(0,0)
        head.direction='stop'
        #hide the segment
        for segment in segments:
            segment.goto(1000,1000)
        #clear the segments
        segments.clear()
    # chack for a collision with the food
    if head.distance(food)<20:
        #move the food to a random spot
        x=random.randint(-290290)
        y= random.randint(-290290)
        food.goto(x,y)
        #add a segment
        new_segment=turtle.Turtle()
        new_segment.speed(0)
        new_segment.shape("square")
        new_segment.color("grey")
        new_segment.penup()
        segments.append(new_segment)
    # move the end segments first in reverse order
    for index in range(len(segments)-1,0,-1):
        x=segments[index-1].xcor()
        y=segments[index-1].ycor()
        segments[index].goto(x,y)
    # move segment 0 to where the head is
    if len(segments)>0:
        x=head.xcor()
        y=head.ycor()
        segments[0].goto(x,y)

    move()
    
    # check for head collision with the body segments
    for segment in segments:
        if segment.distance(head) < 20:
            time.sleep(1)
            head.goto(0,0)
            head.direction="stop"
            for segment in segments:
                segment.goto(10001000)

            segments.clear()
   

    time.sleep(delay)

win.mainloop()

Saturday, May 16, 2020

AMD Processor

Advanced Micro Device Inc. (AMD), founded in 1969 and based in Sunnyvale, California, provides microprocessors. It is Intel's primary competitor in the IBM compatible PC market.
AMD is best known for its Athlon, Opteron, Turion 64, Sempron and Duron microprocessors.

Friday, May 8, 2020

What is Internet??

The  Internet is a network of many computer networks. It connects LANs, WANs and even our own personal computer. This is also called the information super highway. We can access any information from any place at anytime on the Internet. We can  download to our PC the research paper from a foreign university, send mails to the friends and relatives,  watch a movie deposit of withdraw money online and sell or buy products and services.

  • The  Internet is often referred to as the " Information Super highway".
  • No one owns the Internet, but everyone connected to it owns a part of it.
  • It is not governed by any central authority but there are agencies and societies that perform coordinating  functions, such as the registration of domain names.
  • It 1988, there were about 1 million people who could access the Internet, Currently, there are more than 600 million internet connections, divided across almost every country in the world.
  • The websites produced by various institutions, business organizations and private users cover just about every imaginable topic.
  • The Internet was developed in 199 by Advanced Research Projects Agency(ARPA) as a communications network for US military. Soon after other government agencies, collages and research companies began using the Internet for various purposes like
              1. Email
              2. File Transfer
              3. Remote login facilities
              4.  Internet Relay Chat allows groups of people to communicate with each other in real -time
              5. Video conferencing technology.                                               
In order to avail these facilities, our PCs must be connected to the Internet. Therefore, we have to subscribe to the Internet. There are many Internet service providers around the globe, In India, VSNL ( Videsh Sanchar NIgam Limited ) provides Intrnet services. There are many other organizations that provide Internet Services.
Internet Service in India was started on 15th August 1995


Wednesday, May 6, 2020

Internet and Web are not same!!!

WWW (World Wide Web)

The World Wide is a global; computer communication system that uses the Internet to transmit data such as text, numbers, images and sound. It was developed in 1989 by Tim Beners Lee of the European Particle Physics Lab ( CERN) in Switzerland. The initial purpose of the Web was to use networked hypertext to facilitate communication among its members, who were located in several countries. 



The World Wide Web is also known as the Web. It consists of websites. Each website contains webpages, which are files or documents consisting of text,  images. video , sound and animation,. In short, the webpage have nearly any form of communication . Many people think that the internet and the Web are the same. But they are not. Internet is a carrier and the Web is the service.

Wednesday, April 22, 2020

How Computers Repreesent Data

How Computers Repreesent Data

Computers are made of digital electronics circuity. And electronic circuits can exist either in ON or OFF state. Most of the electronics components of a computer use voltage levels to indicate their present state.  For example, a transistor with five volts would be considered ON, while a transistor with no voltage would be considered OFF, CD-ROM's , for example, use microscopic dark spots on the surface of the disk to indicate OFF, while the ordinary shiny surface is considered ON. Hard disks use magnetism, where the magnetized spot is considered ON, while non-magnetized spots on the disk indicate OFF.



These patterns of ON and OFF stored inside the computer are used to encode numbers using the binary number system. The binary number system is a method of storing ordinary numbers such as 34 or 456 or text data such as names as patterns of 1 's and 0 's . Because of their digital nature, a computer's electronics circuitry can easily manipulate numbers stored in binary by treating  1 as ON and 0 as OFF. Computers have circuits that can add, subtract multiply , divide, and do so many other things to numbers stored in binary form. 

Saturday, August 17, 2019

Generations of Computers


Generations of Computers

Computers developed after the first electronics computer ENIAC are classified into five generations. This generation is based on the technology used in architectural development of computers. It also includes computational ( processing) techniques, input-output devices and programming languages used.
The generations of computers are broadly classified into two types :
1.      Non – electronics generation.
2.      Electronic generation.
Let us discuss each one of them briefly.

Non – Electronic generation.
These are referred to as the Zero Generation  computers. They were developed before the semiconductor revolution took place in 1946 . They were made up of wooden or mechanical components.
Examples : Abacus, Napier’s bone, Differential Engine etc.

Electronic Generation
Computer  developed after 1946 are categorized into five generations. Since they are mainly built with electronic circuitry, they are called the electronic generation computers.


First Generation Computers
These were developed during  1946-59, and were built with Vacuum tubes. Their speed was  10-3 sec. They used limited primary memory and used magnetic drums as secondary storage devices. They used punched card and magnetic tape to input and output operations. The machine language programming was adapted in these machines. They were batch processing systems and were used for both scientific and business based applications.
Examples : ENIAC, UNIVAC-I, EDSAC, EDVAC etc.

Second Generation Computers
These were developed during  1957-64 and were built with diodes and transistor. Their speed was 10-6 sec. They had more primary memory and proved higher reliability. High level programming languages like FORTRAN, Pascal, ALGOL etc, were used in these machines. The concept of multi-proramming , time-sharing and real-time processing were also introduced.
Example: BURROUGHS 5000, IBM 1401, GE635, CDC 164, HONEYWELL 400, etc.


Third Generation Computers
These were developed during 1965-70 and were built with Integrated Circuits (ICs). There ware  10-100 transistors in a single silicon chip. Their speed was 10-9 sec( nano second). They used semiconductor memory. They had higher reliability and reduced size. The concept of operating system , multi-programming, parallel processing were introduced. They were used in weather forecasting, airline reservation, banking services.
Examples:  IBM System/360, UNIVAC 1108/9000, CDC-6000, NCR 395, CYBER-175,etc.

Fourth Generation Computers
These were developed during 1970-90 and were built with Large Scale Integration(LSI), 100-1000 transistors in a single chip and Very Large Scale Integration(VLSI), 1000 to millions of transistors per chip. They have a huge storage capacity and their processing  speed is from  10-9 -10-12  sec. The concept of networking was introduced.
Example:- IBM 3033, HP-3000(minicomputer), PDP-11, CYBER-205, all modern PCs.

Fifth Generation Computer
The development of super computers was the key motivation of the fifth generation computers. Super computers were developed with Super Large Scale Integration (SLSI), i.e million of transistors were used in a single IC chip. These are knowledge processing systems. The C concept kike Artificial Intelligence and distributed processing were incorporated. They are RISC ( Reduced Instructions Set Computing) based machines. CD-ROM (Compact Disk Read Only Memory), WORM( Write Once Read Many Times) are introduced.
Examples: CRAY machines(Japan), PARAM -1000(India) are considered to be fifth generation computers.



Sunday, July 7, 2019

Introduction Of Computer


The Computer Definition

A computer is an electronic device that is used for information processing. It accepts data and instructions, stores it in its memory, processes and gives the results to the user. The term computer is derived from the Latin word compute which means to calculate or to manipulate.
Therefore, the computer is a calculation machine.

Capability Of Computers

A computer is capable of performing the following tasks:
·        
    Huge data storage: A computer can store any amount of data and instruction in its memory. The computer’s memory is just like a human brain where information is stored and retrieved from.
·         Input and Output:- A computer receives the data and instructions from the user and displays it after the execution.
·         Processing :- It processes the data entered by the user, Processing means performing the necessary operations such as arithmetic or logical operations on the data.

History of the development of computers

The history of computers can be traced back to ancient times. The evolution of computers  from the beginning of the Abacus computer to today’s digital computers is discussed in this section.
This is the first recorded computer, whose existence dates back to 2500 B.C. It was a rectangular wooden frame with beads stung on parallel wires. It was invented in China and used by the Greeks, Romans, and Japanese in early days.
In 1833 , Charles Babbage developed the Analytical Engine. This machine consisted of five functional units such as Input unit, Memory unit, Arithmetic unit, Control unit and Output unit.
The architecture of the modern digital computer resembles the Analytical engine and hence Charles Babbage is called the father of Computers.