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

Data Lake

Blog banner

Memory management and virtual memory

Blog banner

Education?

Blog banner

MQTT (MQ Telemetry Transport) in Data Science

Blog banner

SQL Injection

Blog banner

Layers Of Blockchain

Blog banner

MORDERN UNIX SYSTEM

Blog banner

Understanding Input Based Keylogger Activation Systems: Risks and Mitigation

Blog banner

Gamer life

Blog banner

The War With Cold On Earth

Blog banner

Disk cache

Blog banner

Mendeley (management software)

Blog banner

Blog on Smartsheet.

Blog banner

Cloud Computing: Threats and Vulnerabilities

Blog banner

GIS Bharat Maps

Blog banner

VIRTUAL MACHINES

Blog banner

Hash password! Is it really secured?

Blog banner

Data Mapping

Blog banner

What are NFT s?

Blog banner

I/O Management and Disk Scheduling

Blog banner

Cyber Security in Data Breaching

Blog banner

Virtualisation

Blog banner

Interrupts in OS

Blog banner

Mobile Security

Blog banner

File management in os

Blog banner

Memory management

Blog banner

“CONSISTENCY” in Social Media Marketing

Blog banner

HOW CAN SOCIAL MEDIA MAKE YOU HAPPIER?

Blog banner

Shoulders

Blog banner

Top 4 Places To Stay In Copenhagen

Blog banner

BUSINESS MODELS OF E COMMERCE

Blog banner

Sleep Matters: The Science Behind Toddler Naps

Blog banner

Operating system evolution

Blog banner

Kernel in Operating System

Blog banner

Process states

Blog banner

IT Service as as Value Creation

Blog banner

Virus

Blog banner

Top 5 Places To Stay And Visit In Berlin, Germany

Blog banner

memory managment

Blog banner

Buffer Overflow

Blog banner

What are the different types of E-mail crime and process of email forensic?

Blog banner

Way to make your meal healthier.

Blog banner