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

12 Principles of Animation

Blog banner

EdTech (Education Technology)

Blog banner

Interrupts in OS

Blog banner

New Ransomware Encrypts Your Android And Then Changes PIN Lock

Blog banner

Things You Should Leave Behind In 2025, Whilst In 2026

Blog banner

MEMORY MANAGEMENT REQUIREMENT

Blog banner

Kernel in Operating System

Blog banner

Understanding - Proof of Work!

Blog banner

Emailing the merger document

Blog banner

Wedding photographer

Blog banner

CoWIN

Blog banner

Boxing

Blog banner

The Power of Forensic Watermarking in the Fight Against Content Piracy

Blog banner

Street foods

Blog banner

Internet: The Vast Ocean Of Knowledge.

Blog banner

Importance of education

Blog banner

Everything You Need for a Perfect Stay in Arcadia, Florida, USA.

Blog banner

OLA

Blog banner

Importance of self defence for girls

Blog banner

Social Engineering Deceptions and Defenses

Blog banner

EMAIL INVESTIGATION

Blog banner

File Management

Blog banner

Threads

Blog banner

Memory Management - operating system

Blog banner

Study on cyber and network forensic in computer security management

Blog banner

IP Address

Blog banner

Objectives and functions of Operating System...

Blog banner

Inventory management software system

Blog banner

The Laws of Karma

Blog banner

Iphone or Android which is the best smartphone?

Blog banner

How to Build an Effective Digital Campaign

Blog banner

Theads

Blog banner

What Your Music Taste Reveals About Your Personality

Blog banner

Direct Memory Access

Blog banner

MAHAKAL LOK UJJAIN

Blog banner

Memory management

Blog banner

Tomato Butter Sauce with Bucatini

Blog banner

KAHAWA TEA

Blog banner

Threats To Computer System

Blog banner

E-commerce

Blog banner

Networking 101: How to Build Meaningful Connections in College

Blog banner

Linux Memory Management

Blog banner