wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Number Guessing game --lisp

profile
Rohan undefined
Jul 16, 2025
0 Likes
0 Discussions
0 Reads

Program (Raw):


(defun ask (question)

(format t "~%~A (yes/no): " question)

(force-output)

(let ((response (read-line)))

(string= (string-downcase response) "yes")))


(defun guess-number (low high)

(let ((mid (floor (+ low high) 2)))

(cond

((> low high)

(format t "~%Hmm, something went wrong! Are you sure you're answering honestly?"))

((ask (format nil "Is your number ~A?" mid))

(format t "~%🎉 Yay! I guessed your number: ~A" mid))

((ask (format nil "Is your number greater than ~A?" mid))

(guess-number (+ mid 1) high))

(t

(guess-number low (- mid 1))))))


(defun start-game ()

(format t "~%Think of a number between 1 and 100. I will try to guess it!")

(guess-number 1 100))


(start-game)




Comments ()


Sign in

Read Next

Fitness regime by Deepesh

Blog banner

PERSONALITY DEVELOPMENT

Blog banner

Data Mining

Blog banner

Survey of Which Movies Types people are Prefer to Watch in India.

Blog banner

Rapido

Blog banner

The Memory Hierarchy

Blog banner

Outlook.com

Blog banner

Career v/s Job : Choose your passion

Blog banner

Buffering

Blog banner

VIRTUAL MACHINES

Blog banner

The Role of Teachers in Building a Child’s Confidence

Blog banner

Deadlock in Operating System

Blog banner

Sleep Matters: The Science Behind Toddler Naps

Blog banner

Human factor, a critical weak point in the information security of an organization’s IOT

Blog banner

Types Of Interrupt

Blog banner

MOBILE DEVICE FORENSIC

Blog banner

Understanding Business Layer in Data Science

Blog banner

Article on IT development trends

Blog banner

Operating System Objectives and Functions

Blog banner

TECHNOLOGY : BOON OR CURSE ?

Blog banner

SMARTSHEET MANAGEMENT SYSTEM

Blog banner

FIREWALL

Blog banner

Protect yourself from System Hacking with these Simple Steps

Blog banner

Technical SEO : Total Guide

Blog banner

PROCESS CONTROL BLOCK IN OS

Blog banner

 " Healing of Yoga "

Blog banner

The Psychology of Diversity, Equity & Inclusion: How Inclusive Workplaces Boost Productivity

Blog banner

Virtual memory in windows

Blog banner

E-commerce

Blog banner

38_Network Sniffing Techniques_SBC

Blog banner

To-Do List In LISP

Blog banner

MPL and how its effects?

Blog banner

Pro-Tips On How To Keep your Foot Healthy

Blog banner

Is it important to follow all the trends that come up on social media?

Blog banner

Indian Culture and Tradition

Blog banner

Different memory allocation strategies

Blog banner

Apache Spark :- Powerful Data Processing Tool

Blog banner

Process in OS

Blog banner

Deadlock

Blog banner

ROLE OF THE COMPUTER FORENSICS TOOLS AND TECHNIQUES

Blog banner

Objectives and functions of Operating System...

Blog banner

Why Kanye West (Now Ye) is the GOAT: A Legacy Beyond Music

Blog banner