wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Number Guessing game --lisp

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

MOVEMBER

Blog banner

Fossil Hunting 101 at the Peace River, Arcadia, Florida, USA

Blog banner

Virtual Memory - Explaination, Working, Steps

Blog banner

From Model Mistakes to Metrics

Blog banner

Data Exfiltration

Blog banner

OPERATING SYSTEM

Blog banner

Vikrant’s first blog

Blog banner

Paid Email

Blog banner

CSI and Organizational Change

Blog banner

ahh wait a min

Blog banner

Place to visit in pune

Blog banner

INTRANET

Blog banner

Theads

Blog banner

undefined

Blog banner

How to use GIT & GITHUB

Blog banner

Models of Information Security.

Blog banner

Stephen Hawking : A Remarkable Physicist

Blog banner

Decrypting Cryptocurrency: Tracing Transactions in Cyber Investigations

Blog banner

Tomato Butter Sauce with Bucatini

Blog banner

Optimization of operating system design

Blog banner

Security in Cloud Computing

Blog banner

Critical success factors

Blog banner

Threat management

Blog banner

DEVELOPMENTS LEADING TO MODERN OPERATING SYSTEMS

Blog banner

The New Dr. Frankenstein who will perform first full head transplant

Blog banner

Krishna Rao SAP ID--53003230076

Blog banner

RSA (Rivest-Shamir-Adelman) Algorithm

Blog banner

Different Types of Data

Blog banner

Memory Management in Operating System

Blog banner

Virtual memory

Blog banner

Eating Well With Meal Maharaj on Busy Workdays Without Cooking

Blog banner

Understanding Univariate, Bivariate, and Multivariate Analysis in Data Science

Blog banner

Biometric Authentication and Privacy: Balancing Ethical Concerns

Blog banner

Interrupts - Types, Working & Importance

Blog banner

Importance of Website

Blog banner

OPERATING SYSTEM

Blog banner

Data Security and Data Privacy in Data Science

Blog banner

How to grow followers on Instagram business account?

Blog banner

What is Amazon?

Blog banner

5 Things I As A Dentist Would Never Do (And What You Can Learn From It)

Blog banner

Question

Blog banner

Threats To Computer System

Blog banner