comp.lang.ada
 help / color / mirror / Atom feed
* Re: Tic-Tac-Toe
       [not found] <01bc506c$00d54c40$33bad084@REMINGOLE.uqam.ca>
@ 1997-04-25  0:00 ` Michael F Brenner
  1997-04-26  0:00 ` Tic-Tac-Toe Jerry van Dijk
  1 sibling, 0 replies; 3+ messages in thread
From: Michael F Brenner @ 1997-04-25  0:00 UTC (permalink / raw)



> I would like help on building a program that plays tic-tac-toe
> My main problem is on the grafical interface.
> Since a usual game or board has 9 boxes, I want to make them coincide with
> the numeric pad  on the rigth.
> 1 2 3
> 4 5 6
> 7 8 9
> The x's and o' would alternate.

I would like to help you with your main problem, which you identify as
grafically making the 9 boxes coincide with the numerical pad on the right.

Since you did not state which compiler or operating system you are on,
I will assume that you are on DOS running gnat. Then the keys can be 
mapped as follows.

First, get keystrokes with the command text_io.get (ch), where
ch has been declared to be of type character. With the numerical
lock on, they keys map to the characters '1' through '9'. With the
numberical lock off the keys generate two bytes each, with the first
byte being binary zero. The second byte is as follows:

7 (home) gives 71
8 (up)   gives 72
9 (pgup) gives 73
4 (left) gives 75 
5 (mid)  gives 76
6 (rt)   gives 77 
1 (end)  gives 79
2 (down) gives 80
3 (pgdn) gives 81

To map them to the graphics you have chosen for the nine slots, use
an associative array or other data structure with similar functionality.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Tic-Tac-Toe
@ 1997-04-26  0:00 Sam Harbaugh, Palm Bay, Florida
  0 siblings, 0 replies; 3+ messages in thread
From: Sam Harbaugh, Palm Bay, Florida @ 1997-04-26  0:00 UTC (permalink / raw)



Hmmmm! I was once beaten at Tic Tac Toe by a chicken at the Santa Cruz
amusement park.  If a chicken can do it why is it so difficult?

In article <01bc506c$00d54c40$33bad084@REMINGOLE.uqam.ca> remingole@usa.net
writes:
>
>I would like help on building a program that plays tic-tac-toe

---------------------------------------
While I'm here I'll tell another one.
In my nth language comparison meeting (where n is a large number) it
occurred to me to say that JAVA meant Just Another Variation of Ada.
People seemed to think it was funny, or maybe they just needed to laugh to
break the stress.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Tic-Tac-Toe
       [not found] <01bc506c$00d54c40$33bad084@REMINGOLE.uqam.ca>
  1997-04-25  0:00 ` Tic-Tac-Toe Michael F Brenner
@ 1997-04-26  0:00 ` Jerry van Dijk
  1 sibling, 0 replies; 3+ messages in thread
From: Jerry van Dijk @ 1997-04-26  0:00 UTC (permalink / raw)



In article <01bc506c$00d54c40$33bad084@REMINGOLE.uqam.ca> remingole@usa.net writes:
>
>I would like help on building a program that plays tic-tac-toe
>My main problem is on the grafical interface.
>Since a usual game or board has 9 boxes, I want to make them coincide with
>the numeric pad  on the rigth.
>1 2 3
>4 5 6
>7 8 9
>The x's and o' would alternate.
>

OK, but what is your problem ?

--

-- Jerry van Dijk       | Leiden, Holland
-- Business Consultant  | Team Ada
-- Ordina Finance       | jdijk@acm.org




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-04-26  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-04-26  0:00 Tic-Tac-Toe Sam Harbaugh, Palm Bay, Florida
     [not found] <01bc506c$00d54c40$33bad084@REMINGOLE.uqam.ca>
1997-04-25  0:00 ` Tic-Tac-Toe Michael F Brenner
1997-04-26  0:00 ` Tic-Tac-Toe Jerry van Dijk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox