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

Decision Tree: A Diagram Model

Blog banner

Objectives and Functions of Operating System

Blog banner

Is Brushing After Eating Damaging Your Teeth? (Fact or Myth)

Blog banner

Mumbai

Blog banner

Old age lifestyle

Blog banner

Having passion in life

Blog banner

Importance of Website

Blog banner

PERSONAL STORIES

Blog banner

What Makes Patola the Queen of Silk?

Blog banner

How return on investment is defined in IT services

Blog banner

10 Alien Encounters and Abduction Stories

Blog banner

5 Stages of Digital Marketing

Blog banner

Fitness

Blog banner

The Procedural Framework for Corporate High-Tech Investigations

Blog banner

Cache Memory

Blog banner

Vikrant’s first blog

Blog banner

Install Ubuntu in Vmware

Blog banner

21ST CENTURY PATRIARCHY

Blog banner

The Laws of Karma

Blog banner

Whatsapp Messenger

Blog banner

Study of Sniffing Tools

Blog banner

Virtual Memory - Explaination, Working, Steps

Blog banner

A Weekend at Oak Tree Hotel: The Best Hotel Experience in Arcadia, Florida

Blog banner

Dangers of Using Public WiFis

Blog banner

I/O Buffering

Blog banner

Embracing the power of Modern Machine UNIX

Blog banner

Embaded operating system

Blog banner

"The Benefits of Using GIS in Agriculture"

Blog banner

Threat from Inside: Educating the Employees Against Cyber Threats

Blog banner

You Get Everyone, But No One Gets You: The Lonely Side of High Emotional Intelligence

Blog banner

Deadlock

Blog banner

OS DESIGN CONSIDERATIONS FOR MULTIPROCESSOR

Blog banner

Reconnaissance

Blog banner

PERSONALITY DEVELOPMENT

Blog banner

Introduction to Virtual Memory - 080

Blog banner

Deadlock and Starvation

Blog banner

MoSCoW METHOD IN DATA SCIENCE

Blog banner

Why Data Security Is Important

Blog banner

How Cyber Forensics use in AI

Blog banner

Bulk E-mail software

Blog banner

USES OF WHATSAPP

Blog banner

INTRODUCTION

Blog banner