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

"Audit" In Data Science

Blog banner

Patola Outfits for the Modern Wardrobe: Reviving Indian Handloom in Style

Blog banner

The evolution of OS

Blog banner

Benefits and drawback of web security.

Blog banner

Ghee vs. Coconut Oil vs. Mustard Oil: Which Cooking Fat Wins for Indian Food?

Blog banner

Time Series Analysis

Blog banner

CSI and Organizational Change

Blog banner

Service Validation and Testing during the Design Phase

Blog banner

Is Social Media Marketing The Next Wave Of Digital Marketing?

Blog banner

What is OS and its overview

Blog banner

Why is ITSM important in IT organization?

Blog banner

Modern operating system

Blog banner

Interrupts in OS

Blog banner

Jio .....A Revolution ?? ??

Blog banner

CYBER SECURITY CHALLENGES

Blog banner

WAKE UP ITS FOOD o'CLOCK...!!!!!

Blog banner

JUSTICE FOR EVERY “BEZUBAAN ANIMAL”

Blog banner

The Khan mehtab transforming the modular switches

Blog banner

differentiate thinking humanly and rationally

Blog banner

DIGITAL TECHNOLOGY

Blog banner

Security and E-mail

Blog banner

Virtual memory in windows

Blog banner

Method of Evaluating Information Security Level in an Organization

Blog banner

Virtual memory in os

Blog banner

Threat from Inside: Educating the Employees Against Cyber Threats

Blog banner

Data Science in Healthcare: Predicting Diseases

Blog banner

Memory Management

Blog banner

Unlocking Success: Mastering Google Ads Strategies

Blog banner

Cryptanalysis tool

Blog banner

Hacking of web server and application

Blog banner

Deadlock and Starvation

Blog banner

Risk factors in service transistion

Blog banner

26/11 The Black Day Of Mumbai

Blog banner

PPT methodology

Blog banner

What do you mean by online marketing and why do you need to know about it

Blog banner

What makes Nugget RC Racing Florida’s Most Exciting Racing Events?

Blog banner

Concurrency and memory

Blog banner

Fitness

Blog banner

A BLOG ON MYSQL

Blog banner

Malware Detection Techniques for Mobile Devices

Blog banner

IP ADDRESS

Blog banner

OS Evolution Achievements

Blog banner