using System;
using System.Collections .Generic ;
using System.ComponentModel ;
using System.Data ;
using System.Drawing ;
using System.Linq ;
using System.Text ;
using System.Windows .Forms ;
using System.Threading .Tasks ;
using System.IO ;
namespace Soukoban
{
public partial class Form1 : Form
{
Bitmap bmp;
Graphics g;
Action< PreviewKeyDownEventArgs> DoKeyInput;
Action< PaintEventArgs> DoPaint;
Action DoUpdate;
private Tile[ , ] mTiles;
[ Flags]
enum Tile
{
None = 0 ,
Kabe = 1 ,
Okiba = 2 ,
Nimotu = 4 ,
Player = 8 ,
OK = Okiba | Nimotu
}
public Form1( )
{
InitializeComponent( ) ;
SetStyle( ControlStyles.AllPaintingInWmPaint , true ) ;
SetStyle( ControlStyles.OptimizedDoubleBuffer , true ) ;
SetStyle( ControlStyles.ResizeRedraw , true ) ;
SetStyle( ControlStyles.UserPaint , true ) ;
bmp = new Bitmap( 640 , 480 ) ;
g = Graphics.FromImage ( bmp) ;
Task.Factory .StartNew ( GameMain) ;
}
private void GameMain( )
{
GameInitialize( ) ;
DoPaint = PaintGameMain;
DoUpdate = UpdateGameMain;
DoKeyInput = InputGameMain;
while ( true )
{
DoUpdate( ) ;
Invalidate( ) ;
}
}
private void GameInitialize( )
{
}
private void LoadMap( int mapNo)
{
using( var sr = new StreamReader( @"map" + mapNo + ".dat" ) )
using ( var tr = sr as TextReader)
{
List< string> ss = new List< string> ( ) ;
while ( ! sr.EndOfStream )
{
ss.Add ( sr.ReadLine ( ) ) ;
}
mTiles = new Tile[ ss.Count ( ) , ss[ 0 ] .Length ] ;
for ( int y = 0 ; y < ss.Count ( ) ; y++ )
{
var s = ss[ y] ;
for ( int x = 0 ; x < s.Length ; x++ )
{
mTiles[ y, x] = ( Tile) Convert.ToInt32 ( s[ x] ) ;
}
}
}
}
private void InputGameMain( PreviewKeyDownEventArgs e)
{
}
private void PaintGameMain( PaintEventArgs e)
{
}
private void UpdateGameMain( )
{
}
protected override void OnPaint( PaintEventArgs e)
{
DoPaint( e) ;
}
private void Form1_PreviewKeyDown( object sender, PreviewKeyDownEventArgs e)
{
DoKeyInput( e) ;
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLkNvbXBvbmVudE1vZGVsOwp1c2luZyBTeXN0ZW0uRGF0YTsKdXNpbmcgU3lzdGVtLkRyYXdpbmc7CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uVGV4dDsKdXNpbmcgU3lzdGVtLldpbmRvd3MuRm9ybXM7CnVzaW5nIFN5c3RlbS5UaHJlYWRpbmcuVGFza3M7CnVzaW5nIFN5c3RlbS5JTzsKCm5hbWVzcGFjZSBTb3Vrb2Jhbgp7CiAgICBwdWJsaWMgcGFydGlhbCBjbGFzcyBGb3JtMSA6IEZvcm0KICAgIHsKICAgICAgICBCaXRtYXAgYm1wOwogICAgICAgIEdyYXBoaWNzIGc7CiAgICAgICAgQWN0aW9uPFByZXZpZXdLZXlEb3duRXZlbnRBcmdzPiBEb0tleUlucHV0OwogICAgICAgIEFjdGlvbjxQYWludEV2ZW50QXJncz4gRG9QYWludDsKICAgICAgICBBY3Rpb24gRG9VcGRhdGU7CiAgICAgICAgcHJpdmF0ZSBUaWxlWyxdIG1UaWxlczsKCiAgICAgICAgW0ZsYWdzXQogICAgICAgIGVudW0gVGlsZQogICAgICAgIHsKICAgICAgICAgICAgTm9uZSA9IDAsCiAgICAgICAgICAgIEthYmUgPSAxLAogICAgICAgICAgICBPa2liYSA9IDIsCiAgICAgICAgICAgIE5pbW90dSA9IDQsCiAgICAgICAgICAgIFBsYXllciA9IDgsCiAgICAgICAgICAgIE9LID0gT2tpYmEgfCBOaW1vdHUKICAgICAgICB9CgogICAgICAgIHB1YmxpYyBGb3JtMSgpCiAgICAgICAgewogICAgICAgICAgICBJbml0aWFsaXplQ29tcG9uZW50KCk7CiAgICAgICAgICAgIFNldFN0eWxlKENvbnRyb2xTdHlsZXMuQWxsUGFpbnRpbmdJbldtUGFpbnQsIHRydWUpOwogICAgICAgICAgICBTZXRTdHlsZShDb250cm9sU3R5bGVzLk9wdGltaXplZERvdWJsZUJ1ZmZlciwgdHJ1ZSk7CiAgICAgICAgICAgIFNldFN0eWxlKENvbnRyb2xTdHlsZXMuUmVzaXplUmVkcmF3LCB0cnVlKTsKICAgICAgICAgICAgU2V0U3R5bGUoQ29udHJvbFN0eWxlcy5Vc2VyUGFpbnQsIHRydWUpOwoKICAgICAgICAgICAgYm1wID0gbmV3IEJpdG1hcCg2NDAsIDQ4MCk7CiAgICAgICAgICAgIGcgPSBHcmFwaGljcy5Gcm9tSW1hZ2UoYm1wKTsKICAgICAgICAgICAgVGFzay5GYWN0b3J5LlN0YXJ0TmV3KEdhbWVNYWluKTsKICAgICAgICB9CgogICAgICAgIHByaXZhdGUgdm9pZCBHYW1lTWFpbigpCiAgICAgICAgewogICAgICAgICAgICBHYW1lSW5pdGlhbGl6ZSgpOwogICAgICAgICAgICBEb1BhaW50ID0gUGFpbnRHYW1lTWFpbjsKICAgICAgICAgICAgRG9VcGRhdGUgPSBVcGRhdGVHYW1lTWFpbjsKICAgICAgICAgICAgRG9LZXlJbnB1dCA9IElucHV0R2FtZU1haW47CgogICAgICAgICAgICB3aGlsZSAodHJ1ZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgRG9VcGRhdGUoKTsKCiAgICAgICAgICAgICAgICBJbnZhbGlkYXRlKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIHByaXZhdGUgdm9pZCBHYW1lSW5pdGlhbGl6ZSgpCiAgICAgICAgewogICAgICAgICAgICAKICAgICAgICAgICAgCiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHZvaWQgTG9hZE1hcChpbnQgbWFwTm8pCiAgICAgICAgewogICAgICAgICAgICB1c2luZyh2YXIgc3IgPSBuZXcgU3RyZWFtUmVhZGVyKEAibWFwIiArIG1hcE5vICsgIi5kYXQiKSkKICAgICAgICAgICAgdXNpbmcgKHZhciB0ciA9IHNyIGFzIFRleHRSZWFkZXIpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIExpc3Q8c3RyaW5nPiBzcyA9IG5ldyBMaXN0PHN0cmluZz4oKTsKICAgICAgICAgICAgICAgIHdoaWxlICghc3IuRW5kT2ZTdHJlYW0pCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgc3MuQWRkKHNyLlJlYWRMaW5lKCkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgbVRpbGVzID0gbmV3IFRpbGVbc3MuQ291bnQoKSwgc3NbMF0uTGVuZ3RoXTsKCiAgICAgICAgICAgICAgICBmb3IgKGludCB5ID0gMDsgeSA8IHNzLkNvdW50KCk7IHkrKykKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHNzW3ldOwogICAgICAgICAgICAgICAgICAgIGZvciAoaW50IHggPSAwOyB4IDwgcy5MZW5ndGg7IHgrKykKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIG1UaWxlc1t5LCB4XSA9IChUaWxlKUNvbnZlcnQuVG9JbnQzMihzW3hdKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIHByaXZhdGUgdm9pZCBJbnB1dEdhbWVNYWluKFByZXZpZXdLZXlEb3duRXZlbnRBcmdzIGUpCiAgICAgICAgewoKICAgICAgICB9CgogICAgICAgIHByaXZhdGUgdm9pZCBQYWludEdhbWVNYWluKFBhaW50RXZlbnRBcmdzIGUpCiAgICAgICAgewogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSB2b2lkIFVwZGF0ZUdhbWVNYWluKCkKICAgICAgICB7CiAgICAgICAgfQoKICAgICAgICBwcm90ZWN0ZWQgb3ZlcnJpZGUgdm9pZCBPblBhaW50KFBhaW50RXZlbnRBcmdzIGUpCiAgICAgICAgewogICAgICAgICAgICBEb1BhaW50KGUpOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSB2b2lkIEZvcm0xX1ByZXZpZXdLZXlEb3duKG9iamVjdCBzZW5kZXIsIFByZXZpZXdLZXlEb3duRXZlbnRBcmdzIGUpCiAgICAgICAgewogICAgICAgICAgICBEb0tleUlucHV0KGUpOwogICAgICAgIH0KCiAgICB9Cn0K
compilation info
prog.cs(4,14): error CS0234: The type or namespace name `Data' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(5,14): error CS0234: The type or namespace name `Drawing' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(8,14): error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference?
prog.cs(9,24): error CS0234: The type or namespace name `Tasks' does not exist in the namespace `System.Threading'. Are you missing an assembly reference?
Compilation failed: 4 error(s), 0 warnings
stdout