wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Number Guessing game --lisp

profile
Rohan undefined
Jul 16, 2025
0 Likes
0 Discussions
6 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

Perfectionism and High-Performance culture

Blog banner

The Secure Software Development Life Cycle (SDLC)

Blog banner

Memory Management - operating system

Blog banner

IS CONVERTING AMBITION INTO PROFESSION?

Blog banner

Importance Of Education.

Blog banner

How Puppet Shows and Role Play Teach Empathy to Preschoolers

Blog banner

Models of Information Security.

Blog banner

Shoulders

Blog banner

BEAUTY IS IN THE EYE OF THE BEHOLDER

Blog banner

Malware

Blog banner

Deadlock

Blog banner

How to Grow Your Brand on YouTube Without a Big Budget

Blog banner

Developments in Modern Operating Systems

Blog banner

What is Minting & Mining

Blog banner

MORDERN UNIX SYSTEM

Blog banner

Service Design Model

Blog banner

Evolution of Operating Sytems

Blog banner

Privacy-Enhancing Computation Techniques

Blog banner

The Golden Temple , Amritsar

Blog banner

Direct Memory Access

Blog banner

Raising Emotionally Intelligent Students: The Classroom Beyond Academics

Blog banner

DIGITAL ECONOMY

Blog banner

10 Interesting facts you should know!!!

Blog banner

On-Page SEO

Blog banner

Global versus Indian Mental Health Differences

Blog banner

MODERN OPERATING SYSTEM

Blog banner

Virtual Memory

Blog banner

Exploring Human Factors in Cyber Forensics Investigations.

Blog banner

What is time ? The term which has astonished Scientists

Blog banner

How To Invest In Indian Stock Market @ BSE & NSE ~ Tutorial 3

Blog banner

What is OS and its overview

Blog banner

Atlantis - The Lost Island.........

Blog banner

HR Automation : Need of the hour

Blog banner

What is Vishing?

Blog banner

Windows Operating System

Blog banner

GIS in Mapping and landslide alert in Bangladesh

Blog banner

This is my first blog.

Blog banner

OPERATING SYSTEM

Blog banner

Ola

Blog banner

I/O Buffering

Blog banner

Why Friendship at Work is Important

Blog banner

R Programming

Blog banner