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

Mobile Security

Blog banner

The evolution of OS

Blog banner

Cache Memory

Blog banner

c

Blog banner

Making Money through Instagram

Blog banner

Women empowerment

Blog banner

Computer Forensics and its Impact in Business Environment

Blog banner

Exploring the Power of Encase Forensic Tools: Unraveling Digital Mysteries

Blog banner

Evolution of OS

Blog banner

semaphores in os

Blog banner

Modern Operating System

Blog banner

Stephen Hawking : A Remarkable Physicist

Blog banner

Mutual exclusion

Blog banner

Major achievement

Blog banner

Service Transition Process in ITSM

Blog banner

All you need to know about “On-page SEO”

Blog banner

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

Blog banner

Zomato (Income Sources)

Blog banner

Pro-Tips On How To Keep your Foot Healthy

Blog banner

Modern Operating System

Blog banner

Types Of Interrupt

Blog banner

STARVATION

Blog banner

10 Signs That Prove YOU are his FIRST priority.

Blog banner

TRELLO

Blog banner

What is Vishing?

Blog banner

Cyber Crime Investigation In The Era Of Big Data

Blog banner

Big Data Architecture

Blog banner

Policies for Service Transition

Blog banner

Web browser forensics:Tools,Evidence collection and analysis

Blog banner

Photography

Blog banner

Modern operating system

Blog banner

Threats To Computer System

Blog banner

Respondo Launches Revolutionary Video Discussion App

Blog banner

What is time ? The term which has astonished Scientists

Blog banner

Internet of Things and cyber security

Blog banner

CYBER FORENCIS: PAST, PRESENT AND FUTURE.

Blog banner

HR Automation : Need of the hour

Blog banner

Note on Process, Process creation and Process termination

Blog banner

" THE ANSWERS THAT LED INDIAN BEAUTIES TO THE MISS UNIVERSE HISTORIC WIN. "

Blog banner

Security requirements for Safe E-Payments

Blog banner

Android Flashlight Application

Blog banner

Deadlock and Starvation

Blog banner