From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id DAA19635; Mon, 17 Jun 2002 03:04:08 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA19320 for ; Mon, 17 Jun 2002 03:04:07 +0200 (MET DST) Received: from postfix3-2.free.fr (postfix3-2.free.fr [213.228.0.169]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g5H145P27426 for ; Mon, 17 Jun 2002 03:04:06 +0200 (MET DST) Received: from lfs (strasbourg-2-a7-62-147-13-61.dial.proxad.net [62.147.13.61]) by postfix3-2.free.fr (Postfix) with SMTP id 6B2CB17EF8 for ; Mon, 17 Jun 2002 03:04:04 +0200 (CEST) Date: Mon, 17 Jun 2002 03:12:19 +0200 From: Nicolas FRANCOIS (AKA El Bofo) To: Caml List Subject: [Caml-list] Problem with Graph module Message-Id: <20020617031219.2dd51ec3.nicolas.francois@free.fr> X-Mailer: Sylpheed version 0.7.6 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk A strange thing, under Linux : this piece of code : open Graphics;; open Random;; type t_fourmi = {mutable dir : int; mutable x : int; mutable y : int};; let trace_fourmi_deux_etats n = let mouvement = [|(0, 5); (-5, 0); (0, -5); (5, 0)|] in let init = open_graph " 800x800+50-50" in let ma_fourmi = {dir = 0; x = 349; y = 349} in let onestep () = if (point_color ma_fourmi.x ma_fourmi.y) = white then begin set_color black; ma_fourmi.dir <- if ma_fourmi.dir + 1 > 3 then 0 else ma_fourmi.dir + 1 end else begin set_color white; ma_fourmi.dir <- if ma_fourmi.dir - 1 < 0 then 3 else ma_fourmi.dir - 1 end; fill_rect ma_fourmi.x ma_fourmi.y 5 5; let (dx, dy) = mouvement.(ma_fourmi.dir) in ma_fourmi.x <- ma_fourmi.x + dx; ma_fourmi.y <- ma_fourmi.y + dy; in init; for i = 0 to n do onestep (); for j = 1 to 10000 do begin end done done;; trace_fourmi_deux_etats 10000;; works perfectly in camllight (with a few modifications to adapt the code), but not in Ocaml. The graphic window opens well, but the test if (point_color ma_fourmi.x ma_fourmi.y) = white is allways false under Ocaml. Can you see the problem ????? Thanks. -- Nicolas FRANCOIS http://nicolas.francois.free.fr A TRUE Klingon programmer does NOT comment his code ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners