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

What if COVID does not exist!

Blog banner

Culture Of Ladakh

Blog banner

Mariana Trench: The deepest depths

Blog banner

DNS Cache

Blog banner

memory managment

Blog banner

The Peephole

Blog banner

POSITIVE ATTITUDE IN LIFE

Blog banner

Virtual Memory

Blog banner

Operating System Objectives and Functions

Blog banner

Fashion design

Blog banner

Kernel in Operating System

Blog banner

Environmental Management using GIS

Blog banner

Time Series Analysis

Blog banner

MORDERN UNIX SYSTEM

Blog banner

File management in os

Blog banner

Virtual memory in windows

Blog banner

Cloud Computing: Threats and Vulnerabilities

Blog banner

MoSCoW METHOD IN DATA SCIENCE

Blog banner

Uniprocessor Scheduling

Blog banner

THE ACTORS LIFE

Blog banner

Virtual Memory

Blog banner

An Overivew Of Cache Memory

Blog banner

Mango Raisin Chutney (sweet mango raisin spread)

Blog banner

Photography

Blog banner

What is 'Multi-core and Multi-threading' ?

Blog banner

Technical Challenges and Directions for Digital Forensics

Blog banner

Modern Operating System - Khush bagaria

Blog banner

Multicore and Multithreading

Blog banner

?What Children Learn Between Activities: The Hidden Learning Moments in a Preschool Day

Blog banner

Bharat Maps

Blog banner

Social Engineering

Blog banner

Way to make your meal healthier.

Blog banner

Data Lake

Blog banner

Sleep Matters: The Science Behind Toddler Naps

Blog banner

DIGITAL TECHNOLOGY

Blog banner

Penetration Testing

Blog banner

What is Amazon?

Blog banner

New Ransomware Encrypts Your Android And Then Changes PIN Lock

Blog banner

Is it important to follow all the trends that come up on social media?

Blog banner

TOP 5 GAMING GADGETS (2024)

Blog banner

IT RISK

Blog banner

Predictive Analysis - Ek Overview

Blog banner