Recursive Integer Guessing Game

버전 1.0.0.0 (1.59 KB) 작성자: Adam Gripton
A recursive algorithm that queries an objective function to guess an unknown integer.
다운로드 수: 249
업데이트 날짜: 2012/3/21

라이선스 보기

An integer guessing 'game' for a
function `isleq', that returns true for
all values less than or equal to a
mystery number.

Syntax: z=guessgame(isleq,n,k)

In tertiary function notation:

g(n,k) =
| k==0 :: isleq(n) ? n : n+1;
| k>0 :: isleq(n+(2^k)-1) ?
g(n,k-1) : g(n+2^k,k-1);
| k<0 :: isleq(n+(2^(-k))-1) ?
g(n,(-k)-1) : g(n+(2^(-k)),k-1);

g(n,-k) for -k negative refers to an
unbounded search [n,inf] with current
search depth up to (n+2^(-k)-1) :

e.g. g(15,-4) denotes [15,30].

g(n,k) for k positive refers to a
search over the interval
[n,(n+(2^(k+1))-1)] :

e.g. guess(63,5) denotes [63,126].

Initial function should be run with n
set as a lower bound (default 1).

Function isleq can be replaced with an
integer instead.

인용 양식

Adam Gripton (2026). Recursive Integer Guessing Game (https://kr.mathworks.com/matlabcentral/fileexchange/35787-recursive-integer-guessing-game), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2012a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Magic에 대해 자세히 알아보기
버전 게시됨 릴리스 정보
1.0.0.0