wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Number Guessing game --lisp

profile
Rohan undefined
Jul 16, 2025
0 Likes
0 Discussions
1 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

Emailing the merger document

Blog banner

Memory management

Blog banner

**THE MUJAWARR: Transforming the Logistics Industry**

Blog banner

Smartsheet

Blog banner

Digital Forensics Challenges and Tools

Blog banner

Why is it hard to design an Operating Systems ?

Blog banner

Threads

Blog banner

Harsh Rathod

Blog banner

Importance Of Yoga.

Blog banner

Uniprocessor scheduling

Blog banner

Article on team management software

Blog banner

Deadlock

Blog banner

Teenagers of Today

Blog banner

Fossil Hunting 101 at the Peace River, Arcadia, Florida, USA

Blog banner

Thumb Sucking: When It’s Normal and When It Becomes a Dental Problem

Blog banner

Modern Operating system

Blog banner

BharatPe

Blog banner

Memory Management

Blog banner

Models of Information Security.

Blog banner

Multicore and Multithreading

Blog banner

Why You Need 2FA (Two-Factor Authentication) On Your Email And Other Online Accounts

Blog banner

Race condition

Blog banner

PROCESS STATES OF OPERATING SYSTEM

Blog banner

File system implementation

Blog banner

How Personalised Gifts Create Lasting Memories for Children?

Blog banner

What is OS and its overview

Blog banner

What is Influencer Marketing and its Trends

Blog banner

How College Events Build Real-world Skills You Can’t Learn From Textbooks

Blog banner

Smart Homes | Zigbee Alliance

Blog banner

Title: Network Sniffing Techniques: Uncovering the Secrets of Data Transfer

Blog banner

Diwali

Blog banner

A Happier Workplace Starts with Healthy Lunches by Meal Maharaj

Blog banner

Fault Tolerance in an Operating System

Blog banner

SMARTSHEET MANAGEMENT SOFTWARE

Blog banner

Introduction to Data Science: Life Cycle & Applications

Blog banner

MPL and how its effects?

Blog banner

Big Data Architecture

Blog banner

10 Signs your Computer has Virus

Blog banner

Salt, Sand, and Smiles: Does the Maroubra Lifestyle Affect Your Enamel?

Blog banner

Heart Fulness Meditation

Blog banner

Jamming Attacks in Network Security: Disrupting Communication Signals

Blog banner

The Role of Data Provenance and Lineage in Modern Data Science

Blog banner