I have been thinking of reproducing the Tron:Legacy human vs. computer with the light cycles. I will post the code and a few screenshots in a few minutes.
There is one here, but the AI is not all that intelligent. Feel free to keep working on yours, and maybe you could try improving the AI on that one Smile

EDIT: that one is for monochrome. if you're making it for CSE or CE, that's cool! I would love to see it.
How is this project going?

That AI in the program Michael2_3B linked is quite predictable. The program as a whole is quite well optimized.

Here is what I have. I am sure both the AI and speed could be improved upon.


Code:
StoreGDB 1
ClrDraw
FnOff
AxesOff
GridOff
0->Xmin:264->Xmax
0->Ymax:~164->Ymin
TextColor(BLUE
Text(~1,55,31,"TRON:LIGHT CYCLES
TextColor(RED
Text(120,65,"Press ENTER to begin
Pause
ClrDraw
Horizontal Ymax,BLACK
Horizontal Ymin+1,BLACK
Vertical Xmin,BLACK
Vertical Xmax-1,BLACK
82->A
66->B
82->C
198->D
26->K
{3,3,3,3->L2
Pxl-On(A,B,BLUE
Pxl-On(C,D,RED
Repeat K=45
getKey
If max(Ans={24,25,26,34,45
Ans->K
A+(K=34)-(K=25->A
B+(K=26)-(K=24->B
{pxl-Test(C-1,D),pxl-Test(C+1,D),pxl-Test(C,D-1),pxl-Test(C,D+1->L1
0->H
If rand>.95
randIntNoRep(1,4,4->L2
Repeat H=4 or not(L1(L2(H
H+1->H
End
L2(H->G
(G=2)-(G=1->E
(G=4)-(G=3->F
C+E->C
D+F->D
If pxl-Test(A,B) or pxl-Test(C,D:Then
"Game Over
If 4=sum(L1:"You Win
Disp Ans
Return
End
Pxl-On(A,B,Blue
Pxl-On(C,D,Red
End
The one that Michael posted is very easy to beat. It is also very slow. I will try to improve upon speed and the AI. The only problem is.... where do I start?

Here are a couple of screenshots


Ok, so if you take Electro's code and make the "bikes" go multiple spaces instead of one, it should make it look faster.
It does, but the AI is absolute crap. It literally drives itself into traps all on its own!!!!!! This AI needs a serious overhaul.
I wouldn't even consider it an AI at all. It doesn't have any intelligence whatsoever.

A while ago I did try to improve it, although I only thought about it a tiny bit. What you could do is to program it to come directly at you, however that too is not that great. You would want to program it so that it tries to cut you off, and also avoids being cut off by the player. Of course, you would want to make it so that it actually can lose at some point, or else it's not beatable Smile
Both options are feasible, but I want a somewhat intelligent AI. Otherwise, there's no point to the game.
The biggest issue I see in writing the AI is not wall avoidance, but both knowing how/when to make traps and how to avoid trapping itself (if feasible). this requires some thought backstepping, recognizing wall patterns, and maybe even some foreplanning capability. in other words, getting a real AI is going to be well nigh impossible without slowing the program down so much that it cant run right.

However, some AI improvements you could do:
1) to make it target the player, set it to where every x amount of spaces, it re-evaluates whats going on (ie where it is in relation to player) and rights itself, but will ignore the player if a "panic mode" is set (set if 3px from a wall to left, right, or front, causing evasiveness, unless panic is reset by something (such as, its trying to catch up to player and is using wall for speed boost (if that's in the game)))

2) Avoidance code will check within a small area. just do a nested for loop checking pixel color over an area. do this only every x amount of updates, to lower speed cutting. however, the longer you wait, the large the area should be checked. maybe.

3) some basic patterned traps are possible. judging by its position, the opponents, and their directions, set some variable to be what kind of trap is being set up. the trap is some pre-defined direction codes, telling the AI where to go for how long.

hopefully these ideas will help you with what you are trying to do.
Thanks, Luxen.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement