Forum Archive

Go Back   3D Realms Forums > General Topics > Programming Forum
Blogs FAQ Members List Social Groups Calendar Mark Forums Read

Notices

 
 
Thread Tools
Old 06-03-2005, 10:35 AM   #1
Blue Phoenix
My First game (tic tac toe)
This is my first game, writen in Pascal.

I welcome tips and coments.

-------------
aside: my main compiler (free pascal) started giving |Fatal: Unexpected End of File| so I had to compile with Turbo Pascal 5.5
Attached Files
File Type: zip 867328-Tic.zip (6.1 KB, 81 views)
Blue Phoenix is offline  
Old 06-03-2005, 01:44 PM   #2
Kristian Joensen

Kristian Joensen's Avatar
Re: My First game (tic tac toe)
You couldn't choose a better language than Pascal.
Kristian Joensen is offline  
Old 06-03-2005, 02:04 PM   #3
Blue Phoenix
Re: My First game (tic tac toe)
And what pray tell is wrong with Pascal?
Blue Phoenix is offline  
Old 06-03-2005, 03:15 PM   #4
Shlubalubs

Shlubalubs's Avatar
Re: My First game (tic tac toe)
He said you couldn't choose a better language than pascal, i dont think he was implying a negative comment about it. and your game has turned out good [for a game of noughts and crosses]
Shlubalubs is offline  
Old 06-03-2005, 03:30 PM   #5
Eddy Willson
Re: My First game (tic tac toe)
Good game!

Do you plan to add anymore features?
__________________
YOU.HAVE.GOT.TO.BE.KISSING.ME - Ivan

If i was a preteen id probably love you too - Fat John

AcornArcade
---------------
The Icon Bar
Eddy Willson is offline  
Old 06-04-2005, 09:59 AM   #6
Kristian Joensen

Kristian Joensen's Avatar
Re: My First game (tic tac toe)
Quote:
Retro gamer said:
He said you couldn't choose a better language than pascal, i dont think he was implying a negative comment about it. and your game has turned out good [for a game of noughts and crosses]
That is the correct interpretation of my post.
Kristian Joensen is offline  
Old 06-04-2005, 02:31 PM   #7
Blue Phoenix
Re: My First game (tic tac toe)
Sorry, I instinctively interpreted it negatively because last time some bozos tried to convince me C or BASIC where better.

Quote:
Eddy Willson said:
Good game!

Do you plan to add anymore features?
I'm going to tinker with the CRT unit which currently used only to clear the screen. Other things I may add, configeration file and rudimentary AI(will probably be random at first).
Blue Phoenix is offline  
Old 06-05-2005, 11:58 PM   #8
DudeMiester

DudeMiester's Avatar
Re: My First game (tic tac toe)
Make a perfect AI (not that hard really) and add a random error factor. Thats should do fine, and you can scale difficulty by scaling the error factor. You might want to add tallied repeating matches too (best of 5, best of 9, best of 2n+1, etc...)
__________________
Forums are the Opiate of the Masses
Higher Game -- "Animal fur is renewable, unlike the oil used to make plastic!"
DudeMiester is offline  
Old 06-13-2006, 01:11 PM   #9
Isamaru
Guest
Re: My First game (tic tac toe)
I signed up to look at your program hehe...

I built my own in Delphi4 and its a graphical program.

I was wondering if anyone could offer any advice on how to go about implementing a Human vs Computer procedure. I know the computer has to check a few things so it's not making random moves, but is there a certain way to do this?

Thank you for your help, I've attached a ZIP of the program if you want to take a look...
Attached Files
File Type: zip TicTacToe.zip (11.9 KB, 7 views)
 
Old 06-13-2006, 04:55 PM   #10
Tolle
Re: My First game (tic tac toe)
Console games like this bring back the "good old days" feeling

I had a lot of fun with SWAG ten years ago, when i learned PASCAL
There is some good stuff in there
Tolle is offline  
Old 07-01-2006, 08:32 AM   #11
Samji

Samji's Avatar
Re: My First game (tic tac toe)
Quote:
Originally Posted by Kristian Joensen
You couldn't choose a better language than Pascal.
@Blue Phoenix:

Observe the missing "?".

Quote:
You couldn't choose a better language than Pascal.
is not the same as:

Quote:
You couldn't choose a better language than Pascal?
__________________
Sam's Py
Samji is offline  
Old 07-02-2006, 10:19 AM   #12
8IronBob

8IronBob's Avatar
Re: My First game (tic tac toe)
Yeah, I sorta wonder if Delphi has any backwards compatibility to traditional Pascal at all...
__________________
PC Specs (a.k.a. "Galacticus Prime"): http://pcpartpicker.com/p/7Vk7FT
8IronBob is offline  
Old 07-20-2006, 08:57 PM   #13
Drewcifer
 

