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

GIS Applications: How Different Industries are Leveraging Geospatial Data

Blog banner

Processes: Process Description and Control.

Blog banner

Direct Memory Access

Blog banner

Data Science in Mental Health Prediction

Blog banner

Importance of modern technology era

Blog banner

How to invest in Indian Stock Market ? ~ Tutorial 1

Blog banner

"The Benefits of Using GIS in Agriculture"

Blog banner

Article on Team Work

Blog banner

Festive Ethnic Wear Guide: Patola-Inspired Looks for Every Celebration

Blog banner

Uniprocessor and Types

Blog banner

Why Meal Maharaj Prioritises Seasonal Vegetables in Every Meal Box

Blog banner

Social Network Analysis: Ek Naya Nazariya Data Science Mein

Blog banner

BrainGate Technology

Blog banner

Constrains in service design

Blog banner

Delhi city

Blog banner

Full Disk Encryption on Digital Forensics

Blog banner

Google App Engine

Blog banner

Getting to Kashmir: Alternative to the Jammu-Srinagar highway

Blog banner

Digital Footprints An Emerging Dimension of Digital Inequality

Blog banner

Memory Management

Blog banner

DNS Cache

Blog banner

Travel: Everything Everywhere!

Blog banner

Apache Spark :- Powerful Data Processing Tool

Blog banner

You'll get to know about Pankaj Negi

Blog banner

Data Lakes: A Key to Modern Data Management

Blog banner

Virtual Memory

Blog banner

Short note on Microsoft office

Blog banner

Deadlock and Starvation

Blog banner

Women Empowerment

Blog banner

INTRANET

Blog banner

Simple AI Symptom Diagnosis Using LISP – Rule-Based Expert System

Blog banner

LiquidPlanner

Blog banner

Electronic data interchange

Blog banner

File management

Blog banner

A Day in the Life at Elzee: What Your Child Does Between Drop-Off and Pick-Up

Blog banner

Memory management

Blog banner

CYBER SECURITY CHALLENGES

Blog banner

The most common internet security threats

Blog banner

Tableau

Blog banner

Drawing tips for a beginner

Blog banner

Corporate Discipline.

Blog banner

Geographic Information Systems(By aditi Unnikrishnan)

Blog banner