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

Deadlock and Starvation

Blog banner

Big Data Architecture

Blog banner

MODERN OPERATING SYSTEMS

Blog banner

How Sleep Impacts Learning and Behaviour for Toddlers?

Blog banner

Why Are So Many Adults Getting Diagnosed with ADHD?

Blog banner

Improving the Accuracy of GPS and GNSS

Blog banner

Memory management

Blog banner

Know your Processors!

Blog banner

Environmental Management using GIS

Blog banner

computer security

Blog banner

10 Unknown facts about India's Independence

Blog banner

ODOO

Blog banner

Rules and Regulations of Networking: "Standards and Protocols" - Part 2

Blog banner

What is Influencer Marketing and its Trends

Blog banner

memory cache

Blog banner

Deadlock in operating system

Blog banner

A Journey By Train

Blog banner

c

Blog banner

Pandas Matrix Applications

Blog banner

DURGA POOJA

Blog banner

GraphX:- A graph processing tool

Blog banner

Top 5 Places To Stay And Visit In Berlin, Germany

Blog banner

The New Rules of UI/UX Design Every Website Must Follow in 2026

Blog banner

Why Does Hierarchy Still matter in Organizations?

Blog banner

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

Blog banner

From Loom to Luxury: How Patola Elevates Modern Wardrobes

Blog banner

Assignment-3

Blog banner

Hacking of web server and application

Blog banner

1.1 basic elements

Blog banner

TEAMWORK

Blog banner

Online Games

Blog banner

Virtual memory in windows

Blog banner

A MODERN OPERATING SYSTEM

Blog banner

Is Pursuing a Dance Career in India Worth it?

Blog banner

Explain Kernel in OS

Blog banner

Direct Memory Access

Blog banner

The Laws of Karma

Blog banner

Developments in Modern Operating Systems

Blog banner

Dekkers Algorithm : Ensuring Safe Process Synchronization

Blog banner

Affiliate Marketing V/S Influencer Marketing

Blog banner

Evolution of the Microprocesor

Blog banner

Direct Memory Access

Blog banner