Hunt The Wumpus/CSharp: Difference between revisions

m
Fixed syntax highlighting.
(added c#)
 
m (Fixed syntax highlighting.)
 
(One intermediate revision by one other user not shown)
Line 5:
<br>
 
===Code===
[[File:wumpus_java.png|200px|thumb|right]]
{{trans|Java}}
<langsyntaxhighlight lang="csharp">using System;
using System.Collections.Generic;
using System.Drawing;
Line 96:
 
// don't place hazards close to the starting room
private bool TooClose(int room)
{
if (currRoom == room)
Line 245:
}
 
private void DrawPlayer(Graphics g)
{
int x = rooms[currRoom, 0] + (roomSize - playerSize) / 2;
Line 259:
}
 
private void DrawStartScreen(Graphics g)
{
var brush = new SolidBrush(Color.FromArgb(0xDD, Color.White));
Line 270:
}
 
private void DrawRooms(Graphics g)
{
var fatLine = new Pen(Color.DarkGray, 2);
Line 307:
}
 
private void DrawMessage(Graphics g)
{
if (!gameOver)
Line 324:
if (messages.Count > 3)
{
g.DrawString("& " + messages[3], font, Brushes.Black, 20, Height - 5760);
}
 
Line 331:
}
 
private int[,] rooms = {{334, 20}, {609, 220}, {499, 540}, {169, 540}, {62, 220},
{169, 255}, {232, 168}, {334, 136}, {435, 168}, {499, 255}, {499, 361},
{435, 447}, {334, 480}, {232, 447}, {169, 361}, {254, 336}, {285, 238},
{387, 238}, {418, 336}, {334, 393}};
 
private int[,] links = {{4, 7, 1}, {0, 9, 2}, {1, 11, 3}, {4, 13, 2}, {0, 5, 3},
{4, 6, 14}, {7, 16, 5}, {6, 0, 8}, {7, 17, 9}, {8, 1, 10}, {9, 18, 11},
{10, 2, 12}, {13, 19, 11}, {14, 3, 12}, {5, 15, 13}, {14, 16, 19},
{6, 17, 15}, {16, 8, 18}, {19, 10, 17}, {15, 12, 18}};
}
}</langsyntaxhighlight>
9,476

edits