Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
31 halyavin 1
; C4
2
; Copyright (c) 2002 Thomas Mathys
3
; killer@vantage.ch
4
;
5
; This file is part of C4.
6
;
7
; C4 is free software; you can redistribute it and/or modify
8
; it under the terms of the GNU General Public License as published by
9
; the Free Software Foundation; either version 2 of the License, or
10
; (at your option) any later version.
11
;
12
; C4 is distributed in the hope that it will be useful,
13
; but WITHOUT ANY WARRANTY; without even the implied warranty of
14
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
; GNU General Public License for more details.
16
;
17
; You should have received a copy of the GNU General Public License
18
; along with C4; if not, write to the Free Software
19
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
 
21
%infdef _RANDOMAI_INC
22
%define _RANDOMAI_INC
23
 
24
	section .text
25
 
26
 
27
 
28
;**********************************************************
29
; randomaiGetMove
30
; getmove routine for random "ai" player
31
;
32
; input		:	eax = cpu level (ignored by this player:)
33
; output	:	eax = move
34
; destroys	:	everything
35
;**********************************************************
36
randomaiGetMove
37
 
38
.l:
39
	call rand		; get random number in the range [1,7]
40
	xor edx,edx		; !
41
	mov ebx,7
42
	div ebx
43
	inc edx
44
	BOARDISVALIDMOVE edx	; is this a valid move ?
45
	jz .l			; no -> try again
46
 
47
	mov eax,edx		; return move
48
	ret
49
 
50
%endif