Git Product home page Git Product logo

prodigy_infotech_sd_intership's Introduction

# PRODIGY_INFOTECH_SD_Intership
# Overview
When the program begins, it forks into two processes: 
- parent process
- child process

The child process will interact with the user via stdin and stdout. It first prompts the user for a secret number between 0 and 1023 (inclusive). The parent process will try to guess the user's number by randomly picking a number between 0 and 1023 and displaying it to stdout. The user will then enter either _"hi"_ or _"lo"_, depending if the parent's guess is either too high or too low, respectively, compared to the secret that the child process knows (which it input from the user). The child will then send either _SIGUSR1_ or _SIGUSR2_ to the parent process to let it know if its guess is too high or too low, respectively. The parent then guesses a new number and everything repeats until the parent guesses the secret number. At this point, the user will enter _"correct"_ and the child will send a _SIGINT_ signal to the parent to indicate it has guessed correctly. The parent then displays the number of guesses it needed to guess the correct number and then sends a _SIGINT_ signal to the child. When the child receives the _SIGINT_, it kills the parent process and then terminates itself. Each time a process sends a signal, it also prints a string to stderr with the format **senderPID # signal-name # receiverPID** where _senderPID_ is the pid of the sending process, _receiverPID_ is the pid of the receiving process, and _signal-name_ is the name of the signal being sent.

# Tutorial
- First, Use the _make_ command to produce the excutable file and run it. As shown below:

<img src="screenshots/run_guess.png" width="700">

- Next, input the secret number from 0 to 1023 inclusively. As shown below:

<img src="screenshots/guess_input.png" width="700">

- Now, it will ask you for a hint i.e. to indicate whether the guessed number is **lower (lo)** than the secret number, or **higher (hi)**. It will then guess a new number and ask for a new hint. 

<img src="screenshots/first_guess.png" width="700">

- The process continues until the computer correctly guesses the secret number. As shown below:

<img src="screenshots/entire_guess.png" width="700">

prodigy_infotech_sd_intership's People

Contributors

jaanu11 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.