Drewcifer's Avatar
Re: My First game (tic tac toe)
I suggest a brute force AI that runs through every possible scenario for each of its possible moves and selects the move having the most winning scenarios. This is the system Deep Blue used to beat whats his face. Of course, since the tic-tac-toe board is only 3x3, you won't need a super computer like Deep Blue.
Drewcifer is offline  
Old 07-20-2006, 10:12 PM   #14
Xerxes
Re: My First game (tic tac toe)
Quote:
Originally Posted by Drewcifer
This is the system Deep Blue used to beat whats his face.
There's always a more effecient way though, so look for patterns unless it's fast enough. There are up to 362880 combinations according to math(so don't bother optimizing, I guess).

And if you use recursive functions, there's always a way to make each function no longer recursive but serve the same functionality.

Not sure what method to use but it's possible and will make the function more complicated.
Xerxes is offline  
Old 07-20-2006, 10:57 PM   #15
Otto von Keisinger

Otto von Keisinger's Avatar
Re: My First game (tic tac toe)
Quote:
Originally Posted by Xerxes
There's always a more effecient way though, so look for patterns unless it's fast enough. There are up to 362880 combinations according to math(so don't bother optimizing, I guess).
Actually, a bit of optimization, such as using a heuristic to avoid repeating the same calculations on further games (i.e., eliminating the particularly dumb moves), could significantly reduce that time. Of course, I haven't exactly thought it through, but perhaps using a few programmer defined rules to eliminate calculating the moves that will lead the computer to always lose in two turns or less could significantly speed up a brute force approach.

Quote:
Originally Posted by Xerxes
And if you use recursive functions, there's always a way to make each function no longer recursive but serve the same functionality.
O rly? Show me a non-recursive version of the Mandelbrot set, i.e., where you don't iterate Z=(Z^2)+C.
__________________
I bring nothing to the table.
As Edward George Earl Bulwer-Lytton wrote in 1839, "The Boot Is Mightier Than The Fist." --Beelze
Otto von Keisinger is offline  
Old 07-22-2006, 03:11 PM   #16
Xerxes
Re: My First game (tic tac toe)
Quote:
Originally Posted by Otto von Keisinger
do stuff
I can't quite figure out how to do a normal old set but pretend this works:

//Returns weather or not c1,c2 is in the whateveritwas set.
//Or is supposed to... It's borken and I don't really know why. (z1^2+z2^2)^0.5 is supposed to be 0.5ish in one instance and it's 0.7 so I get a white box when I run it. I'd blame it on float accuracy but I get a white box so it's probably my fault.
//Z1,z2 - set to 0 when calling
//C1,c2 - the number you're checking
//i - set to 0
//imax - So you don't get stuck in an infinate loop/stack overflow if the number works.
//So this would be a lot easier to call if I had remembered that you could set defaults for function parameters.
bool mc(float z1, float z2, float c1, float c2, int i) {
if (i>imax) { return 1; }
if (pow((z1*z1)+(z2*z2), 0.5) > 2) return 0;
return mc((z1*z1)+c1, (z2*z2)+c2, c1, c2, i+1);
}

You would change it to:

bool mc(float c1, float c2) {
bool res=1;
float z1, z2;
for (int i=0;i<imax) {
if (pow((z1*z1)+(z2*z2), 0.5) > 2) { res=0; break; }
z1=(z1*z1)+c1
z2=(z2*z2)+c2
}
return res;
}

Or whatever it's supposed to be.
You still have the accuracy problem but now it's not recursive.
Xerxes is offline  
Old 07-24-2006, 05:27 PM   #17
Otto von Keisinger

Otto von Keisinger's Avatar
Re: My First game (tic tac toe)
My point was that the Mandelbrot set falls into the category of programs that have to be iterated, as far as anyone knows. Turing came up with a proof that it is impossible to determine whether a recursive program terminates, e.g., the Mandelbrot set (there's a reason why it's called an escape time fractal). Basically, it involves a program ("checker") to test whether or not a(ny) program terminates. This checker is defined as running non-recursively.

It can be shown that this progam cannot exist. Suppose you were to run this hypothetical checker on itself. Since the checker requires code to test, there are an infinite number of possibilities. In fact, it is impossible to test the checker without having code to run on, in other words, the checker would have to be run to be tested. Therefore, it would have to break it's own rules to check itself, and it must not exist.

Oh, and you should know that Z and C are complex numbers, not floats. C is really Z0; blame the mathemeticians for not using a clear and consistent language.
__________________
I bring nothing to the table.
As Edward George Earl Bulwer-Lytton wrote in 1839, "The Boot Is Mightier Than The Fist." --Beelze
Otto von Keisinger is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 04:23 PM.

Page generated in 0.22285604 seconds (100.00% PHP - 0% MySQL) with 19 queries

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.

Website is 1987-2014 Apogee Software, Ltd.
Ideas and messages posted here become property of Apogee Software Ltd